public interface RequestContext
In normal servlet runtime, this may represent parts of
javax.servlet.http.HttpServletRequest
and javax.servlet.http.HttpServletResponse
.
But, in portlet runtime, this may represent parts of
javax.portlet.PortletRequest
and javax.portlet.PortletResponse
.
Modifier and Type | Method and Description |
---|---|
void |
addCookie(javax.servlet.http.Cookie cookie)
Adds the specified cookie to the response.
|
Object |
getAttribute(String name)
Returns the value of the named attribute as an Object, or null if no attribute of the given name exists.
|
String |
getHeader(String name)
Returns the value of the specified request header as a String.
|
Enumeration |
getHeaderNames()
Returns an enumeration of all the header names this request contains.
|
Enumeration |
getHeaders(String name)
Returns all the values of the specified request header as an Enumeration of String objects.
|
InputStream |
getInputStream()
Retrieves a
java.io.InputStream of the body of the request as binary data. |
String |
getMethod()
Returns the name of the HTTP method with which this request was made,
for example, GET, POST, or PUT.
|
String |
getPathInfo()
Returns any extra path information associated with the URL the client sent
when it made this request.
|
String |
getQueryString()
Returns the query string that is contained in the request URL after the path.
|
String |
getRequestBasePath()
Returns the base relative path of the request before the request path info.
|
String |
getScheme()
Returns the scheme of the request URI.
|
String |
getServerName()
Returns the host name of the server to which the request was sent.
|
int |
getServerPort()
Returns the port number to which the request was sent.
|
Sink |
getSink()
Returns the
Sink instance used in the current reverse proxy processing. |
boolean |
isSecure()
Returns a boolean indicating whether this request was made using a secure channel,
such as HTTPS.
|
void |
sendRedirect(String location)
Sends a temporary redirect response to the client using the specified redirect location URL.
|
void |
setHeader(String name,
String value)
Sets a response header with the given name and value.
|
void |
setIntHeader(String name,
int value)
Sets a response header with the given name and integer value.
|
void |
setStatus(int sc)
Sets the status code for this response.
|
boolean isSecure()
javax.servlet.ServletRequest#isSecure()}.
,
javax.portlet.PortletRequest#isSecure()}.
String getScheme()
javax.servlet.ServletRequest#getScheme()}
,
javax.portlet.PortletRequest#getScheme()}.
String getServerName()
javax.servlet.ServletRequest#getServerName()}
,
javax.portlet.PortletRequest#getServerName()}.
int getServerPort()
javax.servlet.ServletRequest#getServerPort()}
,
javax.portlet.PortletRequest#getServerPort()}.
String getMethod()
javax.servlet.http.HttpServletRequest#getMethod()}
,
javax.portlet.ClientDataRequest#getMethod()}
String getRequestBasePath()
Typically, in servlet runtime, it is either the concatenation of the request context path and the servlet path, or the concatenation of the request context path and the servlet filter mapping path prefix.
For example, in servlet runtime, if the context path is '/webcontent2', the servlet path is '/rproxy' and the path info is '/a/b/c.html', then this method may return the concatenation of the context path and servlet path, '/webcontent2/rproxy'.
Or, if a servlet filter used for reverse proxy in servlet runtime, and if the context path is '/webcontent2', the servlet filter mapping path is '/rproxy/*' and the remaining path info is '/a/b/c.html', then this method may return the concatenation of the context path and filter mapping path prefix, '/webcontent2/rproxy'.
Note: Portlet runtime doesn't give a request path info unlike servlet runtime. So, an implementation for that kind of runtime may return an empty string and decide not to use this method.
String getPathInfo()
org.apache.portals.applications.webcontent2.portlet.proxy.PortletRequestContext#getRequestBasePath()}
Object getAttribute(String name)
name
- javax.servlet.ServletRequest#getAttribute()}
,
javax.portlet.PortletRequest#getAttribute()}
String getQueryString()
Note: Portlet runtime doesn't give an HTTP request query string unlike servlet runtime. So, an implementation for that kind of runtime may return null and decide not to use this method.
javax.servlet.http.HttpServletRequest#getQueryString()}
,
org.apache.portals.applications.webcontent2.portlet.proxy.PortletRequestContext#getQueryString()}
Enumeration getHeaderNames()
Note: Portlet runtime doesn't have a method named getHeaderNames()
unlike servlet runtime.
So, an implementation for portlet runtime may invoke PortletRequest.getPropertyNames()
internally
instead because some portlet container implementations such as Apache Jetspeed-2 may return HTTP header names on the method call.
javax.servlet.http.HttpServletRequest#getHeaderNames()}
,
javax.portlet.PortletRequest#getPropertyNames()}
Enumeration getHeaders(String name)
Note: Portlet runtime doesn't have a method named getHeaders(String)
unlike servlet runtime.
So, an implementation for portlet runtime may invoke javax.portlet.PortletRequest#getProperties()
internally
instead because some portlet container implementations such as Apache Jetspeed-2 may return HTTP headers on the method call.
name
- javax.servlet.http.HttpServletRequest#getHeaders(String)}
,
javax.portlet.PortletRequest#getProperties(String)}
String getHeader(String name)
Note: Portlet runtime doesn't have a method named getHeader(String)
unlike servlet runtime.
So, an implementation for portlet runtime may invoke PortletRequest.getProperty(String)
internally
instead because some portlet container implementations such as Apache Jetspeed-2 may return HTTP headers on the method call.
name
- javax.servlet.http.HttpServletRequest#getHeader(String)}
,
javax.portlet.PortletRequest#getProperty(String)}
InputStream getInputStream() throws IOException
java.io.InputStream
of the body of the request as binary data.IOException
javax.servlet.ServletRequest#getInputStream()}
,
javax.portlet.ClientDataRequest#getPortletInputStream()}
void setStatus(int sc)
Note: Portlet runtime doesn't allow a portlet to set the response status code unlike servlet runtime. So, an implementation for portlet runtime may store it as a member without making any impact by itself.
sc
- javax.servlet.http.HttpServletResponse#setStatus(int)}
,
org.apache.portals.applications.webcontent2.portlet.proxy.PortletRequestContext#setStatus(int)}
void sendRedirect(String location) throws IOException
location
- IOException
javax.servlet.http.HttpServletResponse#sendRedirect(String)}
,
javax.portlet.ActionResponse#sendRedirect(String)}
void setHeader(String name, String value)
Note: Portlet runtime doesn't have a method named setHeader(String, String)
unlike servlet runtime.
So, an implementation for portlet runtime may invoke javax.portlet.PortletRequest#setProperty(String, String)
internally
instead because some portlet container implementations such as Apache Jetspeed-2 may return HTTP headers on the method call.
name
- value
- javax.servlet.http.HttpServletResponse#setHeader(String, String)}
,
javax.portlet.PortletResponse#setProperty(String, String)}
void setIntHeader(String name, int value)
Note: Portlet runtime doesn't have a method named setIntHeader(String, int)
unlike servlet runtime.
So, an implementation for portlet runtime may invoke javax.portlet.PortletRequest#setProperty(String, String)
internally
instead because some portlet container implementations such as Apache Jetspeed-2 may return HTTP headers on the method call.
name
- value
- javax.servlet.http.HttpServletResponse#setIntHeader(String, String)}
,
javax.portlet.PortletResponse#setProperty(String, String)}
void addCookie(javax.servlet.http.Cookie cookie)
cookie
- javax.servlet.http.HttpServletResponse#addCookie(Cookie)}
,
javax.portlet.PortletResponse#addProperty(Cookie)}
Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.