com.filenet.wcm.toolkit.server.servlet

Class WcmGetContentServlet

  1. java.lang.Object
  2. extended byjavax.servlet.GenericServlet
  3. extended byjavax.servlet.http.HttpServlet
  4. extended bycom.filenet.wcm.toolkit.server.servlet.WcmGetContentServlet
All implemented interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

  1. public abstract class WcmGetContentServlet
  2. extends javax.servlet.http.HttpServlet
WcmGetContentServlet is a servlet for retrieving object content.

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:

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:

Additional Features:


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.

See Also:
Serialized Form

Nested Class Summary

Modifier and Type Class and Description
  1. protected class
WcmGetContentServlet.GetContentRequest
  1. protected class
WcmGetContentServlet.GetRequest
  1. protected class
WcmGetContentServlet.HeadRequest

Field Summary

Modifier and Type Field and Description
  1. static
  2. int
CONTENT_MODE
  1. static
  2. java.lang.String
CONTENT_MODE_STRING
  1. protected static
  2. java.lang.String
customObjectKey
  1. static
  2. int
DEFAULT_MODE
  1. static
  2. int
DOWNLOAD_MODE
  1. static
  2. java.lang.String
DOWNLOAD_MODE_STRING
  1. protected static
  2. java.lang.String
folderKey
  1. static
  2. java.lang.String
IGNORE_REDIRECT_PROPERTY
  1. protected static
  2. java.util.Properties
redirectURLs
  1. static
  2. java.lang.String
SERVLET_0WIN
  1. static
  2. int
WCM_PREVIEW_MODE
  1. static
  2. java.lang.String
WCM_PREVIEW_MODE_STRING
  1. protected static
  2. WcmString
wsErrorPageTitle

Constructor Summary

Constructor and Description
WcmGetContentServlet()

Method Summary

Modifier and Type Method and Description
  1. protected
  2. boolean
canAccessObjectStore(WcmDataStore ds,java.util.Locale locale,java.lang.String objectStoreName)
  1. protected
  2. boolean
doesUserHaveRightToViewMultiContent(WcmDataStore ds,java.util.Locale locale)
Determine if user has right to view multi-contents document.
  1. void
doGet(javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response)
  1. void
doHead(javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response)
  1. void
doPost(javax.servlet.http.HttpServletRequest request,javax.servlet.http.HttpServletResponse response)
  1. protected abstract
  2. WcmController
getController()
Overrideable factory method to get the controller bean.
  1. static
  2. com.filenet.wcm.api.Document
getCurrentVersion(com.filenet.wcm.api.VersionSeries vs)
  1. protected
  2. boolean
getEnableFiletracking(WcmDataStore ds,java.util.Locale locale)
  1. protected
  2. boolean
getUsePathBasedURLs(WcmDataStore ds)
Deprecated. - Override getUsePathBasedURLs(WcmDataStore, Locale) instead.
  1. protected
  2. boolean
getUsePathBasedURLs(WcmDataStore ds,java.util.Locale locale)
The default implementation calls getUsePathBasedURLs(WcmDataStore), for compatibility purposes, for this release.
  1. protected
  2. java.lang.String
getWCMBaseURL(WcmDataStore ds,java.util.Locale locale)
Get the WCM base URL.
  1. protected
  2. void
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.
  1. protected
  2. void
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.
  1. protected
  2. 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)
Handle the case of an external document.
  1. protected
  2. void
handleExternalDocument(com.filenet.wcm.api.Document doc,javax.servlet.http.HttpServletResponse response,WcmDataStore ds)
Deprecated. Override handleExternalDocument(doc, request, response, dataStore, mode, externalMimeType) instead.
  1. void
init(javax.servlet.ServletConfig config)
  1. protected
  2. boolean
needRedirectToExternalService(java.lang.String mimeType,WcmDataStore ds,javax.servlet.http.HttpServletRequest request)
  1. protected
  2. boolean
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

  1. protected static final WcmString wsErrorPageTitle

folderKey

  1. protected static final java.lang.String folderKey

customObjectKey

  1. protected static final java.lang.String customObjectKey

redirectURLs

  1. protected static final java.util.Properties redirectURLs

SERVLET_0WIN

  1. public static final java.lang.String SERVLET_0WIN
See Also:

IGNORE_REDIRECT_PROPERTY

  1. public static final java.lang.String IGNORE_REDIRECT_PROPERTY
See Also:

DOWNLOAD_MODE_STRING

  1. public static final java.lang.String DOWNLOAD_MODE_STRING
See Also:

CONTENT_MODE_STRING

  1. public static final java.lang.String CONTENT_MODE_STRING
See Also:

WCM_PREVIEW_MODE_STRING

  1. public static final java.lang.String WCM_PREVIEW_MODE_STRING
See Also:

DEFAULT_MODE

  1. public static final int DEFAULT_MODE
See Also:

DOWNLOAD_MODE

  1. public static final int DOWNLOAD_MODE
See Also:

CONTENT_MODE

  1. public static final int CONTENT_MODE
See Also:

WCM_PREVIEW_MODE

  1. public static final int WCM_PREVIEW_MODE
See Also:

Constructor Detail

WcmGetContentServlet

  1. public WcmGetContentServlet()

