com.filenet.wcm.toolkit.server.servlet
Class WcmGetContentServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bycom.filenet.wcm.toolkit.server.servlet.WcmGetContentServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public abstract class WcmGetContentServlet
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
protected  class WcmGetContentServlet.GetContentRequest
           
 
Field Summary
static int CONTENT_MODE
           
static java.lang.String CONTENT_MODE_STRING
           
protected static java.lang.String customObjectKey
           
static int DEFAULT_MODE
           
static int DOWNLOAD_MODE
           
static java.lang.String DOWNLOAD_MODE_STRING
           
protected static java.lang.String folderKey
           
static java.lang.String IGNORE_REDIRECT_PROPERTY
           
protected static java.util.Properties redirectURLs
           
static java.lang.String SERVLET_0WIN
           
static int WCM_PREVIEW_MODE
           
static java.lang.String WCM_PREVIEW_MODE_STRING
           
protected static WcmString wsErrorPageTitle
           
 
Constructor Summary
WcmGetContentServlet()
           
 
Method Summary
protected  boolean canAccessObjectStore(WcmDataStore ds, java.util.Locale locale, java.lang.String objectStoreName)
           
protected  boolean doesUserHaveRightToViewMultiContent(WcmDataStore ds, java.util.Locale locale)
          Determine if user has right to view multi-contents document.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected abstract  WcmController getController()
          Overrideable factory method to get the controller bean.
static com.filenet.wcm.api.Document getCurrentVersion(com.filenet.wcm.api.VersionSeries vs)
           
protected  boolean getEnableFiletracking(WcmDataStore ds, java.util.Locale locale)
           
protected  boolean getUsePathBasedURLs(WcmDataStore ds)
          Deprecated. - Override getUsePathBasedURLs(WcmDataStore, Locale) instead.
protected  boolean getUsePathBasedURLs(WcmDataStore ds, java.util.Locale locale)
          The default implementation calls getUsePathBasedURLs(WcmDataStore), for compatibility purposes, for this release.
protected  java.lang.String getWCMBaseURL(WcmDataStore ds, java.util.Locale locale)
          Get the WCM base URL.
protected  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.
protected  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.
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)
          Handle the case of an external document.
protected  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.
 void init(javax.servlet.ServletConfig config)
           
protected  boolean needRedirectToExternalService(java.lang.String mimeType, WcmDataStore ds, javax.servlet.http.HttpServletRequest request)
           
protected  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, doHead, 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
See Also:
Constant Field Values

IGNORE_REDIRECT_PROPERTY

public static final java.lang.String IGNORE_REDIRECT_PROPERTY
See Also:
Constant Field Values

DOWNLOAD_MODE_STRING

public static final java.lang.String DOWNLOAD_MODE_STRING
See Also:
Constant Field Values

CONTENT_MODE_STRING

public static final java.lang.String CONTENT_MODE_STRING
See Also:
Constant Field Values

WCM_PREVIEW_MODE_STRING

public static final java.lang.String WCM_PREVIEW_MODE_STRING
See Also:
Constant Field Values

DEFAULT_MODE

public static final int DEFAULT_MODE
See Also:
Constant Field Values

DOWNLOAD_MODE

public static final int DOWNLOAD_MODE
See Also:
Constant Field Values

CONTENT_MODE

public static final int CONTENT_MODE
See Also:
Constant Field Values

WCM_PREVIEW_MODE

public static final int WCM_PREVIEW_MODE
See Also:
Constant Field Values
Constructor Detail

WcmGetContentServlet

public WcmGetContentServlet()
Method Detail

getController

protected abstract WcmController getController()
Overrideable factory method to get the controller bean.

Returns:
a new instance of WcmController

getUsePathBasedURLs

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

Throws:
java.lang.Exception

getUsePathBasedURLs

protected boolean getUsePathBasedURLs(WcmDataStore ds,
                                      java.util.Locale locale)
                               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

protected boolean doesUserHaveRightToViewMultiContent(WcmDataStore ds,
                                                      java.util.Locale locale)
                                               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

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
Throws:
javax.servlet.ServletException
java.io.IOException

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
Throws:
javax.servlet.ServletException
java.io.IOException

needRedirectToExternalService

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

getWCMBaseURL

protected java.lang.String getWCMBaseURL(WcmDataStore ds,
                                         java.util.Locale locale)
                                  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

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

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
Deprecated. Override handleExternalDocument(doc, request, response, dataStore, mode, externalMimeType) instead.

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
Deprecated. Override handleExternalDocument(doc, request, response, dataStore, mode, externalMimeType) instead.

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
Handle the case of an external document.

Parameters:
doc -
request -
response -
ds -
Throws:
WcmException
java.io.IOException

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Throws:
javax.servlet.ServletException

getCurrentVersion

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

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


© Copyright IBM Corp. 2002, 2007. All Rights Reserved.