Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.platform.ui.web.rest
Class RestHelper

java.lang.Object
  extended by org.nuxeo.ecm.platform.ui.web.rest.RestHelper
All Implemented Interfaces:
Serializable

@Name(value="restHelper")
@Scope(value=EVENT)
public class RestHelper
extends Object
implements Serializable

Helper for generation of URLs and related update of document context.

Author:
tiry, Anahide Tchertchian, Florent Guillaume
See Also:
Serialized Form

Constructor Summary
RestHelper()
           
 
Method Summary
static String addCurrentConversationParameters(String url)
          Adds current conversation request parameters to the given url.
static String addMainConversationParameters(String url)
          Adds main conversation request parameters to the given url.
 String doPrint(DocumentModel doc, String defaultTheme)
           
 String doPrint(String defaultTheme)
           
 String getBaseURL()
           
 String getContextPath()
           
static Manager getConversationManager()
           
 String getDocumentUrl(DocumentModel doc)
           
 String getDocumentUrl(DocumentModel doc, String viewId, boolean newConversation)
           
 String getDocumentUrl(String patternName, DocumentModel doc, String viewId, Map<String,String> parameters, boolean newConversation)
           
 DocumentView getDocumentView()
           
static HttpServletRequest getHttpServletRequest()
           
static HttpServletResponse getHttpServletResponse()
           
 String getLocaleString()
          Returns the locale string.
 DocumentView getNewDocumentView()
           
 String getPrintUrl(DocumentModel doc, String defaultTheme)
           
 String getPrintUrl(String defaultTheme)
           
static void handleRedirect(HttpServletResponse response, String url)
           
 String initContextFromRestRequest(DocumentView docView)
          Sets current server location (core repository) and core document as provided by the document view.
 void setDocumentView(DocumentView docView)
           
 void setLocaleString(String localeString)
          Sets the locale string if given string is not null and not empty.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestHelper

public RestHelper()
Method Detail

initContextFromRestRequest

@Begin(id="#{conversationIdGenerator.currentOrNewMainConversationId}",
       join=true)
public String initContextFromRestRequest(DocumentView docView)
                                  throws ClientException
Sets current server location (core repository) and core document as provided by the document view.

Only sets current server location if the document reference is null.

Throws:
ClientException

setDocumentView

public void setDocumentView(DocumentView docView)

getNewDocumentView

public DocumentView getNewDocumentView()

getDocumentView

public DocumentView getDocumentView()

getConversationManager

public static Manager getConversationManager()
Returns:
the Seam conversation manager.

addCurrentConversationParameters

public static String addCurrentConversationParameters(String url)
Adds current conversation request parameters to the given url.

Parameters:
url -
Returns:
the url with additional conversation request parameters

addMainConversationParameters

public static String addMainConversationParameters(String url)
Adds main conversation request parameters to the given url.

Parameters:
url -
Returns:
the url with additional conversation request parameters

getDocumentUrl

public String getDocumentUrl(DocumentModel doc)

getDocumentUrl

public String getDocumentUrl(DocumentModel doc,
                             String viewId,
                             boolean newConversation)

getDocumentUrl

public String getDocumentUrl(String patternName,
                             DocumentModel doc,
                             String viewId,
                             Map<String,String> parameters,
                             boolean newConversation)

getBaseURL

@Factory(value="baseURL",
         scope=CONVERSATION)
public String getBaseURL()

getContextPath

@Factory(value="contextPath",
         scope=CONVERSATION)
public String getContextPath()

doPrint

public String doPrint(String defaultTheme)
               throws IOException
Throws:
IOException

doPrint

public String doPrint(DocumentModel doc,
                      String defaultTheme)
               throws IOException
Throws:
IOException

getPrintUrl

public String getPrintUrl(String defaultTheme)

getPrintUrl

public String getPrintUrl(DocumentModel doc,
                          String defaultTheme)

getHttpServletResponse

public static HttpServletResponse getHttpServletResponse()

getHttpServletRequest

public static HttpServletRequest getHttpServletRequest()

handleRedirect

public static void handleRedirect(HttpServletResponse response,
                                  String url)
                           throws IOException
Throws:
IOException

getLocaleString

public String getLocaleString()
Returns the locale string.

Useful for url pattern bindings.

Since:
5.4.2

setLocaleString

public void setLocaleString(String localeString)
Sets the locale string if given string is not null and not empty.

Useful for url pattern bindings.


Nuxeo Enterprise Platform 5.4

Copyright © 2011 Nuxeo SAS. All Rights Reserved.