Issue with request log and async request

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Issue with request log and async request

jfgosselin
Jetty 9.2.2.v20140723



When handling an async request, Jetty doesn't include the query parameters (e.g. ?key1=val1&key2=val2) from the request in the request log.

Looking at handleAsync in org.eclipse.jetty.server.Server, context.getContextPath() or path doesn't include the query parameters  :

    public void handleAsync(HttpChannel<?> connection) throws IOException, ServletException
    {
        final HttpChannelState state = connection.getRequest().getHttpChannelState();
        final AsyncContextEvent event = state.getAsyncContextEvent();

        final Request baseRequest=connection.getRequest();
        final String path=event.getPath();
        
        if (path!=null)
        {
            // this is a dispatch with a path
            ServletContext context=event.getServletContext();
            HttpURI uri = new HttpURI(URIUtil.addPaths(context==null?null:context.getContextPath(), path));            
            baseRequest.setUri(uri);
            baseRequest.setRequestURI(null);
            baseRequest.setPathInfo(uri.getDecodedPath());
            if (uri.getQuery()!=null)
                baseRequest.mergeQueryParameters(uri.getQuery(), true); //we have to assume dispatch path and query are UTF8
        }