com.endeca.infront.cartridge
Class RedirectAwareContentIncludeHandler

java.lang.Object
  extended by com.endeca.infront.assembler.AbstractCartridgeHandler
      extended by com.endeca.infront.cartridge.ContentIncludeHandler
          extended by com.endeca.infront.cartridge.RedirectAwareContentIncludeHandler
All Implemented Interfaces:
CartridgeHandler<ContentItem>

public class RedirectAwareContentIncludeHandler
extends ContentIncludeHandler

A handler for obtaining content from a URI, when keyword redirect support is desired. This handler should be used for root (top-level) calls to Assembler.assemble(com.endeca.infront.assembler.ContentItem) only. For nested ContentIncludes, use ContentIncludeHandler.

If a redirect has been triggered, it will be attached to the returned ContentItem with the key "endeca:redirect".

See Also:
RedirectAwareContentInclude

Field Summary
 
Fields inherited from class com.endeca.infront.cartridge.ContentIncludeHandler
ENDECA_CONTENT_PATH, ENDECA_SITE_ROOT_PATH
 
Constructor Summary
RedirectAwareContentIncludeHandler()
           
 
Method Summary
protected  ContentItem getContent(ContentLocator locator)
          Adds keyword redirect information, if a redirect was triggered.
 void setContentBroker(MdexContentRequestBroker pContentBroker)
          Provider of essential services to dynamic content handlers.
 void setDefaultFullAssembleOnRedirect(boolean fullAssembleOnRedirect)
          Sets the default value for the property of whether or not full assembly should be done if a keyword redirect exists.
 void setDefaultRedirectCollection(String redirectCollection)
          Sets the default redirect collection name.
 void setNavigationState(NavigationState navigationState)
          The navigation state for this request.
 
Methods inherited from class com.endeca.infront.cartridge.ContentIncludeHandler
getContentSource, preprocess, process, setContentSource
 
Methods inherited from class com.endeca.infront.assembler.AbstractCartridgeHandler
initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RedirectAwareContentIncludeHandler

public RedirectAwareContentIncludeHandler()
Method Detail

setContentBroker

public void setContentBroker(MdexContentRequestBroker pContentBroker)
Provider of essential services to dynamic content handlers. Through this broker, a handler may query the content source associated with the request. The MdexContentRequestBroker must be available within the scope of the request, but should not be modified or used outside the scope of this handler. Use of the MdexContentRequestBroker in other classes is not supported.

Must be set before ContentIncludeHandler.preprocess(com.endeca.infront.assembler.ContentItem) is called.


setNavigationState

public void setNavigationState(NavigationState navigationState)
The navigation state for this request. Must be set before ContentIncludeHandler.preprocess(com.endeca.infront.assembler.ContentItem) is called.


setDefaultFullAssembleOnRedirect

public void setDefaultFullAssembleOnRedirect(boolean fullAssembleOnRedirect)
Sets the default value for the property of whether or not full assembly should be done if a keyword redirect exists. If this method is not called, false is assumed.

This value can be overriden by configuration on the content actually being included (using the property name fullAssembleOnRedirect).

Parameters:
fullAssembleOnRedirect - if false, only keyword redirect information will be returned if a redirect was triggered. If true, full assembly will still be done if a redirect was triggered.

setDefaultRedirectCollection

public void setDefaultRedirectCollection(String redirectCollection)
Sets the default redirect collection name. If this method is not called, "/redirects/Default" is assumed. This method can be called with a value of null or empty to indicate that the handler should not look for keyword redirects.

This value can be overriden by configuration on the content actually being included (using the property name redirectCollection).

Parameters:
redirectCollection - the redirect collection. This value may be null or empty to indicate that the handler should not look for keyword redirects.

getContent

protected ContentItem getContent(ContentLocator locator)
                          throws CartridgeHandlerException,
                                 ContentException
Adds keyword redirect information, if a redirect was triggered. If no redirect was triggered, just calls superclass method. Note that if fullAssembleOnRedirect is false, full assembly is short-circuited by clearing the return value from the superclass method.

Overrides:
getContent in class ContentIncludeHandler
Parameters:
locator - the ContentLocator obtained from the ContentSource in the ContentIncludeHandler.preprocess(com.endeca.infront.assembler.ContentItem) method.
Throws:
CartridgeHandlerException - if the content broker has not been set (see setContentBroker(com.endeca.infront.content.MdexContentRequestBroker)} or if the navigation state has not been set (see setNavigationState(com.endeca.infront.navigation.NavigationState)).
ContentException


Copyright © 2012, Oracle and/or its affiliates. All rights reserved.