mods prior to backport to 2.5 API. These changes should be in both 7 and 8
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@17 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
24f7971e10
commit
9f386395e7
|
@ -41,21 +41,31 @@ import org.eclipse.jetty.util.UrlEncoded;
|
|||
*/
|
||||
public class Dispatcher implements RequestDispatcher
|
||||
{
|
||||
/*
|
||||
public static final String FORWARD_REQUEST_URI = "javax.servlet.forward.request_uri";
|
||||
public static final String FORWARD_CONTEXT_PATH = "javax.servlet.forward.context_path";
|
||||
public static final String FORWARD_PATH_INFO = "javax.servlet.forward.path_info";
|
||||
public static final String FORWARD_SERVLET_PATH = "javax.servlet.forward.servlet_path";
|
||||
public static final String FORWARD_QUERY_STRING = "javax.servlet.forward.query_string";
|
||||
public static final String INCLUDE_REQUEST_URI = "javax.servlet.include.request_uri";
|
||||
public static final String INCLUDE_CONTEXT_PATH = "javax.servlet.include.context_path";
|
||||
public static final String INCLUDE_PATH_INFO = "javax.servlet.include.path_info";
|
||||
public static final String INCLUDE_SERVLET_PATH = "javax.servlet.include.servlet_path";
|
||||
public static final String INCLUDE_QUERY_STRING = "javax.servlet.include.query_string";
|
||||
|
||||
public static final String ERROR_EXCEPTION = "javax.servlet.error.exception";
|
||||
public static final String ERROR_EXCEPTION_TYPE = "javax.servlet.error.exception_type";
|
||||
public static final String ERROR_MESSAGE = "javax.servlet.error.message";
|
||||
public static final String ERROR_REQUEST_URI = "javax.servlet.error.request_uri";
|
||||
public static final String ERROR_SERVLET_NAME = "javax.servlet.error.servlet_name";
|
||||
public static final String ERROR_STATUS_CODE = "javax.servlet.error.status_code";
|
||||
*/
|
||||
|
||||
/** Dispatch include attribute names */
|
||||
public final static String __INCLUDE_PREFIX="javax.servlet.include.";
|
||||
public final static String __INCLUDE_REQUEST_URI= INCLUDE_REQUEST_URI;
|
||||
public final static String __INCLUDE_CONTEXT_PATH= INCLUDE_CONTEXT_PATH;
|
||||
public final static String __INCLUDE_SERVLET_PATH= INCLUDE_SERVLET_PATH;
|
||||
public final static String __INCLUDE_PATH_INFO= INCLUDE_PATH_INFO;
|
||||
public final static String __INCLUDE_QUERY_STRING= INCLUDE_QUERY_STRING;
|
||||
|
||||
/** Dispatch include attribute names */
|
||||
public final static String __FORWARD_PREFIX="javax.servlet.forward.";
|
||||
public final static String __FORWARD_REQUEST_URI= FORWARD_REQUEST_URI;
|
||||
public final static String __FORWARD_CONTEXT_PATH= FORWARD_CONTEXT_PATH;
|
||||
public final static String __FORWARD_SERVLET_PATH= FORWARD_SERVLET_PATH;
|
||||
public final static String __FORWARD_PATH_INFO= FORWARD_PATH_INFO;
|
||||
public final static String __FORWARD_QUERY_STRING= FORWARD_QUERY_STRING;
|
||||
|
||||
/** JSP attributes */
|
||||
public final static String __JSP_FILE="org.apache.catalina.jsp_file";
|
||||
|
@ -293,13 +303,13 @@ public class Dispatcher implements RequestDispatcher
|
|||
//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 ((String)old_attr.getAttribute(__FORWARD_REQUEST_URI) != null)
|
||||
if ((String)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);
|
||||
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
|
||||
{
|
||||
|
@ -368,15 +378,15 @@ public class Dispatcher implements RequestDispatcher
|
|||
{
|
||||
if (Dispatcher.this._named==null)
|
||||
{
|
||||
if (key.equals(__FORWARD_PATH_INFO))
|
||||
if (key.equals(FORWARD_PATH_INFO))
|
||||
return _pathInfo;
|
||||
if (key.equals(__FORWARD_REQUEST_URI))
|
||||
if (key.equals(FORWARD_REQUEST_URI))
|
||||
return _requestURI;
|
||||
if (key.equals(__FORWARD_SERVLET_PATH))
|
||||
if (key.equals(FORWARD_SERVLET_PATH))
|
||||
return _servletPath;
|
||||
if (key.equals(__FORWARD_CONTEXT_PATH))
|
||||
if (key.equals(FORWARD_CONTEXT_PATH))
|
||||
return _contextPath;
|
||||
if (key.equals(__FORWARD_QUERY_STRING))
|
||||
if (key.equals(FORWARD_QUERY_STRING))
|
||||
return _query;
|
||||
}
|
||||
|
||||
|
@ -402,16 +412,16 @@ public class Dispatcher implements RequestDispatcher
|
|||
if (_named==null)
|
||||
{
|
||||
if (_pathInfo!=null)
|
||||
set.add(__FORWARD_PATH_INFO);
|
||||
set.add(FORWARD_PATH_INFO);
|
||||
else
|
||||
set.remove(__FORWARD_PATH_INFO);
|
||||
set.add(__FORWARD_REQUEST_URI);
|
||||
set.add(__FORWARD_SERVLET_PATH);
|
||||
set.add(__FORWARD_CONTEXT_PATH);
|
||||
set.remove(FORWARD_PATH_INFO);
|
||||
set.add(FORWARD_REQUEST_URI);
|
||||
set.add(FORWARD_SERVLET_PATH);
|
||||
set.add(FORWARD_CONTEXT_PATH);
|
||||
if (_query!=null)
|
||||
set.add(__FORWARD_QUERY_STRING);
|
||||
set.add(FORWARD_QUERY_STRING);
|
||||
else
|
||||
set.remove(__FORWARD_QUERY_STRING);
|
||||
set.remove(FORWARD_QUERY_STRING);
|
||||
}
|
||||
|
||||
return Collections.enumeration(set);
|
||||
|
@ -422,15 +432,15 @@ public class Dispatcher implements RequestDispatcher
|
|||
{
|
||||
if (_named==null && key.startsWith("javax.servlet."))
|
||||
{
|
||||
if (key.equals(__FORWARD_PATH_INFO))
|
||||
if (key.equals(FORWARD_PATH_INFO))
|
||||
_pathInfo=(String)value;
|
||||
else if (key.equals(__FORWARD_REQUEST_URI))
|
||||
else if (key.equals(FORWARD_REQUEST_URI))
|
||||
_requestURI=(String)value;
|
||||
else if (key.equals(__FORWARD_SERVLET_PATH))
|
||||
else if (key.equals(FORWARD_SERVLET_PATH))
|
||||
_servletPath=(String)value;
|
||||
else if (key.equals(__FORWARD_CONTEXT_PATH))
|
||||
else if (key.equals(FORWARD_CONTEXT_PATH))
|
||||
_contextPath=(String)value;
|
||||
else if (key.equals(__FORWARD_QUERY_STRING))
|
||||
else if (key.equals(FORWARD_QUERY_STRING))
|
||||
_query=(String)value;
|
||||
|
||||
else if (value==null)
|
||||
|
@ -486,11 +496,11 @@ public class Dispatcher implements RequestDispatcher
|
|||
{
|
||||
if (Dispatcher.this._named==null)
|
||||
{
|
||||
if (key.equals(__INCLUDE_PATH_INFO)) return _pathInfo;
|
||||
if (key.equals(__INCLUDE_SERVLET_PATH)) return _servletPath;
|
||||
if (key.equals(__INCLUDE_CONTEXT_PATH)) return _contextPath;
|
||||
if (key.equals(__INCLUDE_QUERY_STRING)) return _query;
|
||||
if (key.equals(__INCLUDE_REQUEST_URI)) return _requestURI;
|
||||
if (key.equals(INCLUDE_PATH_INFO)) return _pathInfo;
|
||||
if (key.equals(INCLUDE_SERVLET_PATH)) return _servletPath;
|
||||
if (key.equals(INCLUDE_CONTEXT_PATH)) return _contextPath;
|
||||
if (key.equals(INCLUDE_QUERY_STRING)) return _query;
|
||||
if (key.equals(INCLUDE_REQUEST_URI)) return _requestURI;
|
||||
}
|
||||
else if (key.startsWith(__INCLUDE_PREFIX))
|
||||
return null;
|
||||
|
@ -514,16 +524,16 @@ public class Dispatcher implements RequestDispatcher
|
|||
if (_named==null)
|
||||
{
|
||||
if (_pathInfo!=null)
|
||||
set.add(__INCLUDE_PATH_INFO);
|
||||
set.add(INCLUDE_PATH_INFO);
|
||||
else
|
||||
set.remove(__INCLUDE_PATH_INFO);
|
||||
set.add(__INCLUDE_REQUEST_URI);
|
||||
set.add(__INCLUDE_SERVLET_PATH);
|
||||
set.add(__INCLUDE_CONTEXT_PATH);
|
||||
set.remove(INCLUDE_PATH_INFO);
|
||||
set.add(INCLUDE_REQUEST_URI);
|
||||
set.add(INCLUDE_SERVLET_PATH);
|
||||
set.add(INCLUDE_CONTEXT_PATH);
|
||||
if (_query!=null)
|
||||
set.add(__INCLUDE_QUERY_STRING);
|
||||
set.add(INCLUDE_QUERY_STRING);
|
||||
else
|
||||
set.remove(__INCLUDE_QUERY_STRING);
|
||||
set.remove(INCLUDE_QUERY_STRING);
|
||||
}
|
||||
|
||||
return Collections.enumeration(set);
|
||||
|
@ -534,11 +544,11 @@ public class Dispatcher implements RequestDispatcher
|
|||
{
|
||||
if (_named==null && key.startsWith("javax.servlet."))
|
||||
{
|
||||
if (key.equals(__INCLUDE_PATH_INFO)) _pathInfo=(String)value;
|
||||
else if (key.equals(__INCLUDE_REQUEST_URI)) _requestURI=(String)value;
|
||||
else if (key.equals(__INCLUDE_SERVLET_PATH)) _servletPath=(String)value;
|
||||
else if (key.equals(__INCLUDE_CONTEXT_PATH)) _contextPath=(String)value;
|
||||
else if (key.equals(__INCLUDE_QUERY_STRING)) _query=(String)value;
|
||||
if (key.equals(INCLUDE_PATH_INFO)) _pathInfo=(String)value;
|
||||
else if (key.equals(INCLUDE_REQUEST_URI)) _requestURI=(String)value;
|
||||
else if (key.equals(INCLUDE_SERVLET_PATH)) _servletPath=(String)value;
|
||||
else if (key.equals(INCLUDE_CONTEXT_PATH)) _contextPath=(String)value;
|
||||
else if (key.equals(INCLUDE_QUERY_STRING)) _query=(String)value;
|
||||
else if (value==null)
|
||||
_attr.removeAttribute(key);
|
||||
else
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
// ========================================================================
|
||||
// Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// All rights reserved. This program and the accompanying materials
|
||||
// are made available under the terms of the Eclipse Public License v1.0
|
||||
// and Apache License v2.0 which accompanies this distribution.
|
||||
// The Eclipse Public License is available at
|
||||
// http://www.eclipse.org/legal/epl-v10.html
|
||||
// The Apache License v2.0 is available at
|
||||
// http://www.opensource.org/licenses/apache2.0.php
|
||||
// You may elect to redistribute this code under either of these licenses.
|
||||
// ========================================================================
|
||||
|
||||
package org.eclipse.jetty.server;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/** HttpOnlyCookie.
|
||||
*
|
||||
* <p>
|
||||
* Implements {@link javax.servlet.Cookie} from the {@link javax.servlet} package.
|
||||
* </p>
|
||||
* This derivation of javax.servlet.http.Cookie can be used to indicate
|
||||
* that the microsoft httponly extension should be used.
|
||||
* The addSetCookie method on HttpFields checks for this type.
|
||||
* @deprecated use {@link javax.servlet.Cookie#setHttpOnly(boolean)}
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class HttpOnlyCookie extends Cookie
|
||||
{
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
* @param name
|
||||
* @param value
|
||||
*/
|
||||
public HttpOnlyCookie(String name, String value)
|
||||
{
|
||||
super(name, value);
|
||||
setHttpOnly(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -49,6 +49,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpCookie;
|
||||
import org.eclipse.jetty.http.HttpFields;
|
||||
import org.eclipse.jetty.http.HttpHeaders;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
|
@ -341,11 +342,11 @@ public class Request implements HttpServletRequest
|
|||
if (DispatcherType.ASYNC.equals(_dispatcherType))
|
||||
{
|
||||
// TODO handle forwards(path!)
|
||||
if (name.equals(Dispatcher.__FORWARD_PATH_INFO)) return getPathInfo();
|
||||
if (name.equals(Dispatcher.__FORWARD_REQUEST_URI)) return getRequestURI();
|
||||
if (name.equals(Dispatcher.__FORWARD_SERVLET_PATH)) return getServletPath();
|
||||
if (name.equals(Dispatcher.__FORWARD_CONTEXT_PATH)) return getContextPath();
|
||||
if (name.equals(Dispatcher.__FORWARD_QUERY_STRING)) return getQueryString();
|
||||
if (name.equals(Dispatcher.FORWARD_PATH_INFO)) return getPathInfo();
|
||||
if (name.equals(Dispatcher.FORWARD_REQUEST_URI)) return getRequestURI();
|
||||
if (name.equals(Dispatcher.FORWARD_SERVLET_PATH)) return getServletPath();
|
||||
if (name.equals(Dispatcher.FORWARD_CONTEXT_PATH)) return getContextPath();
|
||||
if (name.equals(Dispatcher.FORWARD_QUERY_STRING)) return getQueryString();
|
||||
}
|
||||
|
||||
if (_attributes==null)
|
||||
|
@ -1165,7 +1166,7 @@ public class Request implements HttpServletRequest
|
|||
if (_session == null && _sessionManager!=null && create )
|
||||
{
|
||||
_session=_sessionManager.newHttpSession(this);
|
||||
Cookie cookie=_sessionManager.getSessionCookie(_session,getContextPath(),isSecure());
|
||||
HttpCookie cookie=_sessionManager.getSessionCookie(_session,getContextPath(),isSecure());
|
||||
if (cookie!=null)
|
||||
_connection.getResponse().addCookie(cookie);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.Generator;
|
||||
import org.eclipse.jetty.http.HttpCookie;
|
||||
import org.eclipse.jetty.http.HttpFields;
|
||||
import org.eclipse.jetty.http.HttpGenerator;
|
||||
import org.eclipse.jetty.http.HttpHeaderValues;
|
||||
|
@ -121,6 +122,15 @@ public class Response implements HttpServletResponse
|
|||
_writer=null;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.http.HttpServletResponse#addCookie(javax.servlet.http.Cookie)
|
||||
*/
|
||||
public void addCookie(HttpCookie cookie)
|
||||
{
|
||||
_connection.getResponseFields().addSetCookie(cookie);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/*
|
||||
* @see javax.servlet.http.HttpServletResponse#addCookie(javax.servlet.http.Cookie)
|
||||
|
@ -134,7 +144,7 @@ public class Response implements HttpServletResponse
|
|||
cookie.getMaxAge(),
|
||||
cookie.getComment(),
|
||||
cookie.getSecure(),
|
||||
cookie.isHttpOnly(),
|
||||
false,//cookie.isHttpOnly(),
|
||||
cookie.getVersion());
|
||||
}
|
||||
|
||||
|
@ -286,10 +296,10 @@ public class Response implements HttpServletResponse
|
|||
if (error_handler!=null)
|
||||
{
|
||||
// TODO - probably should reset these after the request?
|
||||
request.setAttribute(RequestDispatcher.ERROR_STATUS_CODE,new Integer(code));
|
||||
request.setAttribute(RequestDispatcher.ERROR_MESSAGE, message);
|
||||
request.setAttribute(RequestDispatcher.ERROR_REQUEST_URI, request.getRequestURI());
|
||||
request.setAttribute(RequestDispatcher.ERROR_SERVLET_NAME,request.getServletName());
|
||||
request.setAttribute(Dispatcher.ERROR_STATUS_CODE,new Integer(code));
|
||||
request.setAttribute(Dispatcher.ERROR_MESSAGE, message);
|
||||
request.setAttribute(Dispatcher.ERROR_REQUEST_URI, request.getRequestURI());
|
||||
request.setAttribute(Dispatcher.ERROR_SERVLET_NAME,request.getServletName());
|
||||
|
||||
error_handler.handle(null,_connection.getRequest(),this);
|
||||
}
|
||||
|
|
|
@ -15,10 +15,10 @@ package org.eclipse.jetty.server;
|
|||
|
||||
import java.util.EventListener;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpCookie;
|
||||
import org.eclipse.jetty.server.session.SessionHandler;
|
||||
import org.eclipse.jetty.util.component.LifeCycle;
|
||||
|
||||
|
@ -177,7 +177,7 @@ public interface SessionManager extends LifeCycle
|
|||
* {@link Cookie cookie object} that should be set on the client in order to link future HTTP requests
|
||||
* with the <code>session</code>. If cookies are not in use, this method returns <code>null</code>.
|
||||
*/
|
||||
public Cookie getSessionCookie(HttpSession session, String contextPath, boolean requestIsSecure);
|
||||
public HttpCookie getSessionCookie(HttpSession session, String contextPath, boolean requestIsSecure);
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
@ -235,7 +235,7 @@ public interface SessionManager extends LifeCycle
|
|||
* the session or to refresh a session cookie that may expire.
|
||||
* @see #complete(HttpSession)
|
||||
*/
|
||||
public Cookie access(HttpSession session, boolean secure);
|
||||
public HttpCookie access(HttpSession session, boolean secure);
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/**
|
||||
|
|
|
@ -675,10 +675,10 @@ public class ContextHandler extends HandlerWrapper implements Attributes, Server
|
|||
public void handle(String target, HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
Request baseRequest=(request instanceof Request)?(Request)request:HttpConnection.getCurrentConnection().getRequest();
|
||||
DispatcherType dispatch=request.getDispatcherType();
|
||||
Request base_request=(request instanceof Request)?(Request)request:HttpConnection.getCurrentConnection().getRequest();
|
||||
DispatcherType dispatch=base_request.getDispatcherType();
|
||||
|
||||
if( !isStarted() || _shutdown || (DispatcherType.REQUEST.equals(dispatch) && baseRequest.isHandled()))
|
||||
if( !isStarted() || _shutdown || (DispatcherType.REQUEST.equals(dispatch) && base_request.isHandled()))
|
||||
return;
|
||||
|
||||
// Check the vhosts
|
||||
|
@ -719,7 +719,7 @@ public class ContextHandler extends HandlerWrapper implements Attributes, Server
|
|||
if (_contextPath.length()==target.length() && _contextPath.length()>1 &&!_allowNullPathInfo)
|
||||
{
|
||||
// context request must end with /
|
||||
baseRequest.setHandled(true);
|
||||
base_request.setHandled(true);
|
||||
if (request.getQueryString()!=null)
|
||||
response.sendRedirect(URIUtil.addPaths(request.getRequestURI(),URIUtil.SLASH)+"?"+request.getQueryString());
|
||||
else
|
||||
|
@ -733,7 +733,7 @@ public class ContextHandler extends HandlerWrapper implements Attributes, Server
|
|||
return;
|
||||
}
|
||||
|
||||
doHandle(target,baseRequest,request,response);
|
||||
doHandle(target,base_request,request,response);
|
||||
}
|
||||
|
||||
|
||||
|
@ -753,7 +753,7 @@ public class ContextHandler extends HandlerWrapper implements Attributes, Server
|
|||
Thread current_thread=null;
|
||||
String pathInfo=null;
|
||||
|
||||
DispatcherType dispatch=request.getDispatcherType();
|
||||
DispatcherType dispatch=baseRequest.getDispatcherType();
|
||||
|
||||
old_context=baseRequest.getContext();
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.server.HttpConnection;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.RequestLog;
|
||||
import org.eclipse.jetty.server.Response;
|
||||
|
@ -47,7 +48,8 @@ public class RequestLogHandler extends HandlerWrapper
|
|||
throws IOException, ServletException
|
||||
{
|
||||
super.handle(target, request, response);
|
||||
if (DispatcherType.REQUEST.equals(request.getDispatcherType()) && _requestLog!=null)
|
||||
Request base_request=(request instanceof Request)?(Request)request:HttpConnection.getCurrentConnection().getRequest();
|
||||
if (DispatcherType.REQUEST.equals(base_request.getDispatcherType()) && _requestLog!=null)
|
||||
_requestLog.log((Request)request, (Response)response);
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ public class StatisticsHandler extends HandlerWrapper implements CompleteHandler
|
|||
_requestsActiveDurationMax=duration;
|
||||
|
||||
|
||||
if(request.isAsyncStarted())
|
||||
if(base_request.isAsyncStarted())
|
||||
{
|
||||
Object list = base_request.getAttribute(COMPLETE_HANDLER_ATTR);
|
||||
base_request.setAttribute(COMPLETE_HANDLER_ATTR, LazyList.add(list, this));
|
||||
|
|
|
@ -34,6 +34,7 @@ import javax.servlet.http.HttpSessionContext;
|
|||
import javax.servlet.http.HttpSessionEvent;
|
||||
import javax.servlet.http.HttpSessionListener;
|
||||
|
||||
import org.eclipse.jetty.http.HttpCookie;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.SessionIdManager;
|
||||
import org.eclipse.jetty.server.SessionManager;
|
||||
|
@ -97,7 +98,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public Cookie access(HttpSession session,boolean secure)
|
||||
public HttpCookie access(HttpSession session,boolean secure)
|
||||
{
|
||||
long now=System.currentTimeMillis();
|
||||
|
||||
|
@ -111,7 +112,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
|
|||
)
|
||||
)
|
||||
{
|
||||
Cookie cookie=getSessionCookie(session,_context.getContextPath(),secure);
|
||||
HttpCookie cookie=getSessionCookie(session,_context.getContextPath(),secure);
|
||||
s.cookieSet();
|
||||
s.setIdChanged(false);
|
||||
return cookie;
|
||||
|
@ -308,24 +309,20 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement
|
|||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public Cookie getSessionCookie(HttpSession session, String contextPath, boolean requestIsSecure)
|
||||
public HttpCookie getSessionCookie(HttpSession session, String contextPath, boolean requestIsSecure)
|
||||
{
|
||||
if (isUsingCookies())
|
||||
{
|
||||
String id = getNodeId(session);
|
||||
Cookie cookie=new Cookie(_sessionCookie,id);
|
||||
cookie.setHttpOnly(getHttpOnly());
|
||||
|
||||
cookie.setPath((contextPath==null||contextPath.length()==0)?"/":contextPath);
|
||||
cookie.setMaxAge(getMaxCookieAge());
|
||||
cookie.setSecure(requestIsSecure&&getSecureCookies());
|
||||
|
||||
// set up the overrides
|
||||
if (_sessionDomain!=null)
|
||||
cookie.setDomain(_sessionDomain);
|
||||
if (_sessionPath!=null)
|
||||
cookie.setPath(_sessionPath);
|
||||
|
||||
HttpCookie cookie=new HttpCookie(
|
||||
_sessionCookie,
|
||||
id,
|
||||
_sessionDomain,
|
||||
(contextPath==null||contextPath.length()==0)?"/":contextPath,
|
||||
getMaxCookieAge(),
|
||||
getHttpOnly(),
|
||||
requestIsSecure&&getSecureCookies());
|
||||
|
||||
return cookie;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -25,6 +25,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.eclipse.jetty.http.HttpCookie;
|
||||
import org.eclipse.jetty.server.HttpConnection;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
import org.eclipse.jetty.server.RetryRequest;
|
||||
|
@ -162,9 +163,9 @@ public class SessionHandler extends HandlerWrapper
|
|||
{
|
||||
if(session!=old_session)
|
||||
{
|
||||
Cookie cookie = _sessionManager.access(session,request.isSecure());
|
||||
HttpCookie cookie = _sessionManager.access(session,request.isSecure());
|
||||
if (cookie!=null ) // Handle changed ID or max-age refresh
|
||||
response.addCookie(cookie);
|
||||
base_request.getResponse().addCookie(cookie);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -214,7 +215,7 @@ public class SessionHandler extends HandlerWrapper
|
|||
{
|
||||
Request base_request = (request instanceof Request) ? (Request)request:HttpConnection.getCurrentConnection().getRequest();
|
||||
String requested_session_id=request.getRequestedSessionId();
|
||||
if (!DispatcherType.REQUEST.equals(request.getDispatcherType()) || requested_session_id!=null)
|
||||
if (!DispatcherType.REQUEST.equals(base_request.getDispatcherType()) || requested_session_id!=null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ public class AsyncContextTest extends TestCase
|
|||
{
|
||||
final Request base_request = (request instanceof Request)?((Request)request):HttpConnection.getCurrentConnection().getRequest();
|
||||
|
||||
if (DispatcherType.REQUEST.equals(request.getDispatcherType()))
|
||||
if (DispatcherType.REQUEST.equals(base_request.getDispatcherType()))
|
||||
{
|
||||
if (_read>0)
|
||||
{
|
||||
|
@ -207,9 +207,9 @@ public class AsyncContextTest extends TestCase
|
|||
}
|
||||
|
||||
if (_suspendFor>0)
|
||||
request.setAsyncTimeout(_suspendFor);
|
||||
request.addAsyncListener(__asyncListener);
|
||||
final AsyncContext asyncContext = request.startAsync();
|
||||
base_request.setAsyncTimeout(_suspendFor);
|
||||
base_request.addAsyncListener(__asyncListener);
|
||||
final AsyncContext asyncContext = base_request.startAsync();
|
||||
|
||||
if (_completeAfter>0)
|
||||
{
|
||||
|
@ -287,7 +287,7 @@ public class AsyncContextTest extends TestCase
|
|||
public void onTimeout(AsyncEvent event) throws IOException
|
||||
{
|
||||
event.getRequest().setAttribute("TIMEOUT",Boolean.TRUE);
|
||||
event.getRequest().getAsyncContext().dispatch();
|
||||
((Request)event.getRequest()).getAsyncContext().dispatch();
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -208,7 +208,7 @@ public class StatisticsHandlerTest extends TestCase
|
|||
|
||||
public void handle(String target, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (!request.isAsyncStarted())
|
||||
if (!((Request)request).isAsyncStarted())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -241,10 +241,10 @@ public class StatisticsHandlerTest extends TestCase
|
|||
|
||||
public void handle(String target, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (!request.isAsyncStarted())
|
||||
if (!((Request)request).isAsyncStarted())
|
||||
{
|
||||
request.setAsyncTimeout(_suspendFor);
|
||||
request.startAsync();
|
||||
((Request)request).setAsyncTimeout(_suspendFor);
|
||||
((Request)request).startAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,10 +254,10 @@ public class StatisticsHandlerTest extends TestCase
|
|||
{
|
||||
public void handle(String target, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (!request.isAsyncStarted())
|
||||
if (!((Request)request).isAsyncStarted())
|
||||
{
|
||||
request.setAsyncTimeout(100000);
|
||||
request.startAsync().dispatch();
|
||||
((Request)request).setAsyncTimeout(100000);
|
||||
((Request)request).startAsync().dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ public class StatisticsHandlerTest extends TestCase
|
|||
|
||||
public void handle(String target, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
|
||||
{
|
||||
if (!request.isAsyncStarted())
|
||||
if (!((Request)request).isAsyncStarted())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -309,8 +309,8 @@ public class StatisticsHandlerTest extends TestCase
|
|||
|
||||
if (i < _suspendFor.length)
|
||||
{
|
||||
request.setAsyncTimeout(_suspendFor[i]);
|
||||
request.startAsync();
|
||||
((Request)request).setAsyncTimeout(_suspendFor[i]);
|
||||
((Request)request).startAsync();
|
||||
request.setAttribute("i",i + 1);
|
||||
return;
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ public class StatisticsHandlerTest extends TestCase
|
|||
{
|
||||
final Request base_request=(request instanceof Request)?((Request)request):HttpConnection.getCurrentConnection().getRequest();
|
||||
|
||||
if(!request.isAsyncStarted())
|
||||
if(!base_request.isAsyncStarted())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -355,8 +355,9 @@ public class StatisticsHandlerTest extends TestCase
|
|||
{
|
||||
}
|
||||
|
||||
request.setAsyncTimeout(_completeDuration*10);
|
||||
request.startAsync();
|
||||
base_request.setAsyncTimeout(_completeDuration*10);
|
||||
|
||||
base_request.startAsync();
|
||||
|
||||
(new Thread() {
|
||||
public void run()
|
||||
|
@ -364,7 +365,7 @@ public class StatisticsHandlerTest extends TestCase
|
|||
try
|
||||
{
|
||||
Thread.sleep(_completeDuration);
|
||||
request.getAsyncContext().complete();
|
||||
base_request.getAsyncContext().complete();
|
||||
|
||||
synchronized(_lock)
|
||||
{
|
||||
|
|
|
@ -300,11 +300,11 @@ public class DefaultServlet extends HttpServlet implements ResourceFactory
|
|||
String servletPath=null;
|
||||
String pathInfo=null;
|
||||
Enumeration reqRanges = null;
|
||||
Boolean included =request.getAttribute(Dispatcher.__INCLUDE_REQUEST_URI)!=null;
|
||||
Boolean included =request.getAttribute(Dispatcher.INCLUDE_REQUEST_URI)!=null;
|
||||
if (included!=null && included.booleanValue())
|
||||
{
|
||||
servletPath=(String)request.getAttribute(Dispatcher.__INCLUDE_SERVLET_PATH);
|
||||
pathInfo=(String)request.getAttribute(Dispatcher.__INCLUDE_PATH_INFO);
|
||||
servletPath=(String)request.getAttribute(Dispatcher.INCLUDE_SERVLET_PATH);
|
||||
pathInfo=(String)request.getAttribute(Dispatcher.INCLUDE_PATH_INFO);
|
||||
if (servletPath==null)
|
||||
{
|
||||
servletPath=request.getServletPath();
|
||||
|
|
|
@ -107,12 +107,12 @@ public class Invoker extends HttpServlet
|
|||
{
|
||||
// Get the requested path and info
|
||||
boolean included=false;
|
||||
String servlet_path=(String)request.getAttribute(Dispatcher.__INCLUDE_SERVLET_PATH);
|
||||
String servlet_path=(String)request.getAttribute(Dispatcher.INCLUDE_SERVLET_PATH);
|
||||
if (servlet_path==null)
|
||||
servlet_path=request.getServletPath();
|
||||
else
|
||||
included=true;
|
||||
String path_info = (String)request.getAttribute(Dispatcher.__INCLUDE_PATH_INFO);
|
||||
String path_info = (String)request.getAttribute(Dispatcher.INCLUDE_PATH_INFO);
|
||||
if (path_info==null)
|
||||
path_info=request.getPathInfo();
|
||||
|
||||
|
@ -273,11 +273,11 @@ public class Invoker extends HttpServlet
|
|||
{
|
||||
if (_included)
|
||||
{
|
||||
if (name.equals(Dispatcher.__INCLUDE_REQUEST_URI))
|
||||
if (name.equals(Dispatcher.INCLUDE_REQUEST_URI))
|
||||
return URIUtil.addPaths(URIUtil.addPaths(getContextPath(),_servletPath),_pathInfo);
|
||||
if (name.equals(Dispatcher.__INCLUDE_PATH_INFO))
|
||||
if (name.equals(Dispatcher.INCLUDE_PATH_INFO))
|
||||
return _pathInfo;
|
||||
if (name.equals(Dispatcher.__INCLUDE_SERVLET_PATH))
|
||||
if (name.equals(Dispatcher.INCLUDE_SERVLET_PATH))
|
||||
return _servletPath;
|
||||
}
|
||||
return super.getAttribute(name);
|
||||
|
|
|
@ -338,8 +338,8 @@ public class ServletHandler extends AbstractHandler
|
|||
|
||||
if (DispatcherType.INCLUDE.equals(type))
|
||||
{
|
||||
base_request.setAttribute(Dispatcher.__INCLUDE_SERVLET_PATH,servlet_path);
|
||||
base_request.setAttribute(Dispatcher.__INCLUDE_PATH_INFO, path_info);
|
||||
base_request.setAttribute(Dispatcher.INCLUDE_SERVLET_PATH,servlet_path);
|
||||
base_request.setAttribute(Dispatcher.INCLUDE_PATH_INFO, path_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -153,16 +153,16 @@ public class DispatcherTest extends TestCase
|
|||
{
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
assertEquals( "/context/ForwardServlet", request.getAttribute(Dispatcher.__FORWARD_REQUEST_URI));
|
||||
assertEquals( "/context", request.getAttribute(Dispatcher.__FORWARD_CONTEXT_PATH) );
|
||||
assertEquals( "/ForwardServlet", request.getAttribute(Dispatcher.__FORWARD_SERVLET_PATH));
|
||||
assertEquals( null, request.getAttribute(Dispatcher.__FORWARD_PATH_INFO));
|
||||
assertEquals( "do=assertforward&do=more&test=1", request.getAttribute(Dispatcher.__FORWARD_QUERY_STRING) );
|
||||
assertEquals( "/context/ForwardServlet", request.getAttribute(Dispatcher.FORWARD_REQUEST_URI));
|
||||
assertEquals( "/context", request.getAttribute(Dispatcher.FORWARD_CONTEXT_PATH) );
|
||||
assertEquals( "/ForwardServlet", request.getAttribute(Dispatcher.FORWARD_SERVLET_PATH));
|
||||
assertEquals( null, request.getAttribute(Dispatcher.FORWARD_PATH_INFO));
|
||||
assertEquals( "do=assertforward&do=more&test=1", request.getAttribute(Dispatcher.FORWARD_QUERY_STRING) );
|
||||
|
||||
|
||||
List expectedAttributeNames = Arrays.asList(new String[] {
|
||||
Dispatcher.__FORWARD_REQUEST_URI, Dispatcher.__FORWARD_CONTEXT_PATH,
|
||||
Dispatcher.__FORWARD_SERVLET_PATH, Dispatcher.__FORWARD_QUERY_STRING
|
||||
Dispatcher.FORWARD_REQUEST_URI, Dispatcher.FORWARD_CONTEXT_PATH,
|
||||
Dispatcher.FORWARD_SERVLET_PATH, Dispatcher.FORWARD_QUERY_STRING
|
||||
});
|
||||
List requestAttributeNames = Collections.list(request.getAttributeNames());
|
||||
assertTrue(requestAttributeNames.containsAll(expectedAttributeNames));
|
||||
|
@ -185,15 +185,15 @@ public class DispatcherTest extends TestCase
|
|||
{
|
||||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
assertEquals( "/context/AssertIncludeServlet", request.getAttribute(Dispatcher.__INCLUDE_REQUEST_URI));
|
||||
assertEquals( "/context", request.getAttribute(Dispatcher.__INCLUDE_CONTEXT_PATH) );
|
||||
assertEquals( "/AssertIncludeServlet", request.getAttribute(Dispatcher.__INCLUDE_SERVLET_PATH));
|
||||
assertEquals( null, request.getAttribute(Dispatcher.__INCLUDE_PATH_INFO));
|
||||
assertEquals( "do=end&do=the", request.getAttribute(Dispatcher.__INCLUDE_QUERY_STRING));
|
||||
assertEquals( "/context/AssertIncludeServlet", request.getAttribute(Dispatcher.INCLUDE_REQUEST_URI));
|
||||
assertEquals( "/context", request.getAttribute(Dispatcher.INCLUDE_CONTEXT_PATH) );
|
||||
assertEquals( "/AssertIncludeServlet", request.getAttribute(Dispatcher.INCLUDE_SERVLET_PATH));
|
||||
assertEquals( null, request.getAttribute(Dispatcher.INCLUDE_PATH_INFO));
|
||||
assertEquals( "do=end&do=the", request.getAttribute(Dispatcher.INCLUDE_QUERY_STRING));
|
||||
|
||||
List expectedAttributeNames = Arrays.asList(new String[] {
|
||||
Dispatcher.__INCLUDE_REQUEST_URI, Dispatcher.__INCLUDE_CONTEXT_PATH,
|
||||
Dispatcher.__INCLUDE_SERVLET_PATH, Dispatcher.__INCLUDE_QUERY_STRING
|
||||
Dispatcher.INCLUDE_REQUEST_URI, Dispatcher.INCLUDE_CONTEXT_PATH,
|
||||
Dispatcher.INCLUDE_SERVLET_PATH, Dispatcher.INCLUDE_QUERY_STRING
|
||||
});
|
||||
List requestAttributeNames = Collections.list(request.getAttributeNames());
|
||||
assertTrue(requestAttributeNames.containsAll(expectedAttributeNames));
|
||||
|
@ -219,24 +219,24 @@ public class DispatcherTest extends TestCase
|
|||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
// include doesn't hide forward
|
||||
assertEquals( "/context/ForwardServlet/forwardpath", request.getAttribute(Dispatcher.__FORWARD_REQUEST_URI));
|
||||
assertEquals( "/context", request.getAttribute(Dispatcher.__FORWARD_CONTEXT_PATH) );
|
||||
assertEquals( "/ForwardServlet", request.getAttribute(Dispatcher.__FORWARD_SERVLET_PATH));
|
||||
assertEquals( "/forwardpath", request.getAttribute(Dispatcher.__FORWARD_PATH_INFO));
|
||||
assertEquals( "do=include", request.getAttribute(Dispatcher.__FORWARD_QUERY_STRING) );
|
||||
assertEquals( "/context/ForwardServlet/forwardpath", request.getAttribute(Dispatcher.FORWARD_REQUEST_URI));
|
||||
assertEquals( "/context", request.getAttribute(Dispatcher.FORWARD_CONTEXT_PATH) );
|
||||
assertEquals( "/ForwardServlet", request.getAttribute(Dispatcher.FORWARD_SERVLET_PATH));
|
||||
assertEquals( "/forwardpath", request.getAttribute(Dispatcher.FORWARD_PATH_INFO));
|
||||
assertEquals( "do=include", request.getAttribute(Dispatcher.FORWARD_QUERY_STRING) );
|
||||
|
||||
assertEquals( "/context/AssertForwardIncludeServlet/assertpath", request.getAttribute(Dispatcher.__INCLUDE_REQUEST_URI));
|
||||
assertEquals( "/context", request.getAttribute(Dispatcher.__INCLUDE_CONTEXT_PATH) );
|
||||
assertEquals( "/AssertForwardIncludeServlet", request.getAttribute(Dispatcher.__INCLUDE_SERVLET_PATH));
|
||||
assertEquals( "/assertpath", request.getAttribute(Dispatcher.__INCLUDE_PATH_INFO));
|
||||
assertEquals( "do=end", request.getAttribute(Dispatcher.__INCLUDE_QUERY_STRING));
|
||||
assertEquals( "/context/AssertForwardIncludeServlet/assertpath", request.getAttribute(Dispatcher.INCLUDE_REQUEST_URI));
|
||||
assertEquals( "/context", request.getAttribute(Dispatcher.INCLUDE_CONTEXT_PATH) );
|
||||
assertEquals( "/AssertForwardIncludeServlet", request.getAttribute(Dispatcher.INCLUDE_SERVLET_PATH));
|
||||
assertEquals( "/assertpath", request.getAttribute(Dispatcher.INCLUDE_PATH_INFO));
|
||||
assertEquals( "do=end", request.getAttribute(Dispatcher.INCLUDE_QUERY_STRING));
|
||||
|
||||
|
||||
List expectedAttributeNames = Arrays.asList(new String[] {
|
||||
Dispatcher.__FORWARD_REQUEST_URI, Dispatcher.__FORWARD_CONTEXT_PATH, Dispatcher.__FORWARD_SERVLET_PATH,
|
||||
Dispatcher.__FORWARD_PATH_INFO, Dispatcher.__FORWARD_QUERY_STRING,
|
||||
Dispatcher.__INCLUDE_REQUEST_URI, Dispatcher.__INCLUDE_CONTEXT_PATH, Dispatcher.__INCLUDE_SERVLET_PATH,
|
||||
Dispatcher.__INCLUDE_PATH_INFO, Dispatcher.__INCLUDE_QUERY_STRING
|
||||
Dispatcher.FORWARD_REQUEST_URI, Dispatcher.FORWARD_CONTEXT_PATH, Dispatcher.FORWARD_SERVLET_PATH,
|
||||
Dispatcher.FORWARD_PATH_INFO, Dispatcher.FORWARD_QUERY_STRING,
|
||||
Dispatcher.INCLUDE_REQUEST_URI, Dispatcher.INCLUDE_CONTEXT_PATH, Dispatcher.INCLUDE_SERVLET_PATH,
|
||||
Dispatcher.INCLUDE_PATH_INFO, Dispatcher.INCLUDE_QUERY_STRING
|
||||
});
|
||||
List requestAttributeNames = Collections.list(request.getAttributeNames());
|
||||
assertTrue(requestAttributeNames.containsAll(expectedAttributeNames));
|
||||
|
@ -259,22 +259,22 @@ public class DispatcherTest extends TestCase
|
|||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
|
||||
{
|
||||
// forward hides include
|
||||
assertEquals( null, request.getAttribute(Dispatcher.__INCLUDE_REQUEST_URI));
|
||||
assertEquals( null, request.getAttribute(Dispatcher.__INCLUDE_CONTEXT_PATH) );
|
||||
assertEquals( null, request.getAttribute(Dispatcher.__INCLUDE_SERVLET_PATH));
|
||||
assertEquals( null, request.getAttribute(Dispatcher.__INCLUDE_PATH_INFO));
|
||||
assertEquals( null, request.getAttribute(Dispatcher.__INCLUDE_QUERY_STRING));
|
||||
assertEquals( null, request.getAttribute(Dispatcher.INCLUDE_REQUEST_URI));
|
||||
assertEquals( null, request.getAttribute(Dispatcher.INCLUDE_CONTEXT_PATH) );
|
||||
assertEquals( null, request.getAttribute(Dispatcher.INCLUDE_SERVLET_PATH));
|
||||
assertEquals( null, request.getAttribute(Dispatcher.INCLUDE_PATH_INFO));
|
||||
assertEquals( null, request.getAttribute(Dispatcher.INCLUDE_QUERY_STRING));
|
||||
|
||||
assertEquals( "/context/IncludeServlet/includepath", request.getAttribute(Dispatcher.__FORWARD_REQUEST_URI));
|
||||
assertEquals( "/context", request.getAttribute(Dispatcher.__FORWARD_CONTEXT_PATH) );
|
||||
assertEquals( "/IncludeServlet", request.getAttribute(Dispatcher.__FORWARD_SERVLET_PATH));
|
||||
assertEquals( "/includepath", request.getAttribute(Dispatcher.__FORWARD_PATH_INFO));
|
||||
assertEquals( "do=forward", request.getAttribute(Dispatcher.__FORWARD_QUERY_STRING) );
|
||||
assertEquals( "/context/IncludeServlet/includepath", request.getAttribute(Dispatcher.FORWARD_REQUEST_URI));
|
||||
assertEquals( "/context", request.getAttribute(Dispatcher.FORWARD_CONTEXT_PATH) );
|
||||
assertEquals( "/IncludeServlet", request.getAttribute(Dispatcher.FORWARD_SERVLET_PATH));
|
||||
assertEquals( "/includepath", request.getAttribute(Dispatcher.FORWARD_PATH_INFO));
|
||||
assertEquals( "do=forward", request.getAttribute(Dispatcher.FORWARD_QUERY_STRING) );
|
||||
|
||||
|
||||
List expectedAttributeNames = Arrays.asList(new String[] {
|
||||
Dispatcher.__FORWARD_REQUEST_URI, Dispatcher.__FORWARD_CONTEXT_PATH, Dispatcher.__FORWARD_SERVLET_PATH,
|
||||
Dispatcher.__FORWARD_PATH_INFO, Dispatcher.__FORWARD_QUERY_STRING,
|
||||
Dispatcher.FORWARD_REQUEST_URI, Dispatcher.FORWARD_CONTEXT_PATH, Dispatcher.FORWARD_SERVLET_PATH,
|
||||
Dispatcher.FORWARD_PATH_INFO, Dispatcher.FORWARD_QUERY_STRING,
|
||||
});
|
||||
List requestAttributeNames = Collections.list(request.getAttributeNames());
|
||||
assertTrue(requestAttributeNames.containsAll(expectedAttributeNames));
|
||||
|
|
Loading…
Reference in New Issue