Methods Summary |
---|
public void | addCookie(javax.servlet.http.Cookie cookie)Add a Cookie to the set of Cookies associated with this Request.
// For compatibility only
if (!cookiesParsed)
parseCookies();
cookies.add(cookie);
|
public void | addHeader(java.lang.String name, java.lang.String value)Add a Header to the set of Headers associated with this Request.
// Not used
|
public void | addLocale(java.util.Locale locale)Add a Locale to the set of preferred Locales for this Request. The
first added Locale will be the first one returned by getLocales().
locales.add(locale);
|
public void | addParameter(java.lang.String name, java.lang.String[] values)Add a parameter name and corresponding set of values to this Request.
(This is used when restoring the original request on a form based
login).
coyoteRequest.getParameters().addParameterValues(name, values);
|
public void | clearCookies()Clear the collection of Cookies associated with this Request.
cookiesParsed = true;
cookies.clear();
|
public void | clearHeaders()Clear the collection of Headers associated with this Request.
// Not used
|
public void | clearLocales()Clear the collection of Locales associated with this Request.
locales.clear();
|
public void | clearParameters()Clear the collection of parameters associated with this Request.
// Not used
|
protected void | configureSessionCookie(javax.servlet.http.Cookie cookie)Configures the given JSESSIONID cookie.
cookie.setMaxAge(-1);
String contextPath = null;
// START GlassFish 1024
if (isDefaultContext) {
cookie.setPath("/");
} else {
// END GlassFish 1024
if (getContext() != null) {
// START OF SJSAS 6231069
// contextPath = getContext().getEncodedPath();
contextPath = getContext().getPath();
// END OF SJSAS 6231069
}
if ((contextPath != null) && (contextPath.length() > 0)) {
cookie.setPath(contextPath);
} else {
cookie.setPath("/");
}
// START GlassFish 1024
}
// END GlassFish 1024
if (isSecure()) {
cookie.setSecure(true);
}
|
protected void | convertURI(org.apache.tomcat.util.buf.MessageBytes uri)Character conversion of the URI.
ByteChunk bc = uri.getByteChunk();
CharChunk cc = uri.getCharChunk();
int length = bc.getLength();
cc.allocate(length, -1);
String enc = connector.getURIEncoding();
if (enc != null) {
B2CConverter conv = getURIConverter();
try {
if (conv == null) {
conv = new B2CConverter(enc);
setURIConverter(conv);
} else {
conv.recycle();
}
} catch (IOException e) {
// Ignore
log.error("Invalid URI encoding; using HTTP default");
connector.setURIEncoding(null);
}
if (conv != null) {
try {
conv.convert(bc, cc);
uri.setChars(cc.getBuffer(), cc.getStart(),
cc.getLength());
return;
} catch (IOException e) {
log.error("Invalid URI character encoding; trying ascii");
cc.recycle();
}
}
}
// Default encoding: fast conversion
byte[] bbuf = bc.getBuffer();
char[] cbuf = cc.getBuffer();
int start = bc.getStart();
for (int i = 0; i < length; i++) {
cbuf[i] = (char) (bbuf[i + start] & 0xff);
}
uri.setChars(cbuf, 0, length);
|
public javax.servlet.ServletInputStream | createInputStream()Create and return a ServletInputStream to read the content
associated with this Request.
if (inputStream == null) {
inputStream = new CoyoteInputStream(inputBuffer);
}
return inputStream;
|
public int | decrementDispatchDepth()Decrement the depth of application dispatch
return --dispatchDepth;
|
protected org.apache.catalina.Session | doGetSession(boolean create)
// There cannot be a session if no context has been assigned yet
if (context == null)
return (null);
// Return the current session if it exists and is valid
if ((session != null) && !session.isValid()) {
session = null;
requestedSessionVersion = null;
}
if (session != null)
return (session);
// Return the requested session if it exists and is valid
Manager manager = null;
if (context != null)
manager = context.getManager();
if (manager == null)
return (null); // Sessions are not supported
if (requestedSessionId != null) {
if (!checkUnsuccessfulSessionFind || !unsuccessfulSessionFind) {
try {
if (manager.isSessionVersioningSupported()) {
session = manager.findSession(requestedSessionId,
requestedSessionVersion);
incrementSessionVersion((StandardSession) session,
context);
} else {
session = manager.findSession(requestedSessionId);
}
if(session == null) {
unsuccessfulSessionFind = true;
}
} catch (IOException e) {
session = null;
}
}
if ((session != null) && !session.isValid())
session = null;
if (session != null) {
session.access();
return (session);
}
}
// Create a new session if requested and the response is not committed
if (!create)
return (null);
if ((context != null) && (response != null) &&
context.getCookies() &&
response.getResponse().isCommitted()) {
throw new IllegalStateException
(sm.getString("coyoteRequest.sessionCreateCommitted"));
}
// START S1AS8PE 4817642
if (requestedSessionId != null && context.getReuseSessionID()) {
session = manager.createSession(requestedSessionId);
if (manager instanceof PersistentManagerBase) {
((PersistentManagerBase) manager).
removeFromInvalidatedSessions(requestedSessionId);
}
// END S1AS8PE 4817642
// START GlassFish 896
} else if (sessionTracker.getActiveSessions() > 0) {
synchronized (sessionTracker) {
if (sessionTracker.getActiveSessions() > 0) {
String id = sessionTracker.getSessionId();
session = manager.createSession(id);
if (manager instanceof PersistentManagerBase) {
((PersistentManagerBase) manager).
removeFromInvalidatedSessions(id);
}
}
}
// END GlassFish 896
// START S1AS8PE 4817642
} else {
// END S1AS8PE 4817642
session = manager.createSession();
// START S1AS8PE 4817642
}
// END S1AS8PE 4817642
StandardHost reqHost = (StandardHost) getHost();
if (reqHost != null) {
SingleSignOn sso = reqHost.getSingleSignOn();
if (sso != null) {
String ssoId = (String) getNote(
org.apache.catalina.authenticator.Constants.REQ_SSOID_NOTE);
if (ssoId != null) {
sso.associate(ssoId, session);
removeNote(
org.apache.catalina.authenticator.Constants.REQ_SSOID_NOTE);
}
}
}
// START GlassFish 896
sessionTracker.track(session);
// END GlassFish 896
// Creating a new session cookie based on the newly created session
if ((session != null) && (getContext() != null)
&& getContext().getCookies()) {
Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,
session.getIdInternal());
configureSessionCookie(cookie);
((HttpServletResponse) response).addCookie(cookie);
if (manager.isSessionVersioningSupported()) {
incrementSessionVersion((StandardSession) session, context);
}
}
if (session != null) {
session.access();
return (session);
} else {
return (null);
}
|
public void | finishRequest()Perform whatever actions are required to flush and close the input
stream or reader, in a single operation.
// The reader and input stream don't need to be closed
|
public java.lang.Object | getAttribute(java.lang.String name)Return the specified request attribute if it exists; otherwise, return
null .
if (name.equals(Globals.DISPATCHER_TYPE_ATTR)) {
return (dispatcherType == null)
? ApplicationFilterFactory.REQUEST_INTEGER
: dispatcherType;
} else if (name.equals(Globals.DISPATCHER_REQUEST_PATH_ATTR)) {
return (requestDispatcherPath == null)
? getRequestPathMB().toString()
: requestDispatcherPath.toString();
} else if (name.equals(Globals.CONSTRAINT_URI)) {
return (getRequestPathMB() != null)
? getRequestPathMB().toString() : null;
}
Object attr=attributes.get(name);
if(attr!=null)
return(attr);
attr = coyoteRequest.getAttribute(name);
if(attr != null)
return attr;
// XXX Should move to Globals
if(Constants.SSL_CERTIFICATE_ATTR.equals(name)) {
coyoteRequest.action(ActionCode.ACTION_REQ_SSL_CERTIFICATE, null);
attr = getAttribute(Globals.CERTIFICATES_ATTR);
if(attr != null)
attributes.put(name, attr);
} else if( isSSLAttribute(name) ) {
/* SJSAS 6419950
coyoteRequest.action(ActionCode.ACTION_REQ_SSL_ATTRIBUTE,
coyoteRequest);
attr = coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
if( attr != null) {
attributes.put(Globals.CERTIFICATES_ATTR, attr);
}
attr = coyoteRequest.getAttribute(Globals.CIPHER_SUITE_ATTR);
if(attr != null) {
attributes.put(Globals.CIPHER_SUITE_ATTR, attr);
}
attr = coyoteRequest.getAttribute(Globals.KEY_SIZE_ATTR);
if(attr != null) {
attributes.put(Globals.KEY_SIZE_ATTR, attr);
}
*/
// START SJSAS 6419950
populateSSLAttributes();
// END SJSAS 6419950
attr = attributes.get(name);
}
return attr;
|
public java.util.Enumeration | getAttributeNames()Return the names of all request attributes for this Request, or an
empty Enumeration if there are none.
if (isSecure()) {
populateSSLAttributes();
}
return new Enumerator(attributes.keySet(), true);
|
public java.lang.String | getAuthType()Return the authentication type used for this Request.
return (authType);
|
public java.lang.String | getAuthorization()Return the authorization credentials sent with this request.
return (coyoteRequest.getHeader(Constants.AUTHORIZATION_HEADER));
|
public java.lang.String | getCharacterEncoding()Return the character encoding for this Request.
return (coyoteRequest.getCharacterEncoding());
|
public boolean | getCheckRestrictedResources()Return whether or not access to resources under WEB-INF or META-INF
needs to be checked.
return this.checkRestrictedResources;
|
public org.apache.catalina.Connector | getConnector()Return the Connector through which this Request was received.
return (this.connector);
|
public int | getContentLength()Return the content length for this Request.
return (coyoteRequest.getContentLength());
|
public java.lang.String | getContentType()Return the content type for this Request.
return (coyoteRequest.getContentType());
|
public org.apache.catalina.Context | getContext()Return the Context within which this Request is being processed.
return (this.context);
|
public java.lang.String | getContextPath()Return the portion of the request URI used to select the Context
of the Request.
return (mappingData.contextPath.toString());
|
public org.apache.tomcat.util.buf.MessageBytes | getContextPathMB()Get the context path.
return (mappingData.contextPath);
|
public javax.servlet.http.Cookie[] | getCookies()Return the set of Cookies received with this Request.
if (!cookiesParsed)
parseCookies();
if (cookies.size() == 0) {
return null;
}
return (cookies.toArray(new Cookie[cookies.size()]));
|
public org.apache.coyote.Request | getCoyoteRequest()Get the Coyote request.
return (this.coyoteRequest);
|
public long | getDateHeader(java.lang.String name)Return the value of the specified date header, if any; otherwise
return -1.
String value = getHeader(name);
if (value == null)
return (-1L);
// Attempt to convert the date header in a variety of formats
long result = FastHttpDateFormat.parseDate(value, formats);
if (result != (-1L)) {
return result;
}
throw new IllegalArgumentException(value);
|
public java.lang.String | getDecodedRequestURI()Get the decoded request URI.
return (coyoteRequest.decodedURI().toString());
|
public org.apache.tomcat.util.buf.MessageBytes | getDecodedRequestURIMB()Get the decoded request URI.
return (coyoteRequest.decodedURI());
|
public javax.servlet.FilterChain | getFilterChain()Get filter chain associated with the request.
return (this.filterChain);
|
public java.lang.String | getHeader(java.lang.String name)Return the first value of the specified header, if any; otherwise,
return null
return coyoteRequest.getHeader(name);
|
public java.util.Enumeration | getHeaderNames()Return the names of all headers received with this request.
return coyoteRequest.getMimeHeaders().names();
|
public java.util.Enumeration | getHeaders(java.lang.String name)Return all of the values of the specified header, if any; otherwise,
return an empty enumeration.
return coyoteRequest.getMimeHeaders().values(name);
|
public org.apache.catalina.Host | getHost()Return the Host within which this Request is being processed.
return (Host) mappingData.host;
|
public java.lang.String | getInfo()Return descriptive information about this Request implementation and
the corresponding version number, in the format
<description>/<version> .
return (info);
|
public javax.servlet.ServletInputStream | getInputStream()Return the servlet input stream for this Request. The default
implementation returns a servlet input stream created by
createInputStream() .
if (usingReader)
throw new IllegalStateException
(sm.getString("coyoteRequest.getInputStream.ise"));
usingInputStream = true;
if (inputStream == null) {
inputStream = new CoyoteInputStream(inputBuffer);
}
return inputStream;
|
public int | getIntHeader(java.lang.String name)Return the value of the specified header as an integer, or -1 if there
is no such header for this request.
String value = getHeader(name);
if (value == null) {
return (-1);
} else {
return (Integer.parseInt(value));
}
|
public java.lang.String | getJrouteId()Gets the jroute id of this request, which may have been
sent as a separate JROUTE cookie or appended to the
session identifier encoded in the URI (if cookies have been disabled).
return jrouteId;
|
public java.lang.String | getLocalAddr()Returns the Internet Protocol (IP) address of the interface on
which the request was received.
if (localAddr == null) {
if (socket != null) {
InetAddress inet = socket.getLocalAddress();
localAddr = inet.getHostAddress();
} else {
coyoteRequest.action
(ActionCode.ACTION_REQ_LOCAL_ADDR_ATTRIBUTE, coyoteRequest);
localAddr = coyoteRequest.localAddr().toString();
}
}
return localAddr;
|
public java.lang.String | getLocalName()Returns the host name of the Internet Protocol (IP) interface on
which the request was received.
if (localName == null) {
if (socket != null) {
InetAddress inet = socket.getLocalAddress();
localName = inet.getHostName();
} else {
coyoteRequest.action
(ActionCode.ACTION_REQ_LOCAL_NAME_ATTRIBUTE, coyoteRequest);
localName = coyoteRequest.localName().toString();
}
}
return localName;
|
public int | getLocalPort()Returns the Internet Protocol (IP) port number of the interface
on which the request was received.
if (localPort == -1){
if (socket != null) {
localPort = socket.getLocalPort();
} else {
coyoteRequest.action
(ActionCode.ACTION_REQ_LOCALPORT_ATTRIBUTE, coyoteRequest);
localPort = coyoteRequest.getLocalPort();
}
}
return localPort;
|
public java.util.Locale | getLocale()Return the preferred Locale that the client will accept content in,
based on the value for the first Accept-Language header
that was encountered. If the request did not specify a preferred
language, the server's default Locale is returned.
if (!localesParsed)
parseLocales();
if (locales.size() > 0) {
return ((Locale) locales.get(0));
} else {
return (defaultLocale);
}
|
public java.util.Enumeration | getLocales()Return the set of preferred Locales that the client will accept
content in, based on the values for any Accept-Language
headers that were encountered. If the request did not specify a
preferred language, the server's default Locale is returned.
if (!localesParsed)
parseLocales();
if (locales.size() > 0)
return (new Enumerator(locales));
ArrayList results = new ArrayList();
results.add(defaultLocale);
return (new Enumerator(results));
|
public org.apache.tomcat.util.http.mapper.MappingData | getMappingData()Return mapping data.
return (mappingData);
|
public static int | getMaxDispatchDepth()
return maxDispatchDepth;
|
public java.lang.String | getMethod()Return the HTTP request method used in this Request.
return coyoteRequest.method().toString();
|
public java.lang.Object | getNote(java.lang.String name)Return the object bound with the specified name to the internal notes
for this request, or null if no such binding exists.
return (notes.get(name));
|
public java.util.Iterator | getNoteNames()Return an Iterator containing the String names of all notes bindings
that exist for this request.
return (notes.keySet().iterator());
|
public java.lang.String | getParameter(java.lang.String name)Return the value of the specified request parameter, if any; otherwise,
return null . If there is more than one value defined,
return only the first one.
if (!requestParametersParsed)
parseRequestParameters();
return coyoteRequest.getParameters().getParameter(name);
|
public java.util.Map | getParameterMap()Returns a Map of the parameters of this request.
Request parameters are extra information sent with the request.
For HTTP servlets, parameters are contained in the query string
or posted form data.
if (parameterMap.isLocked())
return parameterMap;
Enumeration e = getParameterNames();
while (e.hasMoreElements()) {
String name = e.nextElement().toString();
String[] values = getParameterValues(name);
parameterMap.put(name, values);
}
parameterMap.setLocked(true);
return parameterMap;
|
public java.util.Enumeration | getParameterNames()Return the names of all defined request parameters for this request.
if (!requestParametersParsed)
parseRequestParameters();
return coyoteRequest.getParameters().getParameterNames();
|
public java.lang.String[] | getParameterValues(java.lang.String name)Return the defined values for the specified request parameter, if any;
otherwise, return null .
if (!requestParametersParsed)
parseRequestParameters();
return coyoteRequest.getParameters().getParameterValues(name);
|
public java.lang.String | getPathInfo()Return the path information associated with this Request.
return (mappingData.pathInfo.toString());
|
public org.apache.tomcat.util.buf.MessageBytes | getPathInfoMB()Get the path info.
return (mappingData.pathInfo);
|
public java.lang.String | getPathTranslated()Return the extra path information for this request, translated
to a real path.
if (context == null)
return (null);
if (getPathInfo() == null) {
return (null);
} else {
return (context.getServletContext().getRealPath(getPathInfo()));
}
|
protected byte[] | getPostBody()Gets the POST body of this request.
int len = getContentLength();
byte[] formData = null;
if (len < CACHED_POST_LEN) {
if (postData == null)
postData = new byte[CACHED_POST_LEN];
formData = postData;
} else {
formData = new byte[len];
}
int actualLen = readPostBody(formData, len);
if (actualLen == len) {
return formData;
}
return null;
|
public java.lang.String | getProtocol()Return the protocol and version used to make this Request.
return coyoteRequest.protocol().toString();
|
public java.lang.String | getQueryString()Return the query string associated with this request.
String queryString = coyoteRequest.queryString().toString();
if (queryString == null || queryString.equals("")) {
return (null);
} else {
return queryString;
}
|
public java.io.BufferedReader | getReader()Read the Reader wrapping the input stream for this Request. The
default implementation wraps a BufferedReader around the
servlet input stream returned by createInputStream() .
if (usingInputStream)
throw new IllegalStateException
(sm.getString("coyoteRequest.getReader.ise"));
usingReader = true;
inputBuffer.checkConverter();
if (reader == null) {
reader = new CoyoteReader(inputBuffer);
}
return reader;
|
public java.lang.String | getRealPath(java.lang.String path)Return the real path of the specified virtual path.
if (context == null)
return (null);
ServletContext servletContext = context.getServletContext();
if (servletContext == null)
return (null);
else {
try {
return (servletContext.getRealPath(path));
} catch (IllegalArgumentException e) {
return (null);
}
}
|
public java.lang.String | getRemoteAddr()Return the remote IP address making this Request.
if (remoteAddr == null) {
// START SJSAS 6347215
if (connector.getAuthPassthroughEnabled()
&& connector.getProxyHandler() != null) {
remoteAddr = connector.getProxyHandler().getRemoteAddress(
getRequest());
if (remoteAddr == null) {
log.warn(sm.getString(
"coyoteRequest.nullRemoteAddressFromProxy"));
}
return remoteAddr;
}
// END SJSAS 6347215
if (socket != null) {
InetAddress inet = socket.getInetAddress();
remoteAddr = inet.getHostAddress();
} else {
coyoteRequest.action
(ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE, coyoteRequest);
remoteAddr = coyoteRequest.remoteAddr().toString();
}
}
return remoteAddr;
|
public java.lang.String | getRemoteHost()Return the remote host name making this Request.
if (remoteHost == null) {
if (!connector.getEnableLookups()) {
remoteHost = getRemoteAddr();
// START SJSAS 6347215
} else if (connector.getAuthPassthroughEnabled()
&& connector.getProxyHandler() != null) {
String addr =
connector.getProxyHandler().getRemoteAddress(getRequest());
if (addr != null) {
try {
remoteHost = InetAddress.getByName(addr).getHostName();
} catch (UnknownHostException e) {
log.warn(sm.getString(
"coyoteRequest.unknownHost",
addr),
e);
}
} else {
log.warn(sm.getString(
"coyoteRequest.nullRemoteAddressFromProxy"));
}
// END SJSAS 6347215
} else if (socket != null) {
InetAddress inet = socket.getInetAddress();
remoteHost = inet.getHostName();
} else {
coyoteRequest.action
(ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest);
remoteHost = coyoteRequest.remoteHost().toString();
}
}
return remoteHost;
|
public int | getRemotePort()Returns the Internet Protocol (IP) source port of the client
or last proxy that sent the request.
if (remotePort == -1) {
if (socket != null) {
remotePort = socket.getPort();
} else {
coyoteRequest.action
(ActionCode.ACTION_REQ_REMOTEPORT_ATTRIBUTE, coyoteRequest);
remotePort = coyoteRequest.getRemotePort();
}
}
return remotePort;
|
public java.lang.String | getRemoteUser()Return the name of the remote user that has been authenticated
for this Request.
if (userPrincipal != null) {
return (userPrincipal.getName());
} else {
return (null);
}
|
public javax.servlet.http.HttpServletRequest | getRequest()Return the ServletRequest for which this object
is the facade. This method must be implemented by a subclass.
if (facade == null) {
facade = new CoyoteRequestFacade(this);
}
return (facade);
|
public javax.servlet.RequestDispatcher | getRequestDispatcher(java.lang.String path)Return a RequestDispatcher that wraps the resource at the specified
path, which may be interpreted as relative to the current request path.
if (context == null)
return (null);
// If the path is already context-relative, just pass it through
if (path == null)
return (null);
else if (path.startsWith("/"))
return (context.getServletContext().getRequestDispatcher(path));
// Convert a request-relative path to a context-relative one
String servletPath = (String) getAttribute(Globals.INCLUDE_SERVLET_PATH_ATTR);
if (servletPath == null)
servletPath = getServletPath();
// Add the path info, if there is any
String pathInfo = getPathInfo();
String requestPath = null;
if (pathInfo == null) {
requestPath = servletPath;
} else {
requestPath = servletPath + pathInfo;
}
int pos = requestPath.lastIndexOf('/");
String relative = null;
if (pos >= 0) {
relative = RequestUtil.normalize
(requestPath.substring(0, pos + 1) + path);
} else {
relative = RequestUtil.normalize(requestPath + path);
}
return (context.getServletContext().getRequestDispatcher(relative));
|
public org.apache.tomcat.util.buf.MessageBytes | getRequestPathMB()Get the request path.
return (mappingData.requestPath);
|
public java.lang.String | getRequestURI()Return the request URI for this request.
if (requestURI == null) {
// START GlassFish 1024
if (isDefaultContext) {
requestURI = getContextPath()
+ coyoteRequest.requestURI().toString();
} else {
// END GlassFish 1024
requestURI = coyoteRequest.requestURI().toString();
// START GlassFish 1024
}
// END GlassFish 1024
}
return requestURI;
|
public java.lang.StringBuffer | getRequestURL()Reconstructs the URL the client used to make the request.
The returned URL contains a protocol, server name, port
number, and server path, but it does not include query
string parameters.
Because this method returns a StringBuffer ,
not a String , you can modify the URL easily,
for example, to append query parameters.
This method is useful for creating redirect messages and
for reporting errors.
StringBuffer url = new StringBuffer();
String scheme = getScheme();
int port = getServerPort();
if (port < 0)
port = 80; // Work around java.net.URL bug
url.append(scheme);
url.append("://");
url.append(getServerName());
if ((scheme.equals("http") && (port != 80))
|| (scheme.equals("https") && (port != 443))) {
url.append(':");
url.append(port);
}
url.append(getRequestURI());
return (url);
|
public java.lang.String | getRequestedSessionId()Return the session identifier included in this request, if any.
return (requestedSessionId);
|
public org.apache.catalina.Response | getResponse()Return the Response with which this Request is associated.
return (this.response);
|
public java.lang.String | getScheme()Return the scheme used to make this Request.
// START S1AS 6170450
if (getConnector() != null
&& getConnector().getAuthPassthroughEnabled()) {
ProxyHandler proxyHandler = getConnector().getProxyHandler();
if (proxyHandler != null
&& proxyHandler.getSSLKeysize(getRequest()) > 0) {
return "https";
}
}
// END S1AS 6170450
return (coyoteRequest.scheme().toString());
|
public java.lang.String | getServerName()Return the server name responding to this Request.
return (coyoteRequest.serverName().toString());
|
public int | getServerPort()Return the server port responding to this Request.
/* SJSAS 6586658
return (coyoteRequest.getServerPort());
*/
// START SJSAS 6586658
if (isSecure()) {
String host = getHeader("host");
if (host != null && host.indexOf(':") == -1) {
// No port number provided with Host header, use default
return 443;
} else {
return (coyoteRequest.getServerPort());
}
} else {
return (coyoteRequest.getServerPort());
}
// END SJSAS 6586658
|
public java.lang.String | getServletPath()Return the portion of the request URI used to select the servlet
that will process this request.
return (mappingData.wrapperPath.toString());
|
public org.apache.tomcat.util.buf.MessageBytes | getServletPathMB()Get the servlet path.
return (mappingData.wrapperPath);
|
public javax.servlet.http.HttpSession | getSession()Return the session associated with this Request, creating one
if necessary.
Session session = doGetSession(true);
if (session != null) {
return session.getSession();
} else {
return null;
}
|
public javax.servlet.http.HttpSession | getSession(boolean create)Return the session associated with this Request, creating one
if necessary and requested.
Session session = doGetSession(create);
if (session != null) {
return session.getSession();
} else {
return null;
}
|
public org.apache.catalina.Session | getSessionInternal()Return the session associated with this Request, creating one
if necessary.
return doGetSession(true);
|
public org.apache.catalina.Session | getSessionInternal(boolean create)Return the session associated with this Request, creating one
if necessary and requested.
return doGetSession(create);
|
private java.lang.String | getSessionVersionFromCookie()
if (!isSessionVersionSupported()) {
return null;
}
Cookies serverCookies = coyoteRequest.getCookies();
int count = serverCookies.getCookieCount();
if (count <= 0) {
return null;
}
for (int i = 0; i < count; i++) {
ServerCookie scookie = serverCookies.getCookie(i);
if (scookie.getName().equals(
Globals.SESSION_VERSION_COOKIE_NAME)) {
return scookie.getValue().toString();
}
}
return null;
|
public java.net.Socket | getSocket()Return the Socket (if any) through which this Request was received.
This should only be used to access underlying state
information about this Socket, such as the SSLSession associated with
an SSLSocket.
return (socket);
|
public java.io.InputStream | getStream()Return the input stream associated with this Request.
if (inputStream == null) {
inputStream = new CoyoteInputStream(inputBuffer);
}
return inputStream;
|
protected org.apache.tomcat.util.buf.B2CConverter | getURIConverter()Return the URI converter.
return URIConverter;
|
public java.security.Principal | getUserPrincipal()Return the principal that has been authenticated for this Request.
return (userPrincipal);
|
public org.apache.catalina.ValveContext | getValveContext()Get valve context.
return (this.valveContext);
|
public org.apache.catalina.Wrapper | getWrapper()Return the Wrapper within which this Request is being processed.
return (this.wrapper);
|
public int | incrementDispatchDepth()Increment the depth of application dispatch
return ++dispatchDepth;
|
private void | incrementSessionVersion(org.apache.catalina.session.StandardSession ss, org.apache.catalina.Context context)Increments the version of the given session, and stores it as a
request attribute, so it can later be included in a response cookie.
if (ss == null || context == null) {
return;
}
ss.incrementVersion();
String versionString = Long.toString(ss.getVersion());
HashMap<String, String> sessionVersions = (HashMap<String, String>)
getAttribute(Globals.SESSION_VERSIONS_REQUEST_ATTRIBUTE);
if (sessionVersions == null) {
sessionVersions = new HashMap<String, String>();
setAttribute(Globals.SESSION_VERSIONS_REQUEST_ATTRIBUTE,
sessionVersions);
}
String path = context.getPath();
if ("".equals(path)) {
path = "/";
}
sessionVersions.put(path, versionString);
|
private void | initSessionTracker()
attributes.put(Globals.SESSION_TRACKER, sessionTracker);
|
protected static final boolean | isAlpha(java.lang.String value)
if (value == null) {
return false;
}
for (int i = 0; i < value.length(); i++) {
char c = value.charAt(i);
if (!((c >= 'a" && c <= 'z") || (c >= 'A" && c <= 'Z"))) {
return false;
}
}
return true;
|
public boolean | isMaxDispatchDepthReached()Check if the application dispatching has reached the maximum
return dispatchDepth > maxDispatchDepth;
|
public boolean | isRequestedSessionIdFromCookie()Return true if the session identifier included in this
request came from a cookie.
if (requestedSessionId != null)
return (requestedSessionCookie);
else
return (false);
|
public boolean | isRequestedSessionIdFromURL()Return true if the session identifier included in this
request came from the request URI.
if (requestedSessionId != null)
return (requestedSessionURL);
else
return (false);
|
public boolean | isRequestedSessionIdFromUrl()Return true if the session identifier included in this
request came from the request URI.
return (isRequestedSessionIdFromURL());
|
public boolean | isRequestedSessionIdValid()Return true if the session identifier included in this
request identifies a valid session.
if (requestedSessionId == null)
return (false);
if (context == null)
return (false);
if (session != null
&& requestedSessionId.equals(session.getIdInternal())) {
return session.isValid();
}
Manager manager = context.getManager();
if (manager == null)
return (false);
Session localSession = null;
try {
if (manager.isSessionVersioningSupported()) {
localSession = manager.findSession(requestedSessionId,
requestedSessionVersion);
} else {
localSession = manager.findSession(requestedSessionId);
}
} catch (IOException e) {
localSession = null;
}
if ((localSession != null) && localSession.isValid())
return (true);
else
return (false);
|
static boolean | isSSLAttribute(java.lang.String name)Test if a given name is one of the special Servlet-spec SSL attributes.
return Globals.CERTIFICATES_ATTR.equals(name) ||
Globals.CIPHER_SUITE_ATTR.equals(name) ||
Globals.KEY_SIZE_ATTR.equals(name);
|
public boolean | isSecure()Was this request received on a secure connection?
return (secure);
|
private boolean | isSessionVersionSupported()
return (context != null
&& context.getManager() != null
&& context.getManager().isSessionVersioningSupported());
|
public boolean | isUserInRole(java.lang.String role)Return true if the authenticated user principal
possesses the specified role name.
// BEGIN RIMOD 4949842
/*
* Must get userPrincipal through getUserPrincipal(), can't assume
* it has already been set since it may be coming from core.
*/
Principal userPrincipal = this.getUserPrincipal();
// END RIMOD 4949842
// Have we got an authenticated principal at all?
if (userPrincipal == null)
return (false);
// Identify the Realm we will use for checking role assignmenets
if (context == null)
return (false);
Realm realm = context.getRealm();
if (realm == null)
return (false);
// Check for a role alias defined in a <security-role-ref> element
if (wrapper != null) {
String realRole = wrapper.findSecurityReference(role);
//START SJSAS 6232464
if ((realRole != null) &&
//realm.hasRole(userPrincipal, realRole))
realm.hasRole(this, (HttpResponse) response,
userPrincipal, realRole))
return (true);
}
// Check for a role defined directly as a <security-role>
//return (realm.hasRole(userPrincipal, role));
return (realm.hasRole(this, (HttpResponse) response,
userPrincipal, role));
//END SJSAS 6232464
|
private void | log(java.lang.String message)Log a message on the Logger associated with our Container (if any).
Logger logger = connector.getContainer().getLogger();
String localName = "CoyoteRequest";
if (logger != null)
logger.log(localName + " " + message);
else
System.out.println(localName + " " + message);
|
private void | log(java.lang.String message, java.lang.Throwable throwable)Log a message on the Logger associated with our Container (if any).
Logger logger = connector.getContainer().getLogger();
String localName = "CoyoteRequest";
if (logger != null)
logger.log(localName + " " + message, throwable);
else {
System.out.println(localName + " " + message);
throwable.printStackTrace(System.out);
}
|
protected javax.servlet.http.Cookie | makeCookie(org.apache.tomcat.util.http.ServerCookie scookie)
return makeCookie(scookie, false);
|
protected javax.servlet.http.Cookie | makeCookie(org.apache.tomcat.util.http.ServerCookie scookie, boolean decode)
String name = scookie.getName().toString();
String value = scookie.getValue().toString();
if (decode) {
try {
name = URLDecoder.decode(name, "UTF-8");
value = URLDecoder.decode(value, "UTF-8");
} catch (UnsupportedEncodingException e) {
name = URLDecoder.decode(name);
value = URLDecoder.decode(value);
}
}
return new Cookie(name, value);
|
protected void | parseCookies()Parse cookies.
cookiesParsed = true;
Cookies serverCookies = coyoteRequest.getCookies();
int count = serverCookies.getCookieCount();
if (count <= 0)
return;
cookies.clear();
for (int i = 0; i < count; i++) {
ServerCookie scookie = serverCookies.getCookie(i);
try {
/* GlassFish 898
Cookie cookie = new Cookie(scookie.getName().toString(),
scookie.getValue().toString());
*/
// START GlassFish 898
Cookie cookie = makeCookie(scookie);
// END GlassFish 898
cookie.setPath(scookie.getPath().toString());
cookie.setVersion(scookie.getVersion());
String domain = scookie.getDomain().toString();
if (domain != null) {
cookie.setDomain(scookie.getDomain().toString());
}
cookies.add(cookie);
} catch(IllegalArgumentException e) {
; // Ignore bad cookie.
}
}
|
void | parseJrouteCookie()Parses the value of the JROUTE cookie, if present.
Cookies serverCookies = coyoteRequest.getCookies();
int count = serverCookies.getCookieCount();
if (count <= 0) {
return;
}
for (int i=0; i<count; i++) {
ServerCookie scookie = serverCookies.getCookie(i);
if (scookie.getName().equals(Constants.JROUTE_COOKIE)) {
setJrouteId(scookie.getValue().toString());
break;
}
}
|
protected void | parseLocales()Parse request locales.
localesParsed = true;
Enumeration values = getHeaders("accept-language");
while (values.hasMoreElements()) {
String value = values.nextElement().toString();
parseLocalesHeader(value);
}
|
protected void | parseLocalesHeader(java.lang.String value)Parse accept-language header value.
// Store the accumulated languages that have been requested in
// a local collection, sorted by the quality value (so we can
// add Locales in descending order). The values will be ArrayLists
// containing the corresponding Locales to be added
TreeMap locales = new TreeMap();
// Preprocess the value to remove all whitespace
int white = value.indexOf(' ");
if (white < 0)
white = value.indexOf('\t");
if (white >= 0) {
StringBuffer sb = new StringBuffer();
int len = value.length();
for (int i = 0; i < len; i++) {
char ch = value.charAt(i);
if ((ch != ' ") && (ch != '\t"))
sb.append(ch);
}
value = sb.toString();
}
// Process each comma-delimited language specification
parser.setString(value); // ASSERT: parser is available to us
int length = parser.getLength();
while (true) {
// Extract the next comma-delimited entry
int start = parser.getIndex();
if (start >= length)
break;
int end = parser.findChar(',");
String entry = parser.extract(start, end).trim();
parser.advance(); // For the following entry
// Extract the quality factor for this entry
double quality = 1.0;
int semi = entry.indexOf(";q=");
if (semi >= 0) {
try {
quality = Double.parseDouble(entry.substring(semi + 3));
} catch (NumberFormatException e) {
quality = 0.0;
}
entry = entry.substring(0, semi);
}
// Skip entries we are not going to keep track of
if (quality < 0.00005)
continue; // Zero (or effectively zero) quality factors
if ("*".equals(entry))
continue; // FIXME - "*" entries are not handled
// Extract the language and country for this entry
String language = null;
String country = null;
String variant = null;
int dash = entry.indexOf('-");
if (dash < 0) {
language = entry;
country = "";
variant = "";
} else {
language = entry.substring(0, dash);
country = entry.substring(dash + 1);
int vDash = country.indexOf('-");
if (vDash > 0) {
String cTemp = country.substring(0, vDash);
variant = country.substring(vDash + 1);
country = cTemp;
} else {
variant = "";
}
}
if (!isAlpha(language) || !isAlpha(country) || !isAlpha(variant)) {
continue;
}
// Add a new Locale to the list of Locales for this quality level
Locale locale = new Locale(language, country, variant);
Double key = new Double(-quality); // Reverse the order
ArrayList values = (ArrayList) locales.get(key);
if (values == null) {
values = new ArrayList();
locales.put(key, values);
}
values.add(locale);
}
// Process the quality values in highest->lowest order (due to
// negating the Double value when creating the key)
Iterator keys = locales.keySet().iterator();
while (keys.hasNext()) {
Double key = (Double) keys.next();
ArrayList list = (ArrayList) locales.get(key);
Iterator values = list.iterator();
while (values.hasNext()) {
Locale locale = (Locale) values.next();
addLocale(locale);
}
}
|
protected void | parseRequestParameters()Parse request parameters.
/* SJSAS 4936855
requestParametersParsed = true;
*/
Parameters parameters = coyoteRequest.getParameters();
// getCharacterEncoding() may have been overridden to search for
// hidden form field containing request encoding
String enc = getCharacterEncoding();
// START SJSAS 4936855
// Delay updating requestParametersParsed to TRUE until
// after getCharacterEncoding() has been called, because
// getCharacterEncoding() may cause setCharacterEncoding() to be
// called, and the latter will ignore the specified encoding if
// requestParametersParsed is TRUE
requestParametersParsed = true;
// END SJSAS 4936855
if (enc != null) {
parameters.setEncoding(enc);
parameters.setQueryStringEncoding(enc);
} else {
parameters.setEncoding
(org.apache.coyote.Constants.DEFAULT_CHARACTER_ENCODING);
parameters.setQueryStringEncoding
(org.apache.coyote.Constants.DEFAULT_CHARACTER_ENCODING);
}
parameters.handleQueryParameters();
if (usingInputStream || usingReader)
return;
if (!getMethod().equalsIgnoreCase("POST"))
return;
String contentType = getContentType();
if (contentType == null)
contentType = "";
int semicolon = contentType.indexOf(';");
if (semicolon >= 0) {
contentType = contentType.substring(0, semicolon).trim();
} else {
contentType = contentType.trim();
}
if (!("application/x-www-form-urlencoded".equals(contentType)))
return;
int len = getContentLength();
if (len > 0) {
int maxPostSize = ((CoyoteConnector) connector).getMaxPostSize();
if ((maxPostSize > 0) && (len > maxPostSize)) {
log(sm.getString("coyoteRequest.postTooLarge"));
throw new IllegalStateException("Post too large");
}
try {
/* SJSAS 6346738
byte[] formData = null;
if (len < CACHED_POST_LEN) {
if (postData == null)
postData = new byte[CACHED_POST_LEN];
formData = postData;
} else {
formData = new byte[len];
}
int actualLen = readPostBody(formData, len);
if (actualLen == len) {
parameters.processParameters(formData, 0, len);
}
*/
// START SJSAS 6346738
byte[] formData = getPostBody();
if (formData != null) {
parameters.processParameters(formData, 0, len);
}
// END SJSAS 6346738
} catch (Throwable t) {
; // Ignore
}
}
|
protected void | parseSessionCookiesId()Parse session id in URL.
// Parse session id from cookies
Cookies serverCookies = coyoteRequest.getCookies();
int count = serverCookies.getCookieCount();
if (count <= 0) {
return;
}
for (int i = 0; i < count; i++) {
ServerCookie scookie = serverCookies.getCookie(i);
if (scookie.getName().equals(Globals.SESSION_COOKIE_NAME)) {
// Override anything requested in the URL
if (!isRequestedSessionIdFromCookie()) {
// Accept only the first session id cookie
B2CConverter.convertASCII(scookie.getValue());
setRequestedSessionId
(scookie.getValue().toString());
// TODO: Pass cookie path into
// getSessionVersionFromCookie()
String sessionVersionString = getSessionVersionFromCookie();
parseSessionVersionString(sessionVersionString);
setRequestedSessionCookie(true);
setRequestedSessionURL(false);
if (log.isDebugEnabled()) {
log.debug("Requested cookie session id is " +
((HttpServletRequest) getRequest())
.getRequestedSessionId());
}
} else {
if (!isRequestedSessionIdValid()) {
// Replace the session id until one is valid
B2CConverter.convertASCII(scookie.getValue());
setRequestedSessionId
(scookie.getValue().toString());
// TODO: Pass cookie path into
// getSessionVersionFromCookie()
String sessionVersionString =
getSessionVersionFromCookie();
parseSessionVersionString(sessionVersionString);
}
}
}
}
|
protected void | parseSessionId()Parse session id in URL.
CharChunk uriCC = coyoteRequest.decodedURI().getCharChunk();
int semicolon = uriCC.indexOf(match, 0, match.length(), 0);
if (semicolon > 0) {
// Parse session ID, and extract it from the decoded request URI
int start = uriCC.getStart();
int end = uriCC.getEnd();
int sessionIdStart = start + semicolon + match.length();
int semicolon2 = uriCC.indexOf(';", sessionIdStart);
/* SJSAS 6346226
if (semicolon2 >= 0) {
setRequestedSessionId
(new String(uriCC.getBuffer(), sessionIdStart,
semicolon2 - semicolon - match.length()));
} else {
setRequestedSessionId
(new String(uriCC.getBuffer(), sessionIdStart,
end - sessionIdStart));
}
*/
// START SJSAS 6346226
String sessionId = null;
if (semicolon2 >= 0) {
sessionId = new String(uriCC.getBuffer(), sessionIdStart,
semicolon2 - semicolon - match.length());
} else {
sessionId = new String(uriCC.getBuffer(), sessionIdStart,
end - sessionIdStart);
}
int jrouteIndex = sessionId.lastIndexOf(':");
if (jrouteIndex > 0) {
setRequestedSessionId(sessionId.substring(0, jrouteIndex));
if (jrouteIndex < (sessionId.length()-1)) {
setJrouteId(sessionId.substring(jrouteIndex+1));
}
} else {
setRequestedSessionId(sessionId);
}
// END SJSAS 6346226
setRequestedSessionURL(true);
/* SJSWS 6376484
// Extract session ID from request URI
ByteChunk uriBC = coyoteRequest.requestURI().getByteChunk();
start = uriBC.getStart();
end = uriBC.getEnd();
semicolon = uriBC.indexOf(match, 0, match.length(), 0);
if (semicolon > 0) {
sessionIdStart = start + semicolon;
semicolon2 = uriCC.indexOf
(';', start + semicolon + match.length());
uriBC.setEnd(start + semicolon);
byte[] buf = uriBC.getBuffer();
if (semicolon2 >= 0) {
for (int i = 0; i < end - start - semicolon2; i++) {
buf[start + semicolon + i]
= buf[start + i + semicolon2];
}
uriBC.setBytes(buf, start, semicolon
+ (end - start - semicolon2));
}
}
*/
// START SJSWS 6376484
/*
* Parse the session id from the encoded URI only if the encoded
* URI is not null, to allow for lazy evaluation
*/
if (!coyoteRequest.requestURI().getByteChunk().isNull()) {
parseSessionIdFromRequestURI();
}
// END SJSWS 6376484
} else {
setRequestedSessionId(null);
setRequestedSessionURL(false);
}
|
protected void | parseSessionIdFromRequestURI()Extracts the session ID from the request URI.
int start, end, sessionIdStart, semicolon, semicolon2;
ByteChunk uriBC = coyoteRequest.requestURI().getByteChunk();
start = uriBC.getStart();
end = uriBC.getEnd();
semicolon = uriBC.indexOf(match, 0, match.length(), 0);
if (semicolon > 0) {
sessionIdStart = start + semicolon;
semicolon2 = uriBC.indexOf
(';", semicolon + match.length());
uriBC.setEnd(start + semicolon);
byte[] buf = uriBC.getBuffer();
if (semicolon2 >= 0) {
for (int i = 0; i < end - start - semicolon2; i++) {
buf[start + semicolon + i]
= buf[start + i + semicolon2];
}
uriBC.setBytes(buf, start, semicolon
+ (end - start - semicolon2));
}
}
|
protected java.lang.String | parseSessionVersion()Parses and removes any session version (if present) from the request
URI, and returns it
String sessionVersionString = null;
CharChunk uriCC = coyoteRequest.decodedURI().getCharChunk();
int semicolon = uriCC.indexOf(Globals.SESSION_VERSION_PARAMETER, 0,
Globals.SESSION_VERSION_PARAMETER.length(),
0);
if (semicolon > 0) {
int start = uriCC.getStart();
int end = uriCC.getEnd();
int sessionVersionStart = start + semicolon
+ Globals.SESSION_VERSION_PARAMETER.length();
int semicolon2 = uriCC.indexOf(';", sessionVersionStart);
if (semicolon2 >= 0) {
sessionVersionString = new String(
uriCC.getBuffer(),
sessionVersionStart,
semicolon2 - semicolon - Globals.SESSION_VERSION_PARAMETER.length());
} else {
sessionVersionString = new String(
uriCC.getBuffer(),
sessionVersionStart,
end - sessionVersionStart);
}
if (!coyoteRequest.requestURI().getByteChunk().isNull()) {
removeSessionVersionFromRequestURI();
}
}
return sessionVersionString;
|
void | parseSessionVersionString(java.lang.String sessionVersionString)
if (sessionVersionString == null || !isSessionVersionSupported()) {
return;
}
HashMap<String, String> sessionVersions =
RequestUtil.parseSessionVersions(sessionVersionString);
if (sessionVersions != null) {
attributes.put(Globals.SESSION_VERSIONS_REQUEST_ATTRIBUTE,
sessionVersions);
if (context != null) {
String path = context.getPath();
if ("".equals(path)) {
path = "/";
}
this.requestedSessionVersion = sessionVersions.get(path);
}
}
|
private void | populateSSLAttributes()
coyoteRequest.action(ActionCode.ACTION_REQ_SSL_ATTRIBUTE,
coyoteRequest);
Object attr = coyoteRequest.getAttribute(Globals.CERTIFICATES_ATTR);
if( attr != null) {
attributes.put(Globals.CERTIFICATES_ATTR, attr);
}
attr = coyoteRequest.getAttribute(Globals.CIPHER_SUITE_ATTR);
if(attr != null) {
attributes.put(Globals.CIPHER_SUITE_ATTR, attr);
}
attr = coyoteRequest.getAttribute(Globals.KEY_SIZE_ATTR);
if(attr != null) {
attributes.put(Globals.KEY_SIZE_ATTR, attr);
}
|
protected int | readPostBody(byte[] body, int len)Read post body in an array.
int offset = 0;
do {
int inputLen = getStream().read(body, offset, len - offset);
if (inputLen <= 0) {
return offset;
}
offset += inputLen;
} while ((len - offset) > 0);
return len;
|
public void | recycle()Release all object references, and initialize instance variables, in
preparation for reuse of this object.
// --------------------------------------------------------- Public Methods
context = null;
wrapper = null;
dispatcherType = null;
requestDispatcherPath = null;
authType = null;
requestURI = null;
inputBuffer.recycle();
usingInputStream = false;
usingReader = false;
userPrincipal = null;
subject = null;
sessionParsed = false;
requestParametersParsed = false;
cookiesParsed = false;
locales.clear();
localesParsed = false;
secure = false;
remoteAddr = null;
remoteHost = null;
remotePort = -1;
localPort = -1;
localAddr = null;
localName = null;
attributes.clear();
notes.clear();
cookies.clear();
unsuccessfulSessionFind = false;
if (session != null) {
session.endAccess();
}
session = null;
requestedSessionCookie = false;
requestedSessionId = null;
requestedSessionVersion = null;
requestedSessionURL = false;
// START GlassFish 896
sessionTracker.reset();
// END GlassFish 896
/* CR 6309511
log = null;
*/
dispatchDepth = 0; // S1AS 4703023
parameterMap.setLocked(false);
parameterMap.clear();
mappingData.recycle();
if (enforceScope) {
if (facade != null) {
facade.clear();
facade = null;
}
if (inputStream != null) {
inputStream.clear();
inputStream = null;
}
if (reader != null) {
reader.clear();
reader = null;
}
}
|
public void | removeAttribute(java.lang.String name)Remove the specified request attribute if it exists.
Object value = null;
boolean found = attributes.containsKey(name);
if (found) {
value = attributes.get(name);
attributes.remove(name);
} else {
return;
}
// Notify interested application event listeners
Object listeners[] = context.getApplicationEventListeners();
if ((listeners == null) || (listeners.length == 0))
return;
ServletRequestAttributeEvent event =
new ServletRequestAttributeEvent(context.getServletContext(),
getRequest(), name, value);
for (int i = 0; i < listeners.length; i++) {
if (!(listeners[i] instanceof ServletRequestAttributeListener))
continue;
ServletRequestAttributeListener listener =
(ServletRequestAttributeListener) listeners[i];
try {
listener.attributeRemoved(event);
} catch (Throwable t) {
log(sm.getString("coyoteRequest.attributeEvent"), t);
// Error valve will pick this execption up and display it to user
attributes.put( Globals.EXCEPTION_ATTR, t );
}
}
|
public void | removeNote(java.lang.String name)Remove any object bound to the specified name in the internal notes
for this request.
notes.remove(name);
|
protected void | removeSessionVersionFromRequestURI()Removes the session version from the request URI.
int start, end, sessionVersionStart, semicolon, semicolon2;
ByteChunk uriBC = coyoteRequest.requestURI().getByteChunk();
start = uriBC.getStart();
end = uriBC.getEnd();
semicolon = uriBC.indexOf(Globals.SESSION_VERSION_PARAMETER, 0,
Globals.SESSION_VERSION_PARAMETER.length(),
0);
if (semicolon > 0) {
sessionVersionStart = start + semicolon;
semicolon2 = uriBC.indexOf
(';", semicolon + Globals.SESSION_VERSION_PARAMETER.length());
uriBC.setEnd(start + semicolon);
byte[] buf = uriBC.getBuffer();
if (semicolon2 >= 0) {
for (int i = 0; i < end - start - semicolon2; i++) {
buf[start + semicolon + i]
= buf[start + i + semicolon2];
}
uriBC.setBytes(buf, start, semicolon
+ (end - start - semicolon2));
}
}
|
public void | setAttribute(java.lang.String name, java.lang.Object value)Set the specified request attribute to the specified value.
// Name cannot be null
if (name == null)
throw new IllegalArgumentException
(sm.getString("coyoteRequest.setAttribute.namenull"));
// Null value is the same as removeAttribute()
if (value == null) {
removeAttribute(name);
return;
}
if (name.equals(Globals.DISPATCHER_TYPE_ATTR)) {
dispatcherType = value;
return;
} else if (name.equals(Globals.DISPATCHER_REQUEST_PATH_ATTR)) {
requestDispatcherPath = value;
return;
}
boolean replaced = false;
Object oldValue = attributes.put(name, value);
if (oldValue != null) {
replaced = true;
}
// START SJSAS 6231069
// Pass special attributes to the ngrizzly layer
if (name.startsWith("grizzly.")) {
coyoteRequest.setAttribute(name, value);
}
// END SJSAS 6231069
// Notify interested application event listeners
Object listeners[] = context.getApplicationEventListeners();
if ((listeners == null) || (listeners.length == 0))
return;
ServletRequestAttributeEvent event = null;
if (replaced)
event =
new ServletRequestAttributeEvent(context.getServletContext(),
getRequest(), name, oldValue);
else
event =
new ServletRequestAttributeEvent(context.getServletContext(),
getRequest(), name, value);
for (int i = 0; i < listeners.length; i++) {
if (!(listeners[i] instanceof ServletRequestAttributeListener))
continue;
ServletRequestAttributeListener listener =
(ServletRequestAttributeListener) listeners[i];
try {
if (replaced) {
listener.attributeReplaced(event);
} else {
listener.attributeAdded(event);
}
} catch (Throwable t) {
log(sm.getString("coyoteRequest.attributeEvent"), t);
// Error valve will pick this execption up and display it to user
attributes.put( Globals.EXCEPTION_ATTR, t );
}
}
|
public void | setAuthType(java.lang.String type)Set the authentication type used for this request, if any; otherwise
set the type to null . Typical values are "BASIC",
"DIGEST", or "SSL".
this.authType = type;
|
public void | setAuthorization(java.lang.String authorization)Set the authorization credentials sent with this request.
// Not used
|
public void | setCharacterEncoding(java.lang.String enc)Overrides the name of the character encoding used in the body of this
request.
This method must be called prior to reading request parameters or
reading input using getReader() . Otherwise, it has no
effect.
// START SJSAS 4936855
if (requestParametersParsed || usingReader) {
String contextName =
(getContext() != null ? getContext().getName() : "UNKNOWN");
log.warn(sm.getString("coyoteRequest.setCharacterEncoding.ise",
enc, contextName));
return;
}
// END SJSAS 4936855
// Ensure that the specified encoding is valid
byte buffer[] = new byte[1];
buffer[0] = (byte) 'a";
// START S1AS 6179607: Workaround for 6181598. Workaround should be
// removed once the underlying issue in J2SE has been fixed.
/*
* String dummy = new String(buffer, enc);
*/
// END S1AS 6179607
// START S1AS 6179607
final byte[] finalBuffer = buffer;
final String finalEnc = enc;
if (Globals.IS_SECURITY_ENABLED) {
try {
AccessController.doPrivileged(new PrivilegedExceptionAction() {
public Object run() throws UnsupportedEncodingException {
return new String(finalBuffer, finalEnc);
}
});
} catch (PrivilegedActionException pae) {
throw (UnsupportedEncodingException) pae.getCause();
}
} else {
new String(buffer, enc);
}
// END S1AS 6179607
// Save the validated encoding
coyoteRequest.setCharacterEncoding(enc);
|
public void | setCheckRestrictedResources(boolean check)Set whether or not access to resources under WEB-INF or META-INF
needs to be checked.
this.checkRestrictedResources = check;
|
public void | setConnector(org.apache.catalina.Connector connector)Set the Connector through which this Request was received.
this.connector = connector;
|
public void | setContentLength(int length)Set the content length associated with this Request.
// Not used
|
public void | setContentType(java.lang.String type)Set the content type (and optionally the character encoding)
associated with this Request. For example,
text/html; charset=ISO-8859-4 .
// Not used
|
public void | setContext(org.apache.catalina.Context context)Set the Context within which this Request is being processed. This
must be called as soon as the appropriate Context is identified, because
it identifies the value to be returned by getContextPath() ,
and thus enables parsing of the request URI.
this.context = context;
// START GlassFish 896
initSessionTracker();
// END GlassFish 896
|
public void | setContextPath(java.lang.String path)Set the context path for this Request. This will normally be called
when the associated Context is mapping the Request to a particular
Wrapper.
if (path == null) {
mappingData.contextPath.setString("");
} else {
mappingData.contextPath.setString(path);
}
|
public void | setCookies(javax.servlet.http.Cookie[] cookies)Set the set of cookies recieved with this Request.
this.cookies.clear();
if (cookies != null) {
for (int i = 0; i < cookies.length; i++)
this.cookies.add(cookies[i]);
}
|
public void | setCoyoteRequest(org.apache.coyote.Request coyoteRequest)Set the Coyote request.
this.coyoteRequest = coyoteRequest;
inputBuffer.setRequest(coyoteRequest);
|
public void | setDecodedRequestURI(java.lang.String uri)Set the decoded request URI.
// Not used
|
public void | setDefaultContext(boolean isDefaultContext)
this.isDefaultContext = isDefaultContext;
|
public static void | setEnforceScope(boolean enforce)Set whether or not to enforce scope checking of this object.
enforceScope = enforce;
|
public void | setFilterChain(javax.servlet.FilterChain filterChain)Set filter chain associated with the request.
this.filterChain = filterChain;
|
public void | setHost(org.apache.catalina.Host host)Set the Host within which this Request is being processed. This
must be called as soon as the appropriate Host is identified, and
before the Request is passed to a context.
mappingData.host = host;
|
void | setJrouteId(java.lang.String jrouteId)Sets the jroute id of this request.
this.jrouteId = jrouteId;
|
public static void | setMaxDispatchDepth(int depth)Static setter method for the maximum dispatch depth
maxDispatchDepth = depth;
|
public void | setMethod(java.lang.String method)Set the HTTP request method used for this Request.
// Not used
|
public void | setNote(java.lang.String name, java.lang.Object value)Bind an object to a specified name in the internal notes associated
with this request, replacing any existing binding for this name.
notes.put(name, value);
|
public void | setPathInfo(java.lang.String path)Set the path information for this Request. This will normally be called
when the associated Context is mapping the Request to a particular
Wrapper.
mappingData.pathInfo.setString(path);
|
public void | setProtocol(java.lang.String protocol)Set the protocol name and version associated with this Request.
// Not used
|
public void | setQueryString(java.lang.String query)Set the query string for this Request. This will normally be called
by the HTTP Connector, when it parses the request headers.
// Not used
|
public void | setRemoteAddr(java.lang.String remoteAddr)Set the IP address of the remote client associated with this Request.
// Not used
|
public void | setRemoteHost(java.lang.String remoteHost)Set the fully qualified name of the remote client associated with this
Request.
// Not used
|
public void | setRequestURI(java.lang.String uri)Set the unparsed request URI for this Request. This will normally be
called by the HTTP Connector, when it parses the request headers.
// Not used
|
public void | setRequestedSessionCookie(boolean flag)Set a flag indicating whether or not the requested session ID for this
request came in through a cookie. This is normally called by the
HTTP Connector, when it parses the request headers.
this.requestedSessionCookie = flag;
|
public void | setRequestedSessionId(java.lang.String id)Set the requested session ID for this request. This is normally called
by the HTTP Connector, when it parses the request headers.
this.requestedSessionId = id;
|
public void | setRequestedSessionURL(boolean flag)Set a flag indicating whether or not the requested session ID for this
request came in through a URL. This is normally called by the
HTTP Connector, when it parses the request headers.
this.requestedSessionURL = flag;
|
public void | setResponse(org.apache.catalina.Response response)Set the Response with which this Request is associated.
this.response = response;
sessionTracker.setResponse((CoyoteResponse) response);
|
public void | setScheme(java.lang.String scheme)Set the name of the scheme associated with this request. Typical values
are http , https , and ftp .
// Not used
|
public void | setSecure(boolean secure)Set the value to be returned by isSecure()
for this Request.
this.secure = secure;
|
public void | setServerName(java.lang.String name)Set the name of the server (virtual host) to process this request.
coyoteRequest.serverName().setString(name);
|
public void | setServerPort(int port)Set the port number of the server to process this request.
coyoteRequest.setServerPort(port);
|
public void | setServletPath(java.lang.String path)Set the servlet path for this Request. This will normally be called
when the associated Context is mapping the Request to a particular
Wrapper.
if (path != null)
mappingData.wrapperPath.setString(path);
|
public void | setSession(org.apache.catalina.Session newSess)set the session - this method is not for general use
session = newSess;
|
public void | setSocket(java.net.Socket socket)Set the Socket (if any) through which this Request was received.
this.socket = socket;
remoteHost = null;
remoteAddr = null;
remotePort = -1;
localPort = -1;
localAddr = null;
localName = null;
|
public void | setStream(java.io.InputStream stream)Set the input stream associated with this Request.
// Ignore
|
protected void | setURIConverter(org.apache.tomcat.util.buf.B2CConverter URIConverter)Set the URI converter.
this.URIConverter = URIConverter;
|
public void | setUserPrincipal(java.security.Principal principal)Set the Principal who has been authenticated for this Request. This
value is also used to calculate the value to be returned by the
getRemoteUser() method.
if (SecurityUtil.isPackageProtectionEnabled()){
HttpSession session = getSession(false);
if ( (subject != null) &&
(!subject.getPrincipals().contains(principal)) ){
subject.getPrincipals().add(principal);
} else if (session != null &&
session.getAttribute(Globals.SUBJECT_ATTR) == null) {
subject = new Subject();
subject.getPrincipals().add(principal);
}
if (session != null){
session.setAttribute(Globals.SUBJECT_ATTR, subject);
}
}
this.userPrincipal = principal;
|
public void | setValveContext(org.apache.catalina.ValveContext valveContext)Set valve context.
this.valveContext = valveContext;
|
public void | setWrapper(org.apache.catalina.Wrapper wrapper)Set the Wrapper within which this Request is being processed. This
must be called as soon as the appropriate Wrapper is identified, and
before the Request is ultimately passed to an application servlet.
this.wrapper = wrapper;
|