On Wed, Aug 6, 2008 at 6:26 PM, Wes Gamble <
weyus@...> wrote:
>
> So I've taken a look at the jruby-rack source to see if I could figure out
> what's going on. I have a theory.
>
> Here is the doFilter() method of org.jruby.rack.RackFilter:
>
> public void doFilter(ServletRequest request, ServletResponse response,
> FilterChain chain)
> throws IOException, ServletException {
> HttpServletRequest httpRequest = maybeAppendHtmlToPath(request);
> HttpServletResponse httpResponse = (HttpServletResponse) response;
> ResponseStatusCapture capture = new
> ResponseStatusCapture(httpResponse);
> chain.doFilter(httpRequest, capture);
>
> if (capture.isError()) {
> httpResponse.reset();
> request.setAttribute(RackDispatcher.DYNAMIC_REQS_ONLY,
> Boolean.TRUE);
> dispatcher.process((HttpServletRequest) request, httpResponse);
> }
> }
>
> The way that this appears to work is that the chain.doFilter(httpRequest,
> capture) call occurs for our dynamic request (e.g. "/users/index"). It will
> fail of course, since there is no file or servlet configured for that URI.
> What should happen is that the capture variable (which is an instance of
> class ResponseStatusCapture extends HttpServletResponseWrapper) should have
> its status set to 404 and then the "if (capture.isError())" block will be
> executed, which will actually dispatch the request to Merb.
>
> The fact that I get the 404 back indicates to me that the capture variable
> does not get it's status set as expected, and therefore cannot be properly
> interrogated as to whether isError() is true, and thus, no dispatching on to
> Merb.
>
> Does this make sense? Can anyone help me figure out how best to verify it?
Sounds like a good operating theory. I'd suggest grabbing the source
and building it yourself, then you can add some println debugging or
perhaps load the source into your IDE so you can set breakpoints and
step through source. Building instrctions are at the bottom of the
page in the wiki.
/Nick
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email