1

我收到一个 404 错误,如下所示

HTTP Status 404 -

type Status report

message

descriptionThe requested resource () is not available.

GlassFish Server Open Source Edition 3.1.2.2

当我运行我的项目时,下面是我的 web.xml 和 sun-web.xml,有人对我错过了什么有任何想法吗?在我尝试添加 ldap 安全性之前它正在工作

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <filter>
        <filter-name>Upload Filter</filter-name>
        <filter-class>com.corejsf.UploadFilter</filter-class>
        <init-param>
            <param-name>sizeThreshold</param-name>
            <param-value>1024</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>Upload Filter</filter-name>
        <url-pattern>/faces/upload/*</url-pattern>
    </filter-mapping>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.LIBRARIES</param-name>
        <param-value>/WEB-INF/corejsf.taglib.xml</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
        <param-value>true</param-value>
    </context-param>


    <!--  <security-constraint>
        web resources that are protected 
       <web-resource-collection>
          <web-resource-name>All Resources</web-resource-name>
          <url-pattern>/*</url-pattern>
          All methods but OPTIONS must be authenticated. OPTIONS must work without authentication for cross domain in Firefox to work
          <http-method>GETLIB</http-method>
          <http-method>COPY</http-method>
          <http-method>MOVE</http-method>
          <http-method>DELETE</http-method>
          <http-method>PROPFIND</http-method>
          <http-method>GET</http-method>
          <http-method>HEAD</http-method>
          <http-method>PUT</http-method>
          <http-method>MKCOL</http-method>
          <http-method>PROPPATCH</http-method>
          <http-method>LOCK</http-method>
          <http-method>UNLOCK</http-method>
          <http-method>VERSION-CONTROL</http-method>
          <http-method>CHECKIN</http-method>
          <http-method>CHECKOUT</http-method>
          <http-method>UNCHECKOUT</http-method>
          <http-method>REPORT</http-method>
          <http-method>UPDATE</http-method>
          <http-method>CANCELUPLOAD</http-method>
       </web-resource-collection>
       <auth-constraint>
            role-name indicates roles that are allowed to access the web resource specified above 
           <role-name>users</role-name>
       </auth-constraint>
    </security-constraint>-->
    <!-- <display-name>Printing from home to uni :)</display-name>
    <welcome-file-list>
        <welcome-file>index.xhtml</welcome-file>
    </welcome-file-list>
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>LDAP</realm-name>
        <form-login-config>
            <form-login-page>/login.xhtml</form-login-page>
            <form-error-page>/login-failed.xhtml</form-error-page>
        </form-login-config>
    </login-config>-->
    <!--
    <security-constraint>
        <display-name>Security</display-name>
        <web-resource-collection>
            <web-resource-name>Secured</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
      <auth-constraint>
            <role-name>uid</role-name>
        </auth-constraint>
        <user-data-constraint>
            <transport-guarantee>NONE</transport-guarantee>
        </user-data-constraint> 
    </security-constraint>-->
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>LDAP</realm-name>
        <form-login-config>
            <form-login-page>/login.html</form-login-page>
            <form-error-page>/login.html</form-error-page>
        </form-login-config>
    </login-config>
    <security-role>
        <role-name>user</role-name>
    </security-role>
    <security-constraint>
        <!-- web resources that are protected -->
        <web-resource-collection>
            <web-resource-name>All Resources</web-resource-name>
            <url-pattern>/*</url-pattern>
            <!-- All methods but OPTIONS must be authenticated. OPTIONS must work without authentication for cross domain in Firefox to work -->
            <http-method>GETLIB</http-method>
            <http-method>COPY</http-method>
            <http-method>MOVE</http-method>
            <http-method>DELETE</http-method>
            <http-method>PROPFIND</http-method>
            <http-method>GET</http-method>
            <http-method>HEAD</http-method>
            <http-method>PUT</http-method>
            <http-method>MKCOL</http-method>
            <http-method>PROPPATCH</http-method>
            <http-method>LOCK</http-method>
            <http-method>UNLOCK</http-method>
            <http-method>VERSION-CONTROL</http-method>
            <http-method>CHECKIN</http-method>
            <http-method>CHECKOUT</http-method>
            <http-method>UNCHECKOUT</http-method>
            <http-method>REPORT</http-method>
            <http-method>UPDATE</http-method>
            <http-method>CANCELUPLOAD</http-method>
        </web-resource-collection>
        <auth-constraint>
            <!-- role-name indicates roles that are allowed to access the web resource specified above -->
            <role-name>role1</role-name>
        </auth-constraint>
    </security-constraint> 
</web-app>

sun-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
    <context-root>/fileupload</context-root>
    <class-loader delegate="true"/>
   <!-- <jsp-config>
        <property name="keepgenerated" value="true">
            <description>Keep a copy of the generated servlet class' java code.</description>
        </property>
    </jsp-config>-->
   <!-- <security-role-mapping>
        <role-name>users</role-name>
        <group-name>LDAP</group-name>
    </security-role-mapping>
    <property name="keepgenerated" value="true">
        <description>Keep a copy of the generated servlet class java code.</description>
    </property>-->
     <security-role-mapping>
        <role-name>user</role-name>
       <!-- <group-name>Authenticated</group-name> -->
    </security-role-mapping>
</sun-web-app>
4

0 回答 0