Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.ui.web.rest.api
Interface URLPolicyService

All Known Implementing Classes:
URLPolicyServiceImpl

public interface URLPolicyService

Service used on the web layer to handle navigation using meaningful URLs.

It handles a document context description, and also performs JSF model related operations.

It holds pattern descriptors used to interact with the DocumentViewCodecManager.

Author:
Anahide Tchertchian

Field Summary
static String DISABLE_REDIRECT_REQUEST_KEY
          Deprecated. 
static String DOCUMENT_VIEW_REQUEST_KEY
           
static String FORCE_URL_ENCODING_REQUEST_KEY
           
static String POST_OUTCOME_REQUEST_KEY
           
 
Method Summary
 void addPatternDescriptor(URLPatternDescriptor pattern)
           
 void appendParametersToRequest(FacesContext facesContext)
          Appends parameters to request so that the model can be restored after request.
 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 pattern, HttpServletRequest request)
          Builds the document view from request information.
 String getOutcomeFromUrl(String url, HttpServletRequest httpRequest)
          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 pattern, 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 context)
          Performs redirection action.
 void removePatternDescriptor(URLPatternDescriptor pattern)
           
 void setDocumentViewInRequest(HttpServletRequest request, DocumentView docView)
          Adds document view to the request for later retrieval.
 

Field Detail

POST_OUTCOME_REQUEST_KEY

static final String POST_OUTCOME_REQUEST_KEY
See Also:
Constant Field Values

DOCUMENT_VIEW_REQUEST_KEY

static final String DOCUMENT_VIEW_REQUEST_KEY
See Also:
Constant Field Values

DISABLE_REDIRECT_REQUEST_KEY

@Deprecated
static final String DISABLE_REDIRECT_REQUEST_KEY
Deprecated. 
See Also:
Constant Field Values

FORCE_URL_ENCODING_REQUEST_KEY

static final String FORCE_URL_ENCODING_REQUEST_KEY
See Also:
Constant Field Values
Method Detail

isCandidateForDecoding

boolean isCandidateForDecoding(HttpServletRequest httpRequest)
Returns true if request is a GET request and filter preprocessing is turned on.


isCandidateForEncoding

boolean isCandidateForEncoding(HttpServletRequest httpRequest)
Returns true if request is a POST request and filter redirection is turned on.


setDocumentViewInRequest

void setDocumentViewInRequest(HttpServletRequest request,
                              DocumentView docView)
Adds document view to the request for later retrieval.

Parameters:
request - the current request.
docView - to save

getDocumentViewFromRequest

DocumentView getDocumentViewFromRequest(HttpServletRequest request)
Builds the document view from request information.

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


getDocumentViewFromRequest

DocumentView getDocumentViewFromRequest(String pattern,
                                        HttpServletRequest request)
Builds the document view from request information.

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


getUrlFromDocumentView

String getUrlFromDocumentView(DocumentView docView,
                              String baseUrl)
Returns a URL given a document view.

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


getUrlFromDocumentView

String getUrlFromDocumentView(String pattern,
                              DocumentView docView,
                              String baseUrl)
Returns a URL given a document view.

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


applyRequestParameters

void applyRequestParameters(FacesContext facesContext)
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.


appendParametersToRequest

void appendParametersToRequest(FacesContext facesContext)
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.


navigate

String navigate(FacesContext context)
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).


getDefaultPatternName

String getDefaultPatternName()
Returns the default pattern descriptor name


hasPattern

boolean hasPattern(String name)
Returns true if the service holds a pattern descriptor with given name

Since:
5.4.3

addPatternDescriptor

void addPatternDescriptor(URLPatternDescriptor pattern)

removePatternDescriptor

void removePatternDescriptor(URLPatternDescriptor pattern)

clear

void clear()

initViewIdManager

void initViewIdManager(ServletContext context)
Initializes the view id manager StaticNavigationHandler using the given servlet context.

Since:
5.4.3

getViewIdFromOutcome

String getViewIdFromOutcome(String outcome,
                            HttpServletRequest httpRequest)
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".

Since:
5.4.3

getOutcomeFromViewId

String getOutcomeFromViewId(String viewId,
                            HttpServletRequest httpRequest)
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".

Since:
5.4.3

getOutcomeFromUrl

String getOutcomeFromUrl(String url,
                         HttpServletRequest httpRequest)
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 getOutcomeFromViewId(String, HttpServletRequest)

Since:
5.4.3

flushCache

void flushCache()
Flushes the URLPolicyService cache, to be called when hot reload is performed for instance.

Since:
5.4.3

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.