public class URLPolicyServiceImpl extends Object implements URLPolicyService
Modifier and Type | Field and Description |
---|---|
protected Map<String,URLPatternDescriptor> |
descriptors |
static String |
DOWNLOADFILE_PATTERN |
static String |
NAME |
protected StaticNavigationHandler |
viewIdManager |
DISABLE_ACTION_BINDING_KEY, DISABLE_REDIRECT_REQUEST_KEY, DOCUMENT_VIEW_REQUEST_KEY, FORCE_URL_ENCODING_REQUEST_KEY, POST_OUTCOME_REQUEST_KEY
Constructor and Description |
---|
URLPolicyServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addPatternDescriptor(URLPatternDescriptor pattern) |
void |
appendParametersToRequest(javax.faces.context.FacesContext facesContext)
Appends parameters to request so that the model can be restored after request.
|
void |
appendParametersToRequest(javax.faces.context.FacesContext facesContext,
String pattern) |
void |
applyRequestParameters(javax.faces.context.FacesContext facesContext)
Extracts parameters from request attributes.
|
void |
clear() |
void |
flushCache()
Flushes the URLPolicyService cache, to be called when hot reload is performed for instance.
|
protected URLPatternDescriptor |
getDefaultPatternDescriptor() |
String |
getDefaultPatternName()
Returns the default pattern descriptor name
|
protected static DocumentViewCodecManager |
getDocumentViewCodecService() |
DocumentView |
getDocumentViewFromRequest(javax.servlet.http.HttpServletRequest request)
Builds the document view from request information.
|
DocumentView |
getDocumentViewFromRequest(String patternName,
javax.servlet.http.HttpServletRequest request)
Builds the document view from request information.
|
String |
getOutcomeFromUrl(String url,
javax.servlet.http.HttpServletRequest request)
Returns an outcome given a url, to fill a document view when parsing a standard JSF URL.
|
String |
getOutcomeFromViewId(String viewId,
javax.servlet.http.HttpServletRequest httpRequest)
Returns an outcome given a view id, to fill a document view when parsing a standard JSF URL.
|
protected List<URLPatternDescriptor> |
getSortedURLPatternDescriptorsFor(String viewId)
Deprecated.
since 5.5
|
String |
getUrlFromDocumentView(DocumentView docView,
String baseUrl)
Returns a URL given a document view.
|
String |
getUrlFromDocumentView(String patternName,
DocumentView docView,
String baseUrl)
Returns a URL given a document view.
|
protected URLPatternDescriptor |
getURLPatternDescriptor(DocumentView docView) |
protected URLPatternDescriptor |
getURLPatternDescriptor(javax.servlet.http.HttpServletRequest request) |
protected URLPatternDescriptor |
getURLPatternDescriptor(String patternName) |
protected List<URLPatternDescriptor> |
getURLPatternDescriptors() |
String |
getViewIdFromOutcome(String outcome,
javax.servlet.http.HttpServletRequest httpRequest)
Returns the view id given an outcome, to dispatch to the right view given an outcome.
|
boolean |
hasPattern(String name)
Returns true if the service holds a pattern descriptor with given name
|
void |
initViewIdManager(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Initializes the view id manager
StaticNavigationHandler using the given servlet context. |
boolean |
isCandidateForDecoding(javax.servlet.http.HttpServletRequest httpRequest)
Returns true if request is a GET request and filter preprocessing is turned on.
|
boolean |
isCandidateForEncoding(javax.servlet.http.HttpServletRequest httpRequest)
Returns true if request is a POST request and filter redirection is turned on.
|
String |
navigate(javax.faces.context.FacesContext facesContext)
Performs redirection action.
|
void |
removePatternDescriptor(URLPatternDescriptor pattern) |
void |
setDocumentViewInRequest(javax.servlet.http.HttpServletRequest request,
DocumentView docView)
Adds document view to the request for later retrieval.
|
public static final String DOWNLOADFILE_PATTERN
protected final Map<String,URLPatternDescriptor> descriptors
protected StaticNavigationHandler viewIdManager
public URLPolicyServiceImpl()
protected List<URLPatternDescriptor> getURLPatternDescriptors()
protected URLPatternDescriptor getDefaultPatternDescriptor()
public String getDefaultPatternName()
URLPolicyService
getDefaultPatternName
in interface URLPolicyService
public boolean hasPattern(String name)
URLPolicyService
hasPattern
in interface URLPolicyService
protected static DocumentViewCodecManager getDocumentViewCodecService()
protected URLPatternDescriptor getURLPatternDescriptor(String patternName)
public boolean isCandidateForDecoding(javax.servlet.http.HttpServletRequest httpRequest)
URLPolicyService
isCandidateForDecoding
in interface URLPolicyService
public boolean isCandidateForEncoding(javax.servlet.http.HttpServletRequest httpRequest)
URLPolicyService
isCandidateForEncoding
in interface URLPolicyService
public void setDocumentViewInRequest(javax.servlet.http.HttpServletRequest request, DocumentView docView)
URLPolicyService
setDocumentViewInRequest
in interface URLPolicyService
request
- the current request.docView
- to saveprotected URLPatternDescriptor getURLPatternDescriptor(javax.servlet.http.HttpServletRequest request)
public DocumentView getDocumentViewFromRequest(javax.servlet.http.HttpServletRequest request)
URLPolicyService
Delegates call to a document view codec found thanks to the default URL pattern descriptor.
getDocumentViewFromRequest
in interface URLPolicyService
public DocumentView getDocumentViewFromRequest(String patternName, javax.servlet.http.HttpServletRequest request)
URLPolicyService
Delegates call to a document view codec found thanks given pattern name.
getDocumentViewFromRequest
in interface URLPolicyService
protected URLPatternDescriptor getURLPatternDescriptor(DocumentView docView)
public String getUrlFromDocumentView(DocumentView docView, String baseUrl)
URLPolicyService
Delegates call to a document view codec found thanks to the default URL pattern descriptor.
getUrlFromDocumentView
in interface URLPolicyService
@Deprecated protected List<URLPatternDescriptor> getSortedURLPatternDescriptorsFor(String viewId)
viewId
- public String getUrlFromDocumentView(String patternName, DocumentView docView, String baseUrl)
URLPolicyService
Delegates call to a document view codec found thanks given pattern name.
getUrlFromDocumentView
in interface URLPolicyService
public void applyRequestParameters(javax.faces.context.FacesContext facesContext)
URLPolicyService
Apply them to the model using EL value bindings described on URL pattern descriptors.
We look for binding values to set on the request attribute and on the document view parameters.
applyRequestParameters
in interface URLPolicyService
public void appendParametersToRequest(javax.faces.context.FacesContext facesContext)
URLPolicyService
Extract them using EL value bindings described on URL pattern descriptors.
If the document view is not null, values are set on its parameters. If the document view is null, values are set on the request parameters.
appendParametersToRequest
in interface URLPolicyService
public void appendParametersToRequest(javax.faces.context.FacesContext facesContext, String pattern)
public String navigate(javax.faces.context.FacesContext facesContext)
URLPolicyService
Extract it using an EL action binding described on URL pattern descriptors.
The action binding is called using given document view as parameter. If a sub URI is found, do nothing (may be an invalid resource URL).
navigate
in interface URLPolicyService
public void addPatternDescriptor(URLPatternDescriptor pattern)
addPatternDescriptor
in interface URLPolicyService
public void removePatternDescriptor(URLPatternDescriptor pattern)
removePatternDescriptor
in interface URLPolicyService
public void initViewIdManager(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
URLPolicyService
StaticNavigationHandler
using the given servlet context.initViewIdManager
in interface URLPolicyService
public String getOutcomeFromViewId(String viewId, javax.servlet.http.HttpServletRequest httpRequest)
URLPolicyService
For instance, will return "view_documents" given "/view_documents.xhtml" or "/view_documents.faces".
getOutcomeFromViewId
in interface URLPolicyService
public String getOutcomeFromUrl(String url, javax.servlet.http.HttpServletRequest request)
URLPolicyService
It parses the given url to extract the outcome, and then calls
URLPolicyService.getOutcomeFromViewId(String, HttpServletRequest)
getOutcomeFromUrl
in interface URLPolicyService
public String getViewIdFromOutcome(String outcome, javax.servlet.http.HttpServletRequest httpRequest)
URLPolicyService
For instance, will return "/view_documents.xhtml" given "view_documents".
getViewIdFromOutcome
in interface URLPolicyService
public void clear()
clear
in interface URLPolicyService
public void flushCache()
URLPolicyService
flushCache
in interface URLPolicyService
Copyright © 2015 Nuxeo SA. All rights reserved.