Method Detail

getController

  1. protected abstract WcmController getController( )
Overrideable factory method to get the controller bean.
Returns:
a new instance of WcmController

getUsePathBasedURLs

  1. protected boolean getUsePathBasedURLs( WcmDataStore ds)
  2. throws java.lang.Exception
Deprecated. - Override getUsePathBasedURLs(WcmDataStore, Locale) instead.
Throws:
java.lang.Exception

getUsePathBasedURLs

  1. protected boolean getUsePathBasedURLs( WcmDataStore ds,
  2. java.util.Locale locale)
  3. throws java.lang.Exception
The default implementation calls getUsePathBasedURLs(WcmDataStore), for compatibility purposes, for this release.
Parameters:
ds -
locale -
Returns:
Throws:
java.lang.Exception

doesUserHaveRightToViewMultiContent

  1. protected boolean doesUserHaveRightToViewMultiContent( WcmDataStore ds,
  2. java.util.Locale locale)
  3. throws java.lang.Exception
Determine if user has right to view multi-contents document. This setting is in the Workplace site prefs. This method should be overide by sub-class, default is to return false;
Parameters:
ds - Data store
locale - Locale
Returns:
Throws:
java.lang.Exception

doHead

  1. public void doHead(javax.servlet.http.HttpServletRequest request,
  2. javax.servlet.http.HttpServletResponse response)
  3. throws javax.servlet.ServletException
  4. java.io.IOException
Overrides:
doHead in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

doGet

  1. public void doGet(javax.servlet.http.HttpServletRequest request,
  2. javax.servlet.http.HttpServletResponse response)
  3. throws javax.servlet.ServletException
  4. java.io.IOException
Overrides:
doGet in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

doPost

  1. public void doPost(javax.servlet.http.HttpServletRequest request,
  2. javax.servlet.http.HttpServletResponse response)
  3. throws javax.servlet.ServletException
  4. java.io.IOException
Overrides:
doPost in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

needRedirectToExternalService

  1. protected boolean needRedirectToExternalService( java.lang.String mimeType,
  2. WcmDataStore ds,
  3. javax.servlet.http.HttpServletRequest request)
  4. throws WcmException
Throws:

getWCMBaseURL

  1. protected java.lang.String getWCMBaseURL( WcmDataStore ds,
  2. java.util.Locale locale)
  3. throws java.lang.Exception
Get the WCM base URL. If not overridden in a subclass, this method returns the current application base URL, replacing the application root name with "filenetwcm".
Parameters:
ds -
Returns:
Throws:
java.lang.Exception

handleExternalDocument

  1. protected void handleExternalDocument( com.filenet.wcm.api.Document doc,
  2. javax.servlet.http.HttpServletResponse response,
  3. WcmDataStore ds)
  4. throws WcmException
  5. java.io.IOException
Deprecated. Override handleExternalDocument(doc, request, response, dataStore, mode, externalMimeType) instead.
Throws:
java.io.IOException

handleExternalDocument

  1. protected void handleExternalDocument( com.filenet.wcm.api.Document doc,
  2. javax.servlet.http.HttpServletRequest request,
  3. javax.servlet.http.HttpServletResponse response,
  4. WcmDataStore ds,
  5. boolean downloadMode)
  6. throws WcmException
  7. java.io.IOException
Deprecated. Override handleExternalDocument(doc, request, response, dataStore, mode, externalMimeType) instead.
Throws:
java.io.IOException

handleExternalDocument

  1. protected void handleExternalDocument( com.filenet.wcm.api.Document doc,
  2. javax.servlet.http.HttpServletRequest request,
  3. javax.servlet.http.HttpServletResponse response,
  4. WcmDataStore ds,
  5. int mode)
  6. throws WcmException
  7. java.io.IOException
Deprecated. Override handleExternalDocument(doc, request, response, dataStore, mode, externalMimeType) instead.
Throws:
java.io.IOException

handleExternalDocument

  1. protected void handleExternalDocument( com.filenet.wcm.api.Document doc,
  2. javax.servlet.http.HttpServletRequest request,
  3. javax.servlet.http.HttpServletResponse response,
  4. WcmDataStore ds,
  5. int mode,
  6. java.lang.String externalMimeType)
  7. throws WcmException
  8. java.io.IOException
Handle the case of an external document.
Parameters:
doc -
request -
response -
ds -
Throws:
java.io.IOException

init

  1. public void init(javax.servlet.ServletConfig config)
  2. throws javax.servlet.ServletException
Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

getCurrentVersion

  1. public static com.filenet.wcm.api.Document getCurrentVersion( com.filenet.wcm.api.VersionSeries vs)

canAccessObjectStore

  1. protected boolean canAccessObjectStore( WcmDataStore ds,
  2. java.util.Locale locale,
  3. java.lang.String objectStoreName)

useActiveXControl

  1. protected boolean useActiveXControl( WcmDataStore ds,
  2. java.util.Locale locale,
  3. javax.servlet.http.HttpServletRequest request,
  4. 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
Parameters:
ds -
locale -
request -
mode -
Returns:
true if Active-X control should be used, false otherwise

getEnableFiletracking

  1. protected boolean getEnableFiletracking( WcmDataStore ds,
  2. java.util.Locale locale)