2017-04-07 8 views
1

基本的に私はこの桟橋のサーバーを私のローカルで走らせています。しかし、私は、これは私のweb.xmlファイルで、あなたが私は、Apache CXFを使用して見て、また春、Hibernateと桟橋Jettyのディレクトリ一覧表示を防止するにはどうすればよいですか?

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
          http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" 
     version="3.1"> 

    <context-param> 

     <param-name>contextConfigLocation</param-name> 
     <param-value>classpath:applicationContext.xml,classpath:Spring-Security.xml</param-value> 
    </context-param> 

    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 

    <!-- Spring Security Start --> 
    <listener> 
     <listener-class> 
      org.springframework.web.context.request.RequestContextListener 
     </listener-class> 
    </listener> 

    <filter> 
     <filter-name>springSecurityFilterChain</filter-name> 
     <filter-class>org.springframework.web.filter.DelegatingFilterProxy 
     </filter-class> 
    </filter> 
    <!-- Projenin ana url'inden itibaren spring security aktif ediliyor --> 
    <filter-mapping> 
     <filter-name>springSecurityFilterChain</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 
    <!-- Spring Security End --> 
    <servlet> 
     <servlet-name>CXFServlet</servlet-name> 
     <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> 

     <load-on-startup>1</load-on-startup> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>CXFServlet</servlet-name> 
     <url-pattern>/*</url-pattern> 
    </servlet-mapping> 

</web-app> 

どのように解決することができますを使用する私のindex.jspファイルI see like that

にアクセスすることはできませんそれ。どこが間違っているの?

答えて

1

これはいくつかの場所で回答していますon StackOverflow。デフォルトのサーブレットでdirAllowedパラメータをfalseに設定するだけで済みます。これは、サーブレット記述子のWEB-INF/web.xmlで実行するか、コンテキストの前にロードされた変更されたetc/webdefault.xmlファイル(例えば、Jettyのdeployモジュール経由)を提供することによって行うことができます。ファイルのいずれかで

これは次のようになります。これは、コンテキストパラメータとして定義することができEng.Fouad points outユーザーとして

<servlet> 
    <servlet-name>default</servlet-name> 
    <servlet-class>org.eclipse.jetty.servlet.DefaultServlet</servlet-class> 
    .... 
    <init-param> 
     <param-name>dirAllowed</param-name> 
     <param-value>false</param-value> 
    </init-param> 
    .... 
</servlet> 

<context-param> 
    <param-name>org.eclipse.jetty.servlet.Default.dirAllowed</param-name> 
    <param-value>false</param-value> 
</context-param> 
関連する問題