0
votes

I have a simple web app that uses basic jsp's and servlets. I have a servlet-filter mapped to /*. I have a welcome file configured to index.jsp

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

...

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

The problem I am having is when a request for a resource that doesn't exist and should return a 404 error when deployed on the app engine returns a 302 endlessly while trying to append a slash + the welcome file repeatedly.

E.G: A request for http://myyapp.appspot.com/foo (where there is nothing configured for foo) yeilds the following:

http://myyapp.appspot.com/foo/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp/

On the development server this returns the expected 404. If I remove the filter mapping it also returns the 404 on the app engine.

This seems fairly basic, so I am guessing I have missed something somewhere. Any ideas?

1
Do you know who is doing the redirecting? Welcome-list-file alone does not. - Thilo
Do you use this filter just to register classes with objectify? - Peter Knego
There must be some extra piece of information missing. ObjectifyFilter won't issue any kind of redirect (go ahead and look at the code), nor with GAE without special prodding. - stickfigure
I do not know what is doing the redirecting. I am assuming its an app-engine webserver/appserver. As I mentioned it works as expected locally on the development server. - laduke
I have tried it with a simple filter as well that does nothing but chain.doFilter(request, response); and get the same result. As stickfigure mentioned the ObjectifyFilter doesn't really do much either and simply passes things along. - laduke

1 Answers

0
votes

It looks like one essential ingredient to the problem is the jsp-config tag in web.xml. Although I think the content does not matter, mine looked like this:

<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <page-encoding>UTF-8</page-encoding>
    </jsp-property-group>
</jsp-config>

Removing the jsp-config tag resolved the problem for me, i.e. it is a workaround. In my case it did not hurt much, because I can specify the page encoding on each page separately. However I am still interested in a real solution.