Skifozoa
Skifozoa

Reputation: 303

Failure to convert static files to resource files in app engine so that http requests pass authentication filter

I am trying to make requests for a html file pass a filter in a google app engine deployment. I aim to accomplish this by excluding it as static file and making it a resource file as per the recommendation on: https://groups.google.com/forum/?fromgroups=#!topic/google-appengine-java/VbPYdkNhW98

Unfortunately I fail at doing so. So either I misundertstood and this is impossible or I am doing something wrong. Can anybody shed some light on this? Calls to localhost:8888/index.html or localhost:8888/app.html don't go through the filter.

Greatly appreciated!

ps: all .html files are located in the /war/WWW-ROOT/ directory of my eclipse project. The filter works perfectly for /servlets/firstservlet. Below this post you find the contents of web.xml and 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>

Upvotes: 1

Views: 574

Answers (1)

Skifozoa
Skifozoa

Reputation: 303

Made the mistake of placing the static-files and resource-files elements in web.xml instead of appengine-web.xml. Moving them solved the issue.

Upvotes: 2

Related Questions