atg.endeca.assembler
Class AssemblerPipelineServlet

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.nucleus.TimedOperationService
              extended by atg.servlet.pipeline.PipelineableServletImpl
                  extended by atg.servlet.pipeline.InsertableServletImpl
                      extended by atg.endeca.assembler.AssemblerPipelineServlet
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, InsertableServlet, PipelineableServlet, java.util.EventListener, javax.servlet.Servlet

public class AssemblerPipelineServlet
extends InsertableServletImpl

A pipline servlet that invokes the assembler. It can return content in JSON, XML or forward to a JSP that can handle rendering.


Field Summary
static java.lang.String ASSEMBLER
           
static java.lang.String ATG_ASSEMBLER
           
static java.lang.String CONTENT_COLLECTION
           
static java.lang.String CONTENT_ITEM
           
static java.lang.String CONTENT_RENDERER
           
static java.lang.String JSON_FORMAT
           
static java.lang.String RULE_LIMIT
           
static java.lang.String XML_FORMAT
           
 
Fields inherited from class atg.servlet.pipeline.InsertableServletImpl
CLASS_VERSION
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
AssemblerPipelineServlet()
           
 
Method Summary
protected  void forwardRequest(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse, ContentItem pContentItem)
          Forwards the request to the jsp specified by the contentRenderer servlet context parameter set in the Web.xml.
 java.lang.String[] getAllowedMimeTypes()
          Sets property allowedMimeTypes.
 AssemblerTools getAssemblerTools()
           
 java.lang.String getDefaultContentRenderer()
           
 java.lang.String getFormatParamName()
          Name of the request parameter that controls the format of the returned content.
 java.util.regex.Pattern getIgnoreRequestURIPattern()
          Returns property ignoreRequestURIPattern.
protected  java.lang.String getMimeTypeForRequest(DynamoHttpServletRequest pRequest)
          Extract the mime type for the request.
 MimeTyper getMimeTyper()
          Returns property mimeTyper.
 boolean isAssembleUnknownMimeTypes()
          Returns property assembleUnknownMimeTypes.
protected  boolean isContentCollectionRequest(DynamoHttpServletRequest pRequest)
          Build what the request would look like to the special "/assembler" path which indicates we want a ContentSlotConfig.
 boolean isEnable()
          Returns property enable.
protected  boolean isMimeTypeAllowed(java.lang.String pMimeType)
          Return whether the specified mime type is allowed.
 boolean isUseMapper()
          Returns property useMapper.
protected  java.lang.String requestURIWithoutParams(DynamoHttpServletRequest pRequest)
          Get the request uri without params
 void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Services a DynamoHttpServletRequest/Response pair
 void setAllowedMimeTypes(java.lang.String[] pAllowedMimeTypes)
          Sets property allowedMimeTypes.
 void setAssemblerTools(AssemblerTools pAssemblerTools)
          Set a new assembler tools class
 void setAssembleUnknownMimeTypes(boolean pAssembleUnknownMimeTypes)
          Sets property assembleUnknownMimeTypes.
 void setDefaultContentRenderer(java.lang.String pDefaultContentRenderer)
          Set the location of a JSP that knows how to handle the rendering of returned content items.
 void setEnable(boolean pEnable)
          Sets property enable.
 void setFormatParamName(java.lang.String pFormatParamName)
           
 void setIgnoreRequestURIPattern(java.util.regex.Pattern pIgnoreRequestURIPattern)
          Sets property ignoreRequestURIPattern.
 void setMimeTyper(MimeTyper pMimeTyper)
          Sets property mimeTyper.
 void setUseMapper(boolean pUseMapper)
          Sets property useMapper.
protected  boolean shouldIgnoreRequest(DynamoHttpServletRequest pRequest)
          Whether we should ignore this request (as far as invoking the assembler).
 
Methods inherited from class atg.servlet.pipeline.InsertableServletImpl
doStartService, getInsertAfterServlet, setInsertAfterServlet
 
Methods inherited from class atg.servlet.pipeline.PipelineableServletImpl
createAdminServlet, destroy, getAdminServlet, getNextServlet, getServletConfig, getServletInfo, init, isUsePathInfo, passRequest, passRequest, service, service, setNextServlet, setServletInfo, setUsePathInfo
 
Methods inherited from class atg.nucleus.TimedOperationService
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, doStopService, getAbsoluteName, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface atg.servlet.pipeline.PipelineableServlet
getNextServlet, passRequest, setNextServlet
 
Methods inherited from interface javax.servlet.Servlet
destroy, getServletConfig, getServletInfo, init, service
 

Field Detail

ASSEMBLER

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

CONTENT_COLLECTION

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

RULE_LIMIT

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

CONTENT_RENDERER

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

ATG_ASSEMBLER

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

CONTENT_ITEM

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

JSON_FORMAT

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

XML_FORMAT

public static final java.lang.String XML_FORMAT
See Also:
Constant Field Values
Constructor Detail

AssemblerPipelineServlet

public AssemblerPipelineServlet()
Method Detail

setEnable

public void setEnable(boolean pEnable)
Sets property enable. Whether this component is enabled.


isEnable

public boolean isEnable()
Returns property enable. Whether this component is enabled.


setAssembleUnknownMimeTypes

public void setAssembleUnknownMimeTypes(boolean pAssembleUnknownMimeTypes)
Sets property assembleUnknownMimeTypes. Whether to send unknown mime types to the assembler for possible rendering. This is generally true, so that paths that look like directories can be handled by the assembler.


