|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.ServletRequestWrapper
javax.servlet.http.HttpServletRequestWrapper
org.loom.servlet.LoomServletRequestImpl
public class LoomServletRequestImpl
The real request is always wrapped inside one of these. This objects wraps all the attributes required by Loom at any time, with special attention to:
Field Summary |
---|
Fields inherited from interface javax.servlet.http.HttpServletRequest |
---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Method Summary | |
---|---|
void |
addFileParameter(java.lang.String name,
FileParameter value)
Add an uploaded file parameter |
void |
addStringParameter(java.lang.String name,
java.lang.String value)
Add a String parameter |
static void |
clearThreadLocal()
Clear the request bound to this Thread, to avoid memory leaks |
UrlBuilder |
createUrl()
Creates a new empty UrlBuilder |
UrlBuilder |
createUrl(java.lang.Class<? extends Action> actionClass,
java.lang.String event)
Creates a new UrlBuilder pointing to the provided action and event |
UrlBuilder |
createUrl(java.lang.String url)
Creates a new UrlBuilder pointing to the provided raw url |
java.lang.String |
generateId(java.lang.String prefix)
Generates a valid HTML id starting with prefix. |
java.lang.String |
generateIndex(java.lang.String name)
Generate a correlative index for the field passed as argument, in the form: field[0], field[1], etc. |
ActionMappingRepository |
getActionMappingRepository()
|
boolean |
getAttributeAsBoolean(java.lang.String attributeName)
|
BrowserData |
getBrowserData()
|
javax.servlet.http.Cookie |
getCookie(java.lang.String cookieName)
|
FormTag |
getCurrentForm()
TODO: this method should be moved elsewhere |
FileParameter |
getFileParameter(java.lang.String name)
|
HttpMethod |
getHttpMethod()
|
java.util.Locale |
getLocale()
|
MessagesRepository |
getMessagesRepository()
|
java.lang.String |
getMethod()
|
FlashContext |
getNextFlashContext(boolean create)
Return the flash-scoped context with objects persisted for the NEXT browser request. |
java.lang.String |
getParameter(java.lang.String name)
|
java.util.Enumeration<java.lang.String> |
getParameterNames()
|
ParsedAction |
getParsedAction()
|
FlashContext |
getPreviousFlashContext()
Return the flash-scoped context with objects persisted from the PREVIOUS browser request. |
ServletRequestParameters |
getRequestParameters()
|
java.lang.String |
getRequestUrlWithParameters()
Returns the full url including query parameters, protocol, server and port. |
java.lang.Object |
getScopedAttribute(java.lang.String name,
Scope... scopes)
Get a scoped attribute |
java.lang.String |
getStringParameter(java.lang.String name)
|
static LoomServletRequest |
getThreadLocal()
Note that this method does not come for free. |
boolean |
isAjax()
Return true if the current request has been launched using Ajax. |
void |
removeScopedAttribute(java.lang.String name,
Scope scope)
Remove a scoped atribute |
void |
setCurrentForm(FormTag currentForm)
|
void |
setLocale(java.util.Locale locale)
|
protected void |
setMessagesRepository(MessagesRepository messagesRepository)
|
void |
setParsedAction(ParsedAction parsedAction)
|
void |
setScopedAttribute(java.lang.String name,
java.lang.Object value,
Scope scope)
Create a scoped atribute |
static void |
setThreadLocalImpl(java.lang.ThreadLocal<LoomServletRequest> threadLocalImpl)
Change the ThreadLocal implementation |
java.lang.String |
toString()
Do NOT rely on this class format to do anything important, since this format is very likely to change in the future |
UrlBuilder |
toUrlBuilder()
Create a UrlBuilder instance with the same action/event/rawUrl and all the parameters
included in this request instance. |
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper |
---|
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole |
Methods inherited from class javax.servlet.ServletRequestWrapper |
---|
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocales, getLocalName, getLocalPort, getParameterMap, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.servlet.http.HttpServletRequest |
---|
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole |
Methods inherited from interface javax.servlet.ServletRequest |
---|
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocales, getLocalName, getLocalPort, getParameterMap, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding |
Method Detail |
---|
public java.lang.String getMethod()
getMethod
in interface javax.servlet.http.HttpServletRequest
getMethod
in class javax.servlet.http.HttpServletRequestWrapper
public HttpMethod getHttpMethod()
getHttpMethod
in interface LoomServletRequest
public java.util.Locale getLocale()
getLocale
in interface javax.servlet.ServletRequest
getLocale
in class javax.servlet.ServletRequestWrapper
public ServletRequestParameters getRequestParameters()
getRequestParameters
in interface LoomServletRequest
ServletRequestParameters
instance with all file upload parameters and
plain parameters in a single map.public java.lang.String getStringParameter(java.lang.String name)
getStringParameter
in interface LoomServletRequest
public FileParameter getFileParameter(java.lang.String name)
getFileParameter
in interface LoomServletRequest
public java.lang.String getParameter(java.lang.String name)
getParameter
in interface javax.servlet.ServletRequest
getParameter
in class javax.servlet.ServletRequestWrapper
public java.util.Enumeration<java.lang.String> getParameterNames()
getParameterNames
in interface javax.servlet.ServletRequest
getParameterNames
in class javax.servlet.ServletRequestWrapper
public static void clearThreadLocal()
public static LoomServletRequest getThreadLocal()
public static void setThreadLocalImpl(java.lang.ThreadLocal<LoomServletRequest> threadLocalImpl)
threadLocalImpl
- one of ThreadLocal or InheritedThreadLocalpublic void addFileParameter(java.lang.String name, FileParameter value)
LoomServletRequest
addFileParameter
in interface LoomServletRequest
name
- the file parameter namevalue
- the uploaded file to add to this requestpublic void addStringParameter(java.lang.String name, java.lang.String value)
LoomServletRequest
addStringParameter
in interface LoomServletRequest
name
- the name of the parametervalue
- the value of the parameterpublic MessagesRepository getMessagesRepository()
getMessagesRepository
in interface LoomServletRequest
public ParsedAction getParsedAction()
getParsedAction
in interface LoomServletRequest
public void setParsedAction(ParsedAction parsedAction)
protected void setMessagesRepository(MessagesRepository messagesRepository)
public FormTag getCurrentForm()
LoomServletRequest
getCurrentForm
in interface LoomServletRequest
public void setCurrentForm(FormTag currentForm)
setCurrentForm
in interface LoomServletRequest
public java.lang.String generateId(java.lang.String prefix)
LoomServletRequest
generateId
in interface LoomServletRequest
prefix
- the prefix to use to generate the id
public java.lang.String generateIndex(java.lang.String name)
LoomServletRequest
generateIndex
in interface LoomServletRequest
public javax.servlet.http.Cookie getCookie(java.lang.String cookieName)
getCookie
in interface LoomServletRequest
cookieName
- the name of the cookie
public java.lang.String getRequestUrlWithParameters()
LoomServletRequest
getRequestUrlWithParameters
in interface LoomServletRequest
public UrlBuilder toUrlBuilder()
LoomServletRequest
UrlBuilder
instance with the same action/event/rawUrl and all the parameters
included in this request instance. Any file parameters will be lost.
toUrlBuilder
in interface LoomServletRequest
UrlBuilder
instance.public boolean isAjax()
LoomServletRequest
isAjax
in interface LoomServletRequest
public void setLocale(java.util.Locale locale)
public boolean getAttributeAsBoolean(java.lang.String attributeName)
getAttributeAsBoolean
in interface LoomServletRequest
public void setScopedAttribute(java.lang.String name, java.lang.Object value, Scope scope)
LoomServletRequest
setScopedAttribute
in interface LoomServletRequest
name
- the attribute namevalue
- the valuescope
- the scope of the attribute. Scope.PAGE is not allowed.public void removeScopedAttribute(java.lang.String name, Scope scope)
LoomServletRequest
removeScopedAttribute
in interface LoomServletRequest
name
- the attribute namescope
- the scope of the attribute. Scope.PAGE is not allowed.public java.lang.Object getScopedAttribute(java.lang.String name, Scope... scopes)
LoomServletRequest
getScopedAttribute
in interface LoomServletRequest
name
- the attribute namescopes
- the list of scopes to inspect, null for all. Scope.PAGE is not allowed.public FlashContext getNextFlashContext(boolean create)
LoomServletRequest
getNextFlashContext
in interface LoomServletRequest
create
- if true, create the flash context if it does not yet exist.public FlashContext getPreviousFlashContext()
LoomServletRequest
getPreviousFlashContext
in interface LoomServletRequest
public java.lang.String toString()
toString
in class java.lang.Object
public UrlBuilder createUrl()
LoomServletRequest
UrlBuilder
createUrl
in interface LoomServletRequest
public UrlBuilder createUrl(java.lang.Class<? extends Action> actionClass, java.lang.String event)
LoomServletRequest
UrlBuilder
pointing to the provided action and event
createUrl
in interface LoomServletRequest
public UrlBuilder createUrl(java.lang.String url)
LoomServletRequest
UrlBuilder
pointing to the provided raw url
createUrl
in interface LoomServletRequest
public BrowserData getBrowserData()
getBrowserData
in interface LoomServletRequest
public ActionMappingRepository getActionMappingRepository()
getActionMappingRepository
in interface LoomServletRequest
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |