final String old_uri=baseRequest.getRequestURI();
final String old_context_path=baseRequest.getContextPath();
final String old_servlet_path=baseRequest.getServletPath();
final String old_path_info=baseRequest.getPathInfo();
final String old_query=baseRequest.getQueryString();
final Attributes old_attr=baseRequest.getAttributes();
final DispatcherType old_type=baseRequest.getDispatcherType();
MultiMap<String> old_params=baseRequest.getParameters();
try
{
baseRequest.setHandled(false);
baseRequest.setDispatcherType(dispatch);
if (_named!=null)
_contextHandler.handle(_named,baseRequest, (HttpServletRequest)request, (HttpServletResponse)response);
else
{
// process any query string from the dispatch URL
String query=_dQuery;
if (query!=null)
{
// force parameter extraction
if (old_params==null)
{
baseRequest.extractParameters();
old_params=baseRequest.getParameters();
}
baseRequest.mergeQueryString(query);
}
ForwardAttributes attr = new ForwardAttributes(old_attr);
//If we have already been forwarded previously, then keep using the established
//original value. Otherwise, this is the first forward and we need to establish the values.
//Note: the established value on the original request for pathInfo and
//for queryString is allowed to be null, but cannot be null for the other values.
if (old_attr.getAttribute(FORWARD_REQUEST_URI) != null)
{
attr._pathInfo=(String)old_attr.getAttribute(FORWARD_PATH_INFO);
attr._query=(String)old_attr.getAttribute(FORWARD_QUERY_STRING);
attr._requestURI=(String)old_attr.getAttribute(FORWARD_REQUEST_URI);
attr._contextPath=(String)old_attr.getAttribute(FORWARD_CONTEXT_PATH);
attr._servletPath=(String)old_attr.getAttribute(FORWARD_SERVLET_PATH);
}
else
{
attr._pathInfo=old_path_info;
attr._query=old_query;