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. 
 | 
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()
URLPolicyServicegetDefaultPatternName in interface URLPolicyServicepublic boolean hasPattern(String name)
URLPolicyServicehasPattern in interface URLPolicyServiceprotected static DocumentViewCodecManager getDocumentViewCodecService()
protected URLPatternDescriptor getURLPatternDescriptor(String patternName)
public boolean isCandidateForDecoding(javax.servlet.http.HttpServletRequest httpRequest)
URLPolicyServiceisCandidateForDecoding in interface URLPolicyServicepublic boolean isCandidateForEncoding(javax.servlet.http.HttpServletRequest httpRequest)
URLPolicyServiceisCandidateForEncoding in interface URLPolicyServicepublic void setDocumentViewInRequest(javax.servlet.http.HttpServletRequest request, DocumentView docView)
URLPolicyServicesetDocumentViewInRequest in interface URLPolicyServicerequest - the current request.docView - to saveprotected URLPatternDescriptor getURLPatternDescriptor(javax.servlet.http.HttpServletRequest request)
public DocumentView getDocumentViewFromRequest(javax.servlet.http.HttpServletRequest request)
URLPolicyServiceDelegates call to a document view codec found thanks to the default URL pattern descriptor.
getDocumentViewFromRequest in interface URLPolicyServicepublic DocumentView getDocumentViewFromRequest(String patternName, javax.servlet.http.HttpServletRequest request)
URLPolicyServiceDelegates call to a document view codec found thanks given pattern name.
getDocumentViewFromRequest in interface URLPolicyServiceprotected URLPatternDescriptor getURLPatternDescriptor(DocumentView docView)
public String getUrlFromDocumentView(DocumentView docView, String baseUrl)
URLPolicyServiceDelegates call to a document view codec found thanks to the default URL pattern descriptor.
getUrlFromDocumentView in interface URLPolicyServicepublic String getUrlFromDocumentView(String patternName, DocumentView docView, String baseUrl)
URLPolicyServiceDelegates call to a document view codec found thanks given pattern name.
getUrlFromDocumentView in interface URLPolicyServicepublic void applyRequestParameters(javax.faces.context.FacesContext facesContext)
URLPolicyServiceApply 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 URLPolicyServicepublic void appendParametersToRequest(javax.faces.context.FacesContext facesContext)
URLPolicyServiceExtract 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 URLPolicyServicepublic void appendParametersToRequest(javax.faces.context.FacesContext facesContext, String pattern)
public String navigate(javax.faces.context.FacesContext facesContext)
URLPolicyServiceExtract 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 URLPolicyServicepublic void addPatternDescriptor(URLPatternDescriptor pattern)
addPatternDescriptor in interface URLPolicyServicepublic void removePatternDescriptor(URLPatternDescriptor pattern)
removePatternDescriptor in interface URLPolicyServicepublic void initViewIdManager(javax.servlet.ServletContext context, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
URLPolicyServiceStaticNavigationHandler using the given servlet context.initViewIdManager in interface URLPolicyServicepublic String getOutcomeFromViewId(String viewId, javax.servlet.http.HttpServletRequest httpRequest)
URLPolicyServiceFor instance, will return "view_documents" given "/view_documents.xhtml" or "/view_documents.faces".
getOutcomeFromViewId in interface URLPolicyServicepublic 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 URLPolicyServicepublic String getViewIdFromOutcome(String outcome, javax.servlet.http.HttpServletRequest httpRequest)
URLPolicyServiceFor instance, will return "/view_documents.xhtml" given "view_documents".
getViewIdFromOutcome in interface URLPolicyServicepublic void clear()
clear in interface URLPolicyServicepublic void flushCache()
URLPolicyServiceflushCache in interface URLPolicyServiceCopyright © 2019 Nuxeo. All rights reserved.