1

GoogleAppEngineのデプロイでHTMLファイルのリクエストにフィルターを通過させようとしています。https://groups.google.com/forum/?fromgroups=#!topic/google-appengine-java/VbPYdkNhW98の推奨事項に従って、静的ファイルとして除外し、リソースファイルにすることで、これを実現することを目指しています。

残念ながら私はそうすることができません。ですから、私は誤解してこれは不可能であるか、何か間違ったことをしています。誰かがこれに光を当てることができますか?フィルタを呼び出すlocalhost:8888/index.htmllocalhost:8888/app.html、通過しない。

よろしくお願いします!

ps:すべての.htmlファイルは/war/WWW-ROOT/私のeclipseプロジェクトのディレクトリにあります。フィルタは、に対して完全に機能し/servlets/firstservletます。この投稿の下にとの内容がweb.xmlありappengine-web.xmlます。

Web.xml

<?xml version="1.0" encoding="utf-8" standalone="no"?><web-app 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" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

<!-- servlet definition and mapping -->

<servlet>
    <servlet-name>firstservlet</servlet-name>
    <servlet-class>zorgco.FirstServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>firstservlet</servlet-name>
    <url-pattern>/servlets/firstservlet</url-pattern>
</servlet-mapping>


<!-- enforce https -->

<security-constraint>
    <web-resource-collection>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>


<!-- define and enforce authentication filters -->

<filter>
    <filter-name>authorization</filter-name>
    <filter-class>zorgco.AuthorizationFilter</filter-class>
</filter>

<filter-mapping>
    <filter-name>authorization</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<static-files>
    <exclude path="/*" />
</static-files>

<resource-files>
    <include path="/*" />
</resource-files>

<!-- Define welcome files -->

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>

Appengine-web.xml

<?xml version="1.0" encoding="utf-8"?>

<application>Name</application>

<version>1</version>

<threadsafe>true</threadsafe>

<public-root>/WWW-ROOT</public-root>

<system-properties> 
    <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>

<sessions-enabled>true</sessions-enabled>

4

1 に答える 1

2

static-filesandresource-files要素を appengine-web.xml ではなく web.xml に配置するという間違いを犯しました。それらを移動すると問題が解決しました。

于 2013-01-30T17:30:12.257 に答える