com.filenet.wcm.toolkit.server.servlet
Class WcmGetContentServlet
- java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.filenet.wcm.toolkit.server.servlet.WcmGetContentServlet
- public abstract class WcmGetContentServlet
- extends javax.servlet.http.HttpServlet
Servlet Configuration in WEB-INF/web.xml:
<servlet>
<servlet-name>getContent</servlet-name>
<servlet-class>com.filenet.wcm.toolkit.server.servlet.WcmGetContentServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>getContent</servlet-name>
<url-pattern>/getContent/*</url-pattern>
</servlet-mapping>
Supported URL Syntax:
- Id-based URL - takes 3 required query string parameters, objectStoreName, objectType, and id for folder, id and/or vsId for other object types.
- Path-based URL - containment reference to folder, document, stored search, search template, and publish template; takes /[object store id or name]/[containment pathname] at the end of the URL.
When objectType=[document|storedsearch|searchtemplate|publishtemplate], the id parameter is for retrieving a specific
version, and vsId parameter is for retrieving the most recent released version within the version series.
id parameter also supports "current" and "release" values, for retrieving either the current or released version of the document.
When both id and vsId are present in the URL, the id will be used first for retrieval of the specified version.
If retrieval fails, an error will be reported, and the servlet will allow the user to try the released version as specified by the vsId parameter.
The Path-based URL for document, stored search, search template, and publish template always references the most recent version.
The Path-based URL can take an object store Id (GUID) or name. The object store name is guaranteed to be unique within a single domain, but
not within the whole Active Directory.
When the name is used, the first object store within the Active Directory with that matching name will be returned.
If there are object stores of the same name within the Active Directory, then the name should be further qualified with domain name separated by '@'.
i.e. [object store name]@[domain name]
If the object store name contains any characters that are not valid in the URLs, it must be encoded using WcmEncodingUtil.encodeLabel() method, when in
the id-based URL.
When using path-based url, every path element that contains characters that are not valid in the URLs must be encoded using WcmEncodingUtil.encodePath(),
that includes the object store name.
Examples:
- http://[server]/[app]/getContent/[object store id]/[containment pathname]
- http://[server]/[app]/getContent/[object store name]/[containment pathname]
- http://[server]/[app]/getContent/[object store name]@[domain name]/[containment pathname]
- http://[server]/[app]/getContent?objectStoreName=[object store id]&objectType=folder&id=[folder id]
- http://[server]/[app]/getContent?objectStoreName=[object store id]&objectType=[document|storedsearch|searchtemplate|publishtemplate]&vsId=[version series id]
- http://[server]/[app]/getContent?objectStoreName=[object store id]&objectType=[document|storedsearch|searchtemplate|publishtemplate]&id=[object id]
- http://[server]/[app]/getContent?objectStoreName=[object store id]&objectType=[document|storedsearch|searchtemplate|publishtemplate]&id=[object id]&vsId=[version series id]
- http://[server]/[app]/getContent/[object store id]/[containment pathname]?mode=download
- http://[server]/[app]/getContent?objectStoreName=[object store id]&objectType=[document|storedsearch|searchtemplate|publishtemplate]&vsId=[version series id]&mode=download
Additional Features:
- The optional query string parameter, mode=download, allows the user to save the content locally (the last 2 URLs in the above examples).
- For documents, when the site preference is configured to use Path-based URLs, then the servlet will convert Id-based URLs to Path-based URLs if possible, in order to maintain integrity of any relative URL references embedded within the document content.
Default Behaviors:
The default behavior of the getContent servlet can be controlled or overwritten by adding or overwritting a mimetype entry
in the content_redir.properties file under the web application's WEB-INF directory.
If an entry is found, it takes precedence over the following built-in default behaviors and rediects as specified.
- Folder
Redirects client to a page displaying the folder.
- Document
If the document has content, then the content is returned.
If the document has an external reference, then the servlet redirects the client appropriately.
If the document has no content, an error is reported.
- Workflow Definition Document
Redirects client to Workflow Designer.
- Stored Search
Redirects client to a page displaying the stored search.
- Search Template
Redirects client to a page displaying the search template.
- Publish Template
The content of the publish template is returned as XML.
Nested Class Summary
| Modifier and Type | Class and Description |
|---|---|
|
WcmGetContentServlet.GetContentRequest
|
|
WcmGetContentServlet.GetRequest
|
|
WcmGetContentServlet.HeadRequest
|
Field Summary
| Modifier and Type | Field and Description |
|---|---|
|
CONTENT_MODE
|
|
CONTENT_MODE_STRING
|
|
customObjectKey
|
|
DEFAULT_MODE
|
|
DOWNLOAD_MODE
|
|
DOWNLOAD_MODE_STRING
|
|
folderKey
|
|
IGNORE_REDIRECT_PROPERTY
|
|
redirectURLs
|
|
SERVLET_0WIN
|
|
WCM_PREVIEW_MODE
|
|
WCM_PREVIEW_MODE_STRING
|
|
wsErrorPageTitle
|
Constructor Summary
| Constructor and Description |
|---|
WcmGetContentServlet()
|
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
canAccessObjectStore(WcmDataStore ds,java.util.Locale locale,java.lang.String objectStoreName)
|
|
doesUserHaveRightToViewMultiContent(WcmDataStore ds,java.util.Locale locale)
Determine if user has right to view multi-contents document.
|
|
doGet(javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response)
|
|
doHead(javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response)
|
|
doPost(javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response)
|
|
getController()
Overrideable factory method to get the controller bean.
|
|
getCurrentVersion(com.filenet.wcm.api.VersionSeries vs)
|
|
getEnableFiletracking(WcmDataStore ds,java.util.Locale locale)
|
|
getUsePathBasedURLs(WcmDataStore ds)
Deprecated. - Override getUsePathBasedURLs(WcmDataStore, Locale) instead.
|
|
getUsePathBasedURLs(WcmDataStore ds,java.util.Locale locale)
The default implementation calls getUsePathBasedURLs(WcmDataStore), for compatibility
purposes, for this release.
|
|
getWCMBaseURL(WcmDataStore ds,java.util.Locale locale)
Get the WCM base URL.
|
|
handleExternalDocument(com.filenet.wcm.api.Document doc,javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response,WcmDataStore ds,boolean downloadMode)
Deprecated. Override handleExternalDocument(doc, request, response, dataStore, mode, externalMimeType) instead.
|
|
handleExternalDocument(com.filenet.wcm.api.Document doc,javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response,WcmDataStore ds,int mode)
Deprecated. Override handleExternalDocument(doc, request, response, dataStore, mode, externalMimeType) instead.
|
|
handleExternalDocument(com.filenet.wcm.api.Document doc,javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response,WcmDataStore ds,int mode,java.lang.String externalMimeType)
Handle the case of an external document.
|
|
handleExternalDocument(com.filenet.wcm.api.Document doc,javax.servlet.http.HttpServletResponse response,WcmDataStore ds)
Deprecated. Override handleExternalDocument(doc, request, response, dataStore, mode, externalMimeType) instead.
|
|
init(javax.servlet.ServletConfig config)
|
|
needRedirectToExternalService(java.lang.String mimeType,WcmDataStore ds,javax.servlet.http.HttpServletRequest request)
|
|
useActiveXControl(WcmDataStore ds,java.util.Locale locale,javax.servlet.http.HttpServletRequest request,int mode)
determine if the File Tracking Active-X control should be used or not
default implementation/behavior does not use the ACtive-X control
|
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doDelete, doOptions, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail
wsErrorPageTitle
- protected static final WcmString wsErrorPageTitle
folderKey
- protected static final java.lang.String folderKey
customObjectKey
- protected static final java.lang.String customObjectKey
redirectURLs
- protected static final java.util.Properties redirectURLs
SERVLET_0WIN
- public static final java.lang.String SERVLET_0WIN
IGNORE_REDIRECT_PROPERTY
- public static final java.lang.String IGNORE_REDIRECT_PROPERTY
DOWNLOAD_MODE_STRING
- public static final java.lang.String DOWNLOAD_MODE_STRING
CONTENT_MODE_STRING
- public static final java.lang.String CONTENT_MODE_STRING
WCM_PREVIEW_MODE_STRING
- public static final java.lang.String WCM_PREVIEW_MODE_STRING
DEFAULT_MODE
- public static final int DEFAULT_MODE
DOWNLOAD_MODE
- public static final int DOWNLOAD_MODE
CONTENT_MODE
- public static final int CONTENT_MODE
WCM_PREVIEW_MODE
- public static final int WCM_PREVIEW_MODE
Constructor Detail
WcmGetContentServlet
- public WcmGetContentServlet()
Method Detail
getController
- protected abstract WcmController getController( )
getUsePathBasedURLs
- protected boolean getUsePathBasedURLs( WcmDataStore ds)
- throws java.lang.Exception
java.lang.ExceptiongetUsePathBasedURLs
- protected boolean getUsePathBasedURLs( WcmDataStore ds,
- java.util.Locale locale)
- throws java.lang.Exception
ds - locale - java.lang.ExceptiondoesUserHaveRightToViewMultiContent
- protected boolean doesUserHaveRightToViewMultiContent( WcmDataStore ds,
- java.util.Locale locale)
- throws java.lang.Exception
ds - Data store locale - Locale java.lang.ExceptiondoHead
- public void doHead(javax.servlet.http.HttpServletRequest request,
- javax.servlet.http.HttpServletResponse response)
- throws javax.servlet.ServletException
- java.io.IOException
doHead in class javax.servlet.http.HttpServlet
javax.servlet.ServletExceptionjava.io.IOExceptiondoGet
- public void doGet(javax.servlet.http.HttpServletRequest request,
- javax.servlet.http.HttpServletResponse response)
- throws javax.servlet.ServletException
- java.io.IOException
doGet in class javax.servlet.http.HttpServlet
javax.servlet.ServletExceptionjava.io.IOExceptiondoPost
- public void doPost(javax.servlet.http.HttpServletRequest request,
- javax.servlet.http.HttpServletResponse response)
- throws javax.servlet.ServletException
- java.io.IOException
doPost in class javax.servlet.http.HttpServlet
javax.servlet.ServletExceptionjava.io.IOExceptionneedRedirectToExternalService
- protected boolean needRedirectToExternalService( java.lang.String mimeType,
- WcmDataStore ds,
- javax.servlet.http.HttpServletRequest request)
- throws WcmException
getWCMBaseURL
- protected java.lang.String getWCMBaseURL( WcmDataStore ds,
- java.util.Locale locale)
- throws java.lang.Exception
ds - java.lang.ExceptionhandleExternalDocument
- protected void handleExternalDocument( com.filenet.wcm.api.Document doc,
- javax.servlet.http.HttpServletResponse response,
- WcmDataStore ds)
- throws WcmException
- java.io.IOException
handleExternalDocument
- protected void handleExternalDocument( com.filenet.wcm.api.Document doc,
- javax.servlet.http.HttpServletRequest request,
- javax.servlet.http.HttpServletResponse response,
- WcmDataStore ds,
- boolean downloadMode)
- throws WcmException
- java.io.IOException
handleExternalDocument
- protected void handleExternalDocument( com.filenet.wcm.api.Document doc,
- javax.servlet.http.HttpServletRequest request,
- javax.servlet.http.HttpServletResponse response,
- WcmDataStore ds,
- int mode)
- throws WcmException
- java.io.IOException
handleExternalDocument
- protected void handleExternalDocument( com.filenet.wcm.api.Document doc,
- javax.servlet.http.HttpServletRequest request,
- javax.servlet.http.HttpServletResponse response,
- WcmDataStore ds,
- int mode,
- java.lang.String externalMimeType)
- throws WcmException
- java.io.IOException
init
- public void init(javax.servlet.ServletConfig config)
- throws javax.servlet.ServletException
init in interface javax.servlet.Servlet
init in class javax.servlet.GenericServlet
javax.servlet.ServletExceptiongetCurrentVersion
- public static com.filenet.wcm.api.Document getCurrentVersion( com.filenet.wcm.api.VersionSeries vs)
canAccessObjectStore
- protected boolean canAccessObjectStore( WcmDataStore ds,
- java.util.Locale locale,
- java.lang.String objectStoreName)
useActiveXControl
- protected boolean useActiveXControl( WcmDataStore ds,
- java.util.Locale locale,
- javax.servlet.http.HttpServletRequest request,
- int mode)
ds - locale - request - mode - getEnableFiletracking
- protected boolean getEnableFiletracking( WcmDataStore ds,
- java.util.Locale locale)