public class AssemblerPipelineServlet extends InsertableServletImpl
A pipline servlet that invokes the Assembler to return content from Experience Manager or Guided Search. This servlet is added to the pipline by default after the CookieBufferServlet.
For the servlet to invoke the Assembler its enabled property must be set to true, the web application must specify an atg.assembler context-param that is set to true, the request mime type must not be included in a list of ignored mime types and the URL must not match an ignore regular expression.
The AssemblerPipelineServlet can return two types of content from the Assembler, a ContentInclude and a ContentSlotConfig. A ContentInclude represents a 'page' in the Endeca world. A ContentSlotConfig returns an Endeca content collection. A ContentSlotConfig is returned by making a request to /assembler and having an assemblerContentCollection parameter which specifies the name of the content collection to return. The assemblerRuleLimit parameter may also be used in conjunction with the assemblerContentCollection parameter to indicate how many rules can fire within the particular content collection. A ContentInclude is returned by making a request to the path of a 'page' in Experience Manager or a service in Guided Search. For example, if a "browse" page exists in Experience Manager we may make a request to (webapproot)/browse.
The returned content may be in the form of a ContentItem, JSON or XML. A format parameter can be specified in the request. Valid values for this parameter are json or xml. If specified, the ContentItem will be serialized accordingly. If no format is specified an attempt is made to determine a suitable page (for example JSP) that can render the ContentItem. The ContentItem is set as a contentItem parameter on the request and the request is forwarded to the page.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ASSEMBLER |
static java.lang.String |
ASSEMBLER_INTERCEPTED_LINK
This will be used as a request attribute that when set to true will tell us
to pass the request to the next pipeline servlet rather than forward it.
|
static java.lang.String |
ATG_ASSEMBLER |
static java.lang.String |
CLASS_VERSION
Class version string
|
static java.lang.String |
CONTENT_COLLECTION |
static java.lang.String |
CONTENT_ITEM |
static java.lang.String |
ENDECA_REDIRECT
Endeca redirect key in response content item
|
static java.lang.String |
ROOT_CONTENT_ITEM |
static java.lang.String |
RULE_LIMIT |
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
AssemblerPipelineServlet() |
Modifier and Type | Method and Description |
---|---|
protected ContentItem |
createContentInclude(DynamoHttpServletRequest pRequest,
java.lang.String pResourcePath)
Create a new
ContentInclude content item. |
protected ContentSlotConfig |
createContentSlotConfig(DynamoHttpServletRequest pRequest,
java.lang.String pContent,
int pRuleLimit)
Create a new
ContentSlotConfig content item |
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.
|
atg.service.configuration.ResponseWrappingConfiguration |
getResponseWrappingConfiguration()
Returns property responseWrappingConfiguration.
|
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.
|
protected void |
redirectRequest(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse,
ContentItem pContentItem,
java.lang.String pRedirectURL)
Redirect to the URL specified
|
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) |
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 |
setResponseWrappingConfiguration(atg.service.configuration.ResponseWrappingConfiguration pResponseWrappingConfiguration)
Sets property responseWrappingConfiguration.
|
protected boolean |
shouldIgnoreRequest(DynamoHttpServletRequest pRequest)
Whether we should ignore this request (as far as invoking
the Assembler).
|
doStartService, getInsertAfterServlet, setInsertAfterServlet
createAdminServlet, destroy, getAdminServlet, getNextServlet, getServletConfig, getServletInfo, init, isUsePathInfo, passRequest, passRequest, service, service, setNextServlet, setServletInfo, setUsePathInfo
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics
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
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNextServlet, passRequest, setNextServlet
public static java.lang.String CLASS_VERSION
public static final java.lang.String ASSEMBLER
public static final java.lang.String CONTENT_COLLECTION
public static final java.lang.String RULE_LIMIT
public static final java.lang.String ATG_ASSEMBLER
public static final java.lang.String CONTENT_ITEM
public static final java.lang.String ROOT_CONTENT_ITEM
public static final java.lang.String ASSEMBLER_INTERCEPTED_LINK
public static final java.lang.String ENDECA_REDIRECT
public void setEnable(boolean pEnable)
public boolean isEnable()
public void setAssembleUnknownMimeTypes(boolean pAssembleUnknownMimeTypes)
public boolean isAssembleUnknownMimeTypes()
public java.lang.String getDefaultContentRenderer()
public void setDefaultContentRenderer(java.lang.String pDefaultContentRenderer)
pDefaultContentRenderer
- public AssemblerTools getAssemblerTools()
public void setAssemblerTools(AssemblerTools pAssemblerTools)
pAssemblerTools
- Set a new AssemblerToolspublic java.lang.String getFormatParamName()
public void setFormatParamName(java.lang.String pFormatParamName)
pFormatParamName
- Set a new formatParamNamepublic void setIgnoreRequestURIPattern(java.util.regex.Pattern pIgnoreRequestURIPattern)
public java.util.regex.Pattern getIgnoreRequestURIPattern()
public void setAllowedMimeTypes(java.lang.String[] pAllowedMimeTypes)
public java.lang.String[] getAllowedMimeTypes()
public void setMimeTyper(MimeTyper pMimeTyper)
public MimeTyper getMimeTyper()
public void setResponseWrappingConfiguration(atg.service.configuration.ResponseWrappingConfiguration pResponseWrappingConfiguration)
public atg.service.configuration.ResponseWrappingConfiguration getResponseWrappingConfiguration()
protected boolean isMimeTypeAllowed(java.lang.String pMimeType)
pMimeType
- the mime type off the request.protected java.lang.String getMimeTypeForRequest(DynamoHttpServletRequest pRequest)
pRequest
- the current requestpResourcePath
- the resource path as returned by AssemblerToolsprotected boolean shouldIgnoreRequest(DynamoHttpServletRequest pRequest)
pRequest
- the current request.public void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws java.io.IOException, javax.servlet.ServletException
PipelineableServletImpl
service
in class PipelineableServletImpl
java.io.IOException
- if an error occurred while reading or writing
the servlet requestjavax.servlet.ServletException
- if an error occurred while processing
the servlet requestprotected ContentItem createContentInclude(DynamoHttpServletRequest pRequest, java.lang.String pResourcePath)
ContentInclude
content item. Returns an
instance of RedirectAwareContentInclude
if keyword
redirects are enabled.pRequest
- pResourcePath
- protected ContentSlotConfig createContentSlotConfig(DynamoHttpServletRequest pRequest, java.lang.String pContent, int pRuleLimit)
ContentSlotConfig
content itempRequest
- HttpRequestpResourcePath
- resource pathpRuleLimit
- rule limitprotected void redirectRequest(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse, ContentItem pContentItem, java.lang.String pRedirectURL) throws java.io.IOException
pRequest
- HttpRequestpResponse
- HttpResponsepContentItem
- the content itempRedirectURL
- the redirect URLjava.io.IOException
protected void forwardRequest(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse, ContentItem pContentItem) throws javax.servlet.ServletException, java.io.IOException
pRequest
- HttpRequestpResponse
- HttpResponsepContentItem
- The content item to make available on the pageASSEMBLER_INTERCEPTED_LINK
- javax.servlet.ServletException
java.io.IOException
protected boolean isContentCollectionRequest(DynamoHttpServletRequest pRequest)
pRequest
- protected java.lang.String requestURIWithoutParams(DynamoHttpServletRequest pRequest)
pRequest
-