public class J2EContext extends Object implements WebContext
| Constructor and Description |
|---|
J2EContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Build a J2E context from the current HTTP request and response.
|
J2EContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
SessionStore sessionStore)
Build a J2E context from the current HTTP request and response.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addResponseCookie(Cookie cookie)
Adds cookies to the response
|
String |
getFullRequestURL()
Return the full URL (with query string) the client used to request the server.
|
String |
getPath()
Get the "servlet path" (in a J2E style).
|
String |
getRemoteAddr()
Return the remote address.
|
javax.servlet.http.HttpServletRequest |
getRequest()
Return the HTTP request.
|
Object |
getRequestAttribute(String name)
Return a request attribute.
|
Collection<Cookie> |
getRequestCookies()
Retrieves request cookies.
|
String |
getRequestHeader(String name)
Return a request header.
|
String |
getRequestMethod()
Return the request method.
|
String |
getRequestParameter(String name)
Return a request parameter.
|
Map<String,String[]> |
getRequestParameters()
Return all request parameters.
|
javax.servlet.http.HttpServletResponse |
getResponse()
Return the HTTP response.
|
String |
getScheme()
Return the scheme.
|
String |
getServerName()
Return the server name.
|
int |
getServerPort()
Return the server port.
|
Object |
getSessionAttribute(String name)
Get an attribute from session.
|
Object |
getSessionIdentifier()
Gets the session id for this context.
|
SessionStore |
getSessionStore() |
boolean |
isSecure()
Return whether the request is secure.
|
void |
setRequestAttribute(String name,
Object value)
Save a request attribute.
|
void |
setResponseContentType(String content)
Sets the response content type.
|
void |
setResponseHeader(String name,
String value)
Add a header to the response.
|
void |
setResponseStatus(int code)
Set the response status.
|
void |
setSessionAttribute(String name,
Object value)
Save an attribute in session.
|
void |
writeResponseContent(String content)
Write some content in the response.
|
public J2EContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
request - the current requestresponse - the current responsepublic J2EContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
SessionStore sessionStore)
request - the current requestresponse - the current responsesessionStore - the session store to usepublic String getRequestParameter(String name)
WebContextgetRequestParameter in interface WebContextname - name of the parameterpublic Object getRequestAttribute(String name)
WebContextgetRequestAttribute in interface WebContextname - the name of the attributepublic void setRequestAttribute(String name, Object value)
WebContextsetRequestAttribute in interface WebContextname - the name of the attributevalue - the attributepublic Map<String,String[]> getRequestParameters()
WebContextgetRequestParameters in interface WebContextpublic String getRequestHeader(String name)
WebContextgetRequestHeader in interface WebContextname - name of the headerpublic void setSessionAttribute(String name, Object value)
WebContextsetSessionAttribute in interface WebContextname - name of the session attributevalue - value of the session attributepublic Object getSessionAttribute(String name)
WebContextgetSessionAttribute in interface WebContextname - name of the session attributepublic Object getSessionIdentifier()
WebContextgetSessionIdentifier in interface WebContextpublic String getRequestMethod()
WebContextgetRequestMethod in interface WebContextpublic String getRemoteAddr()
WebContextgetRemoteAddr in interface WebContextpublic javax.servlet.http.HttpServletRequest getRequest()
public javax.servlet.http.HttpServletResponse getResponse()
public SessionStore getSessionStore()
public void writeResponseContent(String content)
WebContextwriteResponseContent in interface WebContextcontent - content to write in responsepublic void setResponseStatus(int code)
WebContextsetResponseStatus in interface WebContextcode - status code to set for the responsepublic void setResponseHeader(String name, String value)
WebContextsetResponseHeader in interface WebContextname - name of the headervalue - value of the headerpublic void setResponseContentType(String content)
WebContextsetResponseContentType in interface WebContextcontent - the content typepublic String getServerName()
WebContextgetServerName in interface WebContextpublic int getServerPort()
WebContextgetServerPort in interface WebContextpublic String getScheme()
WebContextgetScheme in interface WebContextpublic boolean isSecure()
WebContextisSecure in interface WebContextpublic String getFullRequestURL()
WebContextgetFullRequestURL in interface WebContextpublic Collection<Cookie> getRequestCookies()
WebContextgetRequestCookies in interface WebContextpublic void addResponseCookie(Cookie cookie)
WebContextaddResponseCookie in interface WebContextcookie - a cookie to add to the responsepublic String getPath()
WebContextgetPath in interface WebContextCopyright © 2016. All Rights Reserved.