isAssembleUnknownMimeTypes

public boolean isAssembleUnknownMimeTypes()
Returns property assembleUnknownMimeTypes. Whether to send unknown mime types to the assembler for possible rendering. This is generally true, so that paths that look like directories can be handled by the assembler.


getDefaultContentRenderer

public java.lang.String getDefaultContentRenderer()
Returns:
The location of a JSP that knows how to handle the rendering of returned content items.

setDefaultContentRenderer

public void setDefaultContentRenderer(java.lang.String pDefaultContentRenderer)
Set the location of a JSP that knows how to handle the rendering of returned content items.

Parameters:
pDefaultContentRenderer -

getAssemblerTools

public AssemblerTools getAssemblerTools()
Returns:
The assembler tools class

setAssemblerTools

public void setAssemblerTools(AssemblerTools pAssemblerTools)
Set a new assembler tools class

Parameters:
pAssemblerTools -

getFormatParamName

public java.lang.String getFormatParamName()
Name of the request parameter that controls the format of the returned content. Defaults to "format".

Returns:
formatParamName

setFormatParamName

public void setFormatParamName(java.lang.String pFormatParamName)
Parameters:
pFormatParamName - Set a new formatParamName

setUseMapper

public void setUseMapper(boolean pUseMapper)
Sets property useMapper. Whether to attempt to use the ContentItemToRendererPath via AssemblerTools.


isUseMapper

public boolean isUseMapper()
Returns property useMapper. Whether to attempt to use the ContentItemToRendererPath via AssemblerTools.


setIgnoreRequestURIPattern

public void setIgnoreRequestURIPattern(java.util.regex.Pattern pIgnoreRequestURIPattern)
Sets property ignoreRequestURIPattern. The pattern to be applied to ignore a request URI.


getIgnoreRequestURIPattern

public java.util.regex.Pattern getIgnoreRequestURIPattern()
Returns property ignoreRequestURIPattern. The pattern to be applied to ignore a request URI.


setAllowedMimeTypes

public void setAllowedMimeTypes(java.lang.String[] pAllowedMimeTypes)
Sets property allowedMimeTypes. The allow request mime types to allow. The null mimetype is always allowed. Only has an effect if MimeTyper is set.


getAllowedMimeTypes

public java.lang.String[] getAllowedMimeTypes()
Sets property allowedMimeTypes. The allow request mime types to allow. The null mimetype is always allowed. Only has an effect if MimeTyper is set.


setMimeTyper

public void setMimeTyper(MimeTyper pMimeTyper)
Sets property mimeTyper. The mime typer to use for mime typing the path of the request. If null, mime type associated with the request will have no effect.


getMimeTyper

public MimeTyper getMimeTyper()
Returns property mimeTyper. The mime typer to use for mime typing the path of the request. If null, mime type associated with the request will have no effect.


isMimeTypeAllowed

protected boolean isMimeTypeAllowed(java.lang.String pMimeType)
Return whether the specified mime type is allowed. Returns true if pMimeType is null, or pMimeType is in allowedMimeTypes.

Parameters:
pMimeType - the mime type off the request.
Returns:
true if allowed, false if disallowed

getMimeTypeForRequest

protected java.lang.String getMimeTypeForRequest(DynamoHttpServletRequest pRequest)
Extract the mime type for the request. Returns null if no matching mime type was found.

Parameters:
pRequest - the current request
pResourcePath - the resource path as returned by AssemblerTools

shouldIgnoreRequest

protected boolean shouldIgnoreRequest(DynamoHttpServletRequest pRequest)
Whether we should ignore this request (as far as invoking the assembler).

Parameters:
pRequest - the current request.
Returns:
true assembler shouldn't be invoked for this request, false if the assembler should.

service

public void service(DynamoHttpServletRequest pRequest,
                    DynamoHttpServletResponse pResponse)
             throws java.io.IOException,
                    javax.servlet.ServletException
Description copied from class: PipelineableServletImpl
Services a DynamoHttpServletRequest/Response pair

Overrides:
service in class PipelineableServletImpl
Throws:
java.io.IOException - if an error occurred while reading or writing the servlet request
javax.servlet.ServletException - if an error occurred while processing the servlet request

forwardRequest

protected void forwardRequest(DynamoHttpServletRequest pRequest,
                              DynamoHttpServletResponse pResponse,
                              ContentItem pContentItem)
                       throws javax.servlet.ServletException,
                              java.io.IOException
Forwards the request to the jsp specified by the contentRenderer servlet context parameter set in the Web.xml. If this is not set uses the defaultContentRenderer property.

Parameters:
pRequest - HttpRequest
pResponse - HttpResponse
pContentItem - The content item to make available on the page
Throws:
javax.servlet.ServletException
java.io.IOException

isContentCollectionRequest

protected boolean isContentCollectionRequest(DynamoHttpServletRequest pRequest)
Build what the request would look like to the special "/assembler" path which indicates we want a ContentSlotConfig. If its not to the "/assembler" path then we use a ContentInclude, regardless of the presence of an assemblerContentCollection.

Parameters:
pRequest -
Returns:

requestURIWithoutParams

protected java.lang.String requestURIWithoutParams(DynamoHttpServletRequest pRequest)
Get the request uri without params

Parameters:
pRequest -