public interface ServletService extends AppContextService<ServletService>, Contexed
AppContextService
used to access the servlet environment.
This is intended to abstract logic that behaves differently in HttpServlet, Web-service and
Portlet environments. The request/response objects are usually
encapsulated in this object. These should not be exposed in the external interface as
Portlets use different classes from servlets.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_PAYLOAD_PARAM |
Modifier and Type | Method and Description |
---|---|
void |
addErrorProps(java.util.Map props)
Add additional information about the request to the properties of a debugging
error report email.
|
java.lang.String |
defaultCharset()
Return the default charset we want to use.
|
java.lang.String |
encodePage()
un-encoded version of the original request page.
|
java.lang.String |
encodeURL(java.lang.String url)
Add the context path to a url path
|
void |
forward(java.lang.String url)
Forward request to a different page.
|
java.util.LinkedList<java.lang.String> |
getArgs()
Get the ServletPath as a list of strings
A path element of "-" terminates the list.
|
java.lang.Iterable<java.lang.String> |
getAttributeNames() |
java.util.Map<java.lang.String,java.lang.Object> |
getParams()
Extract a Map of the request parameters from the request.
|
java.lang.Object |
getRequestAttribute(java.lang.String name)
Retrieve an object from the current request.
|
default MimeStreamData |
getStreamParam(java.lang.String name) |
default java.lang.String |
getTextParameter(java.lang.String name)
get a named paramter as a string
This should include conversion f uplaoded files etc.
|
java.lang.String |
getWebName()
get the authenticated name for the current user as provided by the
web-server/container authorisation layer.
|
boolean |
isComitted()
Has the response been comitted.
|
void |
noCache()
Identify the current request as containing sensative data that should not be cached.
|
<A extends AppUser> |
populateSession(SessionService<A> sess)
Populate a session automatically using information from the request.
|
void |
redirect(java.lang.String url)
Redirect request to a different page.
|
void |
redirect(java.net.URI uri)
Redirect to an external URI
This is intended for external URLs so session is never encoded
|
<A extends AppUser> |
requestAuthentication(SessionService<A> sess)
Authentication is required for this request but credentials are not available.
|
<A extends AppUser> |
requestLogin(SessionService<A> sess,
java.lang.String page)
Go to the login page to request a login.
|
void |
setRequestAttribute(java.lang.String name,
java.lang.Object value)
Store an object in the current request
|
void |
setTimeout(int seconds)
Set an inactivity timeout if supported
|
getType
cleanup
getContext
static final java.lang.String DEFAULT_PAYLOAD_PARAM
java.lang.String encodePage()
java.lang.String encodeURL(java.lang.String url)
url
- void forward(java.lang.String url) throws ServletException, java.io.IOException
url
- String page to forward to relative to the context pathServletException
java.io.IOException
void redirect(java.lang.String url) throws java.io.IOException
url
- String page to forward to relative to the context pathServletException
java.io.IOException
void redirect(java.net.URI uri) throws java.io.IOException
uri
- java.io.IOException
java.util.Map<java.lang.String,java.lang.Object> getParams()
DataFault
default java.lang.String getTextParameter(java.lang.String name)
name
- default MimeStreamData getStreamParam(java.lang.String name) throws DataFault
DataFault
java.util.LinkedList<java.lang.String> getArgs()
java.lang.String getWebName()
<A extends AppUser> void populateSession(SessionService<A> sess)
ServletSessionService
if a person is requested and
the current person is not stored in the session. It handles authentication mechanisms that don't
use a specific login url.
If the session is not populated here it may trigger a call to requestAuthentication(SessionService)
later.
Any authentication errors could be cached in the request and handled there.sess
- SessionService
<A extends AppUser> void requestAuthentication(SessionService<A> sess) throws java.io.IOException, ServletException
populateSession(SessionService)
. These can be cahce din the request.
The SessionService
is provided as a parameter to be queried for its capabilities.sess
- SessionService
java.io.IOException
ServletException
<A extends AppUser> void requestLogin(SessionService<A> sess, java.lang.String page) throws java.io.IOException, ServletException
A
- sess
- SessionService
page
- page to return tojava.io.IOException
ServletException
java.lang.String defaultCharset()
boolean isComitted()
void addErrorProps(java.util.Map props)
props
- void noCache()
java.lang.Iterable<java.lang.String> getAttributeNames()
void setRequestAttribute(java.lang.String name, java.lang.Object value)
name
- value
- java.lang.Object getRequestAttribute(java.lang.String name)
name
- void setTimeout(int seconds)
seconds
-