Hello,

For a website I have hosted on appengine, I'm finding that page not
found exceptions result in infinite recursion of url paths inspite of
use of the servlet container error-page definition.

I defined the error-page and code for 404 in the web.xml.  Deployment
of the app in dev appengine container shows that a 404 is returned to
the client along with the body of the page defined in the error-page
element.

When I deploy the app to the appengine production environment however,
a request to a non-existent path within the domain in combination with
the Google front end web server results in a redirect to the request
url + /index.jsp/  (so a page not found results in infinite recursion
request url + /index.jsp/index.jsp/...).

As one attempted work around, I used a filter to intercept the request
and response before it
leaves the appengine container.  That filter changes the http status
to 200 and lets the request continue to the error-page.

The filter works as expected in dev appengine:

    INFO: javax.servlet.ServletContext log:
PageNotFoundFilter:DoBeforeProcessing.response is     committed =
false res=HTTP/1.1 404

    Feb 10, 2011 2:17:52 PM
com.google.appengine.tools.development.ApiProxyLocalImpl log
    INFO: javax.servlet.ServletContext log:
PageNotFoundFilter:DoAfterProcessing.response is     committed = true
res=HTTP/1.1 200

When the same solution was deployed to production, however, the filter
isn't necessarily started
in time to handle the request.

    javax.servlet.ServletContext log: PageNotFoundFilter:Initializing
filter

    This request caused a new process to be started for your
application, and thus caused your    application code to be loaded for
the first time. This request may thus take longer and use more     CPU
than a typical request for your application.

I tried variations on the request with a dozen or so different
requests and a few browsers.  When the dashboard logs were available
after a short while, only a couple of those had been logged and with
the same statements just mentioned.   Any immediate repeat of the non-
existent paths by a fresh client browser to rule out caching etc, did
not turn up in the logs.

The Google front end web server may be intercepting and handling a 404
request, and it may be caching errors and returning a similar response
to the same IP address (and hence subsequent  requests don't reach the
appengine...not sure), but I still should be able to forward the
request and change the response before it's committed and leaves the
appengine servlet engine.

As another attempted work around, I used a servlet for the error-page
and added a request forward and response status setting to 200.

The servlet error solution worked in development and did not work in
production.  The single log statement in production said the servlet
process itself didn't start.

Soooo, it looks like production appengine isn't  implementing the
error-page of the deployment descriptor?  How should we handle page
not found?

Thanks for your time,
    Nichole

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to