public class HTMLEscapingWebContextWrapper extends Object implements WebContext
WebContext
which will return an escaped AggregationState
.ATTRIBUTE_REQUEST_CHARACTER_ENCODING, ATTRIBUTE_REQUEST_URI
APPLICATION_SCOPE, ATTRIBUTE_COMMENT, ATTRIBUTE_EXCEPTION, ATTRIBUTE_MESSAGE, ATTRIBUTE_PATH, ATTRIBUTE_RECURSIVE, ATTRIBUTE_REPOSITORY, ATTRIBUTE_REQUESTOR, ATTRIBUTE_USERNAME, ATTRIBUTE_UUID, ATTRIBUTE_VERSION, ATTRIBUTE_VERSION_MAP, LOCAL_SCOPE, SESSION_SCOPE
Constructor and Description |
---|
HTMLEscapingWebContextWrapper(WebContext original) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
Object |
compute(Object key,
BiFunction remappingFunction) |
Object |
computeIfAbsent(Object key,
Function mappingFunction) |
Object |
computeIfPresent(Object key,
BiFunction remappingFunction) |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry> |
entrySet() |
boolean |
equals(Object o) |
void |
forEach(BiConsumer action) |
Object |
get(Object key) |
AccessManager |
getAccessManager(String name)
Get a an
AccessManager for logical entities. |
AggregationState |
getAggregationState()
Retrieves the Aggregator instance, which gathers all info regarding the current request (paths, etc).
|
<T> T |
getAttribute(String name)
Get attribute value without passing a scope.
|
<T> T |
getAttribute(String name,
int scope)
Get attribute value.
|
Map<String,Object> |
getAttributes()
Get an over all map.
|
Map<String,Object> |
getAttributes(int scope)
Get a map of a attributes set in the scope.
|
String |
getContextPath()
Get the current context path.
|
javax.jcr.Session |
getJCRSession(String workspaceName) |
Locale |
getLocale()
Get the current locale.
|
Messages |
getMessages()
Get the default messages.
|
Messages |
getMessages(String basename)
Get the messages of the named bundle.
|
Object |
getOrDefault(Object key,
Object defaultValue) |
String |
getParameter(String name)
Get a parameter value as string.
|
Map<String,String> |
getParameters()
Get all parameter values as a Map<String, String>.
|
String[] |
getParameterValues(String name)
Get parameter values as string[].
|
MultipartForm |
getPostedForm()
Get form object assembled by
MultipartRequestFilter . |
javax.servlet.http.HttpServletRequest |
getRequest()
Avoid calls to this method wherever possible.
|
javax.servlet.http.HttpServletResponse |
getResponse()
Avoid depending on this as much as possible.
|
javax.servlet.ServletContext |
getServletContext()
Returns the current servlet context.
|
Subject |
getSubject() |
User |
getUser()
If this is not a UserContext this method will very likely return the system user.
|
int |
hashCode() |
void |
include(String path,
Writer out)
Includes/render the given path into the given Writer, by wrapping it in the current HttpServletResponse.
|
void |
init(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.ServletContext servletContext)
Method used to initialize the context.
|
boolean |
isEmpty() |
Set |
keySet() |
Object |
merge(Object key,
Object value,
BiFunction remappingFunction) |
void |
pop() |
void |
push(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
Object |
put(Object key,
Object value) |
void |
putAll(Map m) |
Object |
putIfAbsent(Object key,
Object value) |
void |
release()
Release any resource used by this Context (e.g.
|
Object |
remove(Object key) |
boolean |
remove(Object key,
Object value) |
void |
removeAttribute(String name,
int scope)
Remove an attribute.
|
Object |
replace(Object key,
Object value) |
boolean |
replace(Object key,
Object oldValue,
Object newValue) |
void |
replaceAll(BiFunction function) |
void |
resetAggregationState()
Resets the current aggregator instance.
|
void |
setAttribute(String name,
Object value,
int scope)
Set attribute value, scope of the attribute is defined.
|
void |
setLocale(Locale locale) |
int |
size() |
WebContext |
unwrap() |
Collection |
values() |
public HTMLEscapingWebContextWrapper(WebContext original)
public WebContext unwrap()
WebContext
public void init(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
WebContext
init
in interface WebContext
public AggregationState getAggregationState()
WebContext
getAggregationState
in interface WebContext
HTMLEscapingAggregationState
.public void resetAggregationState()
WebContext
resetAggregationState
in interface WebContext
public MultipartForm getPostedForm()
WebContext
MultipartRequestFilter
.getPostedForm
in interface WebContext
public String getParameter(String name)
WebContext
getParameter
in interface WebContext
public Map<String,String> getParameters()
WebContext
getParameters
in interface WebContext
public String getContextPath()
WebContext
getContextPath
in interface WebContext
public javax.servlet.http.HttpServletRequest getRequest()
WebContext
getRequest
in interface WebContext
public javax.servlet.http.HttpServletResponse getResponse()
WebContext
getResponse
in interface WebContext
public User getUser()
Context
public Subject getSubject()
public void setLocale(Locale locale)
public javax.servlet.ServletContext getServletContext()
WebContext
getServletContext
in interface WebContext
public Locale getLocale()
Context
public javax.jcr.Session getJCRSession(String workspaceName) throws javax.jcr.LoginException, javax.jcr.RepositoryException
javax.jcr.LoginException
javax.jcr.RepositoryException
public void include(String path, Writer out) throws javax.servlet.ServletException, IOException
WebContext
include
in interface WebContext
javax.servlet.ServletException
IOException
ServletRequest.getRequestDispatcher(String)
,
RequestDispatcher.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
public AccessManager getAccessManager(String name)
Context
AccessManager
for logical entities. The accesses to the repository are handled by the repository itself.public void push(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
push
in interface WebContext
public void pop()
pop
in interface WebContext
public void setAttribute(String name, Object value, int scope)
Context
name
- is used as a keyscope
- , highest level of scope from which this attribute is visiblepublic String[] getParameterValues(String name)
WebContext
getParameterValues
in interface WebContext
public <T> T getAttribute(String name, int scope)
Context
name
- to which value is associated toscope
- the scope (request, session, application)public <T> T getAttribute(String name)
Context
name
- to which value is associated topublic Map<String,Object> getAttributes(int scope)
Context
public void removeAttribute(String name, int scope)
Context
public Map<String,Object> getAttributes()
Context
public Messages getMessages()
Context
public Messages getMessages(String basename)
Context
basename
- name of the bundle
TODO: This duplicates methods from MessagesManager : remove eitherpublic void release()
Context
public boolean containsKey(Object key)
containsKey
in interface Map
public boolean containsValue(Object value)
containsValue
in interface Map
public Collection values()
public boolean equals(Object o)
public int hashCode()
public Object getOrDefault(Object key, Object defaultValue)
getOrDefault
in interface Map
public void forEach(BiConsumer action)
public void replaceAll(BiFunction function)
replaceAll
in interface Map
public Object putIfAbsent(Object key, Object value)
putIfAbsent
in interface Map
public Object computeIfAbsent(Object key, Function mappingFunction)
computeIfAbsent
in interface Map
public Object computeIfPresent(Object key, BiFunction remappingFunction)
computeIfPresent
in interface Map
public Object compute(Object key, BiFunction remappingFunction)
Copyright © 2003–2020 Magnolia International Ltd.. All rights reserved.