Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.ui.web.rest.services
Class URLPolicyServiceImpl

java.lang.Object
  extended by org.nuxeo.ecm.platform.ui.web.rest.services.URLPolicyServiceImpl
All Implemented Interfaces:
URLPolicyService

public class URLPolicyServiceImpl
extends Object
implements URLPolicyService


Field Summary
static String NAME
           
 
Fields inherited from interface org.nuxeo.ecm.platform.ui.web.rest.api.URLPolicyService
DISABLE_REDIRECT_REQUEST_KEY, DOCUMENT_VIEW_REQUEST_KEY, FORCE_URL_ENCODING_REQUEST_KEY, POST_OUTCOME_REQUEST_KEY
 
Constructor Summary
URLPolicyServiceImpl()
           
 
Method Summary
 void addPatternDescriptor(URLPatternDescriptor pattern)
           
 void appendParametersToRequest(FacesContext facesContext)
          Appends parameters to request so that the model can be restored after request.
 void appendParametersToRequest(FacesContext facesContext, String pattern)
           
 void applyRequestParameters(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.
 String getDefaultPatternName()
          Returns the default pattern descriptor name
 DocumentView getDocumentViewFromRequest(HttpServletRequest request)
          Builds the document view from request information.
 DocumentView getDocumentViewFromRequest(String patternName, HttpServletRequest request)
          Builds the document view from request information.
 String getOutcomeFromUrl(String url, HttpServletRequest request)
          Returns an outcome given a url, to fill a document view when parsing a standard JSF URL.
 String getOutcomeFromViewId(String viewId, 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.
 String getViewIdFromOutcome(String outcome, 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(ServletContext context)
          Initializes the view id manager StaticNavigationHandler using the given servlet context.
 boolean isCandidateForDecoding(HttpServletRequest httpRequest)
          Returns true if request is a GET request and filter preprocessing is turned on.
 boolean isCandidateForEncoding(HttpServletRequest httpRequest)
          Returns true if request is a POST request and filter redirection is turned on.
 String navigate(FacesContext facesContext)
          Performs redirection action.
 void removePatternDescriptor(URLPatternDescriptor pattern)
           
 void setDocumentViewInRequest(HttpServletRequest request, DocumentView docView)
          Adds document view to the request for later retrieval.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
Constructor Detail

URLPolicyServiceImpl

public URLPolicyServiceImpl()
Method Detail

getDefaultPatternName

public String getDefaultPatternName()
Description copied from interface: URLPolicyService
Returns the default pattern descriptor name

Specified by:
getDefaultPatternName in interface URLPolicyService

hasPattern

public boolean hasPattern(String name)
Description copied from interface: URLPolicyService
Returns true if the service holds a pattern descriptor with given name

Specified by:
hasPattern in interface URLPolicyService

isCandidateForDecoding

public boolean isCandidateForDecoding(HttpServletRequest httpRequest)
Description copied from interface: URLPolicyService
Returns true if request is a GET request and filter preprocessing is turned on.

Specified by:
isCandidateForDecoding in interface URLPolicyService

isCandidateForEncoding

public boolean isCandidateForEncoding(HttpServletRequest httpRequest)
Description copied from interface: URLPolicyService
Returns true if request is a POST request and filter redirection is turned on.

Specified by:
isCandidateForEncoding in interface URLPolicyService

setDocumentViewInRequest

public void setDocumentViewInRequest(HttpServletRequest request,
                                     DocumentView docView)
Description copied from interface: URLPolicyService
Adds document view to the request for later retrieval.

Specified by:
setDocumentViewInRequest in interface URLPolicyService
Parameters:
request - the current request.
docView - to save

getDocumentViewFromRequest

public DocumentView getDocumentViewFromRequest(HttpServletRequest request)
Description copied from interface: URLPolicyService
Builds the document view from request information.

Delegates call to a document view codec found thanks to the default URL pattern descriptor.

Specified by:
getDocumentViewFromRequest in interface URLPolicyService

getDocumentViewFromRequest

public DocumentView getDocumentViewFromRequest(String patternName,
                                               HttpServletRequest request)
Description copied from interface: URLPolicyService
Builds the document view from request information.

Delegates call to a document view codec found thanks given pattern name.

Specified by:
getDocumentViewFromRequest in interface URLPolicyService

getUrlFromDocumentView

public String getUrlFromDocumentView(DocumentView docView,
                                     String baseUrl)
Description copied from interface: URLPolicyService
Returns a URL given a document view.

Delegates call to a document view codec found thanks to the default URL pattern descriptor.

Specified by:
getUrlFromDocumentView in interface URLPolicyService

getUrlFromDocumentView

public String getUrlFromDocumentView(String patternName,
                                     DocumentView docView,
                                     String baseUrl)
Description copied from interface: URLPolicyService
Returns a URL given a document view.

Delegates call to a document view codec found thanks given pattern name.

Specified by:
getUrlFromDocumentView in interface URLPolicyService

applyRequestParameters

public void applyRequestParameters(FacesContext facesContext)
Description copied from interface: URLPolicyService
Extracts parameters from request attributes.

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.

Specified by:
applyRequestParameters in interface URLPolicyService

appendParametersToRequest

public void appendParametersToRequest(FacesContext facesContext)
Description copied from interface: URLPolicyService
Appends parameters to request so that the model can be restored after request.

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.

Specified by:
appendParametersToRequest in interface URLPolicyService

appendParametersToRequest

public void appendParametersToRequest(FacesContext facesContext,
                                      String pattern)

navigate

public String navigate(FacesContext facesContext)
Description copied from interface: URLPolicyService
Performs redirection action.

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).

Specified by:
navigate in interface URLPolicyService

addPatternDescriptor

public void addPatternDescriptor(URLPatternDescriptor pattern)
Specified by:
addPatternDescriptor in interface URLPolicyService

removePatternDescriptor

public void removePatternDescriptor(URLPatternDescriptor pattern)
Specified by:
removePatternDescriptor in interface URLPolicyService

initViewIdManager

public void initViewIdManager(ServletContext context)
Description copied from interface: URLPolicyService
Initializes the view id manager StaticNavigationHandler using the given servlet context.

Specified by:
initViewIdManager in interface URLPolicyService

getOutcomeFromViewId

public String getOutcomeFromViewId(String viewId,
                                   HttpServletRequest httpRequest)
Description copied from interface: URLPolicyService
Returns an outcome given a view id, to fill a document view when parsing a standard JSF URL.

For instance, will return "view_documents" given "/view_documents.xhtml" or "/view_documents.faces".

Specified by:
getOutcomeFromViewId in interface URLPolicyService

getOutcomeFromUrl

public String getOutcomeFromUrl(String url,
                                HttpServletRequest request)
Description copied from interface: URLPolicyService
Returns an outcome given a url, to fill a document view when parsing a standard JSF URL.

It parses the given url to extract the outcome, and then calls URLPolicyService.getOutcomeFromViewId(String, HttpServletRequest)

Specified by:
getOutcomeFromUrl in interface URLPolicyService

getViewIdFromOutcome

public String getViewIdFromOutcome(String outcome,
                                   HttpServletRequest httpRequest)
Description copied from interface: URLPolicyService
Returns the view id given an outcome, to dispatch to the right view given an outcome.

For instance, will return "/view_documents.xhtml" given "view_documents".

Specified by:
getViewIdFromOutcome in interface URLPolicyService

clear

public void clear()
Specified by:
clear in interface URLPolicyService

flushCache

public void flushCache()
Description copied from interface: URLPolicyService
Flushes the URLPolicyService cache, to be called when hot reload is performed for instance.

Specified by:
flushCache in interface URLPolicyService

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.