Class RequestConfigDecorator
- java.lang.Object
-
- de.cuioss.test.jsf.config.decorator.RequestConfigDecorator
-
public class RequestConfigDecorator extends Object
Helper class for configuring the request- Author:
- Oliver Wolff
-
-
Constructor Summary
Constructors Constructor Description RequestConfigDecorator(org.apache.myfaces.test.mock.MockFacesContext22 facesContext, org.apache.myfaces.test.mock.MockExternalContext22 externalContext)
-
Method Summary
-
-
-
Constructor Detail
-
RequestConfigDecorator
public RequestConfigDecorator(org.apache.myfaces.test.mock.MockFacesContext22 facesContext, org.apache.myfaces.test.mock.MockExternalContext22 externalContext)
-
-
Method Detail
-
setPostback
public RequestConfigDecorator setPostback(boolean postback)
Sets the postback attribute toFacesContext.isPostback()- Parameters:
postback- to be set- Returns:
- the
RequestConfigDecoratoritself in order to enable a fluent-api style usage
-
setViewId
public RequestConfigDecorator setViewId(String viewId)
Sets the viewId inUIViewRoot- Parameters:
viewId- to be set- Returns:
- the
RequestConfigDecoratoritself in order to enable a fluent-api style usage
-
setRequestHeader
public RequestConfigDecorator setRequestHeader(String key, String value)
Registers a concrete RequestHeader toExternalContext.getRequestHeaderMap()- Parameters:
key- used as the key for theExternalContext.getRequestHeaderMap()value- used as the value for theExternalContext.getRequestHeaderMap()- Returns:
- the
RequestConfigDecoratoritself in order to enable a fluent-api style usage
-
setRequestParameter
public RequestConfigDecorator setRequestParameter(String key, String value)
Registers a concrete Request-parameter toExternalContext.getRequestParameterMap()- Parameters:
key- used as the key for theExternalContext.getRequestHeaderMap()value- used as the value for theExternalContext.getRequestHeaderMap()- Returns:
- the
RequestConfigDecoratoritself in order to enable a fluent-api style usage
-
setRequestAttribute
public RequestConfigDecorator setRequestAttribute(String key, Serializable value)
Registers a concrete Request-attribute toServletRequest.setAttribute(String, Object)- Parameters:
key- used as the key for theServletRequest.setAttribute(String, Object)value- used as the value for theServletRequest.setAttribute(String, Object)- Returns:
- the
RequestConfigDecoratoritself in order to enable a fluent-api style usage
-
addRequestCookie
public RequestConfigDecorator addRequestCookie(Cookie... cookie)
Registers one or more cookies the the contained request- Parameters:
cookie- to be added- Returns:
- the
RequestConfigDecoratoritself in order to enable a fluent-api style usage
-
setRequestLocale
public RequestConfigDecorator setRequestLocale(Locale... requestLocale)
Registers one or more requestLocale to
Caution: It expects theExternalContext.getRequestLocales(). It can be used for resetting the locales as well.HttpServletRequestbeing an instance ofCuiMockHttpServletRequest- Parameters:
requestLocale- one or more requestLocales to be set- Returns:
- the
RequestConfigDecoratoritself in order to enable a fluent-api style usage
-
setQueryString
public void setQueryString(String parameterString)
Explicitly sets a given queryString as path-element of the request- Parameters:
parameterString-
-
-