public interface WebContext
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.
|
Object |
getRequestAttribute(String name)
Return a request attribute.
|
default String |
getRequestContent()
Gets content body of the original request.
|
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.
|
String |
getScheme()
Return the scheme.
|
String |
getServerName()
Return the server name.
|
int |
getServerPort()
Return the server port.
|
default Object |
getSessionAttribute(String name)
Get an attribute from session.
|
default String |
getSessionIdentifier()
Gets the session id for this context.
|
SessionStore |
getSessionStore()
Get the session store.
|
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.
|
default void |
setSessionAttribute(String name,
Object value)
Save an attribute in session.
|
void |
setSessionStore(SessionStore sessionStore)
Deprecated.
|
void |
writeResponseContent(String content)
Write some content in the response.
|
SessionStore getSessionStore()
@Deprecated void setSessionStore(SessionStore sessionStore)
sessionStore
- the session storeString getRequestParameter(String name)
name
- name of the parameterMap<String,String[]> getRequestParameters()
Object getRequestAttribute(String name)
name
- the name of the attributevoid setRequestAttribute(String name, Object value)
name
- the name of the attributevalue
- the attributeString getRequestHeader(String name)
name
- name of the headerdefault void setSessionAttribute(String name, Object value)
name
- name of the session attributevalue
- value of the session attributedefault Object getSessionAttribute(String name)
name
- name of the session attributedefault String getSessionIdentifier()
String getRequestMethod()
String getRemoteAddr()
void writeResponseContent(String content)
content
- content to write in responsevoid setResponseStatus(int code)
code
- status code to set for the responsevoid setResponseHeader(String name, String value)
name
- name of the headervalue
- value of the headervoid setResponseContentType(String content)
content
- the content typeString getServerName()
int getServerPort()
String getScheme()
boolean isSecure()
String getFullRequestURL()
Collection<Cookie> getRequestCookies()
void addResponseCookie(Cookie cookie)
cookie
- a cookie to add to the responseString getPath()
default String getRequestContent()
Copyright © 2018. All rights reserved.