|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectatg.nucleus.logging.VariableArgumentApplicationLoggingImpl
atg.nucleus.GenericService
atg.nucleus.TimedOperationService
atg.nucleus.servlet.ServletService
atg.nucleus.servlet.HttpServletService
atg.servlet.DynamoServlet
atg.projects.store.droplet.StoreTextDroplet
public class StoreTextDroplet
This droplet performs a look up in the repository to obtain localized resource text message templates either by matching on a specific key to obtain a single resource text message template or by matching on a tag to obtain zero or more resource text messages 'tagged' with this value. It is not possible to find a match on both key and tag values, if a key is supplied that is the value used to find a match. The 'key' property is a unique value in the repository so only a single message template will match on any particular key value. The 'tag' property is not a unique value across message templates but there can only be one tag per text resource. So a text message template can be tagged as 'news' but not as both 'news' and 'latest-news'.
When performing a key match we firstly try to find a site specific resource text message template by matching on a site version of the supplied key value or if no match is found we try to find a match on the supplied key value. If no match is found in the repository for either key versions then:
The message templates are then parsed to substitute any format pattern specifiers with the corresponding entry value obtained from either the 'args' input parameter map or from the request input parameters.
The message template can consist of static text elements and zero or more format pattern specifiers. A format pattern specifier is defined as a region of text enclosed by '{' and '}' characters. This allows the page coder to create dynamic message content based on the message template and substituting values for the format pattern specifiers at runtime.
For example, The quick {color} fox {action} over the {object}. with matching format pattern values as follows color=brown action=jumps object=lazy dog resolves as The quick brown fox jumps over the lazy dog. The message template can contain '\\', '\{', '\}' escape sequences. This allows '\', '{', and '}' characters to appear in the message and not be treated as format specifier pattern delimiters. If the message template was defined as The \{ quick {color} fox \} {action} over the {object}. this resolves as The { quick brown fox } jumps over the lazy dog. Unknown escape sequences ignore the '\' character, so The \q quick {color} fox {action} over the {object}. will resolve as The q quick brown fox jumps over the lazy dog. Text within the format pattern delimiters is taken literally and will ignore escape sequences, so The quick {c\qolor\} fox {action} over the {object}. will pick up 'c\qolor\' as a format pattern specifier. If multiple parameters matching the same format pattern specifier are passed to the droplet then it is the last parameter which will be used. So passing in a 'color' parameter twice with values 'brown' & 'black' will insert 'black' into the example above. Any parameter name/values or map entries passed into the droplet but which do not match on a format pattern specifier in the message template are ignored. Any format pattern specifiers present in the message template but which do not have a corresponding value passed into the droplet remain untouched in the resulting message. The droplet does not perform any strong verification on the message template form so The quick {color fox jumps over the lazy dog. is a valid template, there is no malformed exception for the unclosed format pattern. As there is no format pattern specifier sequence recognized in the template, the message resolves as The quick {color fox jumps over the lazy dog.
The droplet takes the following input parameters:
Example:
<dsp:importbean bean="/atg/store/droplet/StoreText"/>
<!-- Key handling --!>
<c:set var="key" value="company_aboutUs.aboutUs"/>
<c:set var="storeName" value="ATG Store"/>
<dsp:droplet name="StoreText">
<dsp:param name="key" value="${key}"/>
<dsp:param name="storeName" value="${storeName}"/>
<dsp:oparam name="output">
<dsp:getvalueof var="message" param="message"/>
<c:out value="[${key}: ${message}]" escapeXml="false"/>
</dsp:oparam>
<dsp:oparam name="error">
<dsp:getvalueof var="message" param="message"/>
<c:out value="[Error: ${key}: ${message}]" escapeXml="false"/>
</dsp:oparam>
</dsp:droplet>
<!-- Tag handling --!>
<c:set var="tag" value="news"/>
<dsp:droplet name="StoreText">
<dsp:param name="tag" value="${tag}"/>
<dsp:oparam name="output">
<dsp:getvalueof var="messages" param="messages"/>
<c:out value="[${tag}:"/>
<c:forEach items="${messages}"
var="message">
<c:out value=" ${message}" escapeXml="false"/>
</c:forEach>
<c:out value="]"/>
</dsp:oparam>
<dsp:oparam name="error">
<dsp:getvalueof var="message" param="message"/>
<c:out value="[Error: ${key}: ${message}]" escapeXml="false"/>
</dsp:oparam>
</dsp:droplet>
<!-- List handling --!>
<dsp:droplet name="StoreText">
<dsp:param name="key" value="benefitsList"/>
<dsp:oparam name="outputStart">
<ul>
</dsp:oparam>
<dsp:oparam name="output">
<li>
<dsp:valueof param="message"/>
</li>
</dsp:oparam>
<dsp:oparam name="outputEnd">
</ul>
</dsp:oparam>
</dsp:droplet>
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
static java.lang.String |
LIST_PROPERTY_NAME
|
static java.lang.String |
LIST_TYPE
|
protected static java.lang.String |
RQL_QUERY_BY_KEY
RQL Query repository by key |
protected static java.lang.String |
RQL_QUERY_BY_SITE_OR_KEY
RQL Query repository by site or key |
protected static java.lang.String |
RQL_QUERY_BY_SITE_OR_TAG
RQL Query repository by site or tag |
protected static java.lang.String |
RQL_QUERY_BY_TAG
RQL Query repository by tag |
static java.lang.String |
TEXT_PROPERTY_NAME
|
static java.lang.String |
TYPE_PROPERTY_NAME
|
Fields inherited from class atg.servlet.DynamoServlet |
---|
mAllowCleanupRequest, mParameters |
Fields inherited from class atg.nucleus.servlet.ServletService |
---|
SERVLET_INFO_KEY |
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 | |
---|---|
StoreTextDroplet()
|
Method Summary | |
---|---|
java.lang.String |
getDefaultText(java.lang.String pKey)
Gets defaultText by key |
java.lang.String |
getDefaultTextTemplate()
Gets the defaultTextTemplate |
java.lang.String |
getItemDescriptorName()
|
atg.repository.Repository |
getRepository()
|
java.lang.String |
getSiteKey(java.lang.String pKey)
|
java.lang.String |
getSiteKeyTemplate()
|
java.lang.String |
getSiteTag(java.lang.String pTag)
|
java.lang.String |
getSiteTagTemplate()
|
void |
service(atg.servlet.DynamoHttpServletRequest pRequest,
atg.servlet.DynamoHttpServletResponse pResponse)
Receives and validates the request input parameters. |
void |
setDefaultTextTemplate(java.lang.String pDefaultTextTemplate)
Sets the defaultTextTemplate |
void |
setItemDescriptorName(java.lang.String pItemDescriptorName)
|
void |
setRepository(atg.repository.Repository pRepository)
|
void |
setSiteKeyTemplate(java.lang.String pSiteKeyTemplate)
|
void |
setSiteTagTemplate(java.lang.String pSiteTagTemplate)
|
Methods inherited from class atg.servlet.DynamoServlet |
---|
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, service, service, setParameter |
Methods inherited from class atg.nucleus.servlet.ServletService |
---|
destroy, getServletConfig, getServletInfo, init, setServletInfo |
Methods inherited from class atg.nucleus.TimedOperationService |
---|
getAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatistics |
Methods inherited from class atg.nucleus.GenericService |
---|
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, 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 |
Field Detail |
---|
public static final java.lang.String CLASS_VERSION
protected static final java.lang.String RQL_QUERY_BY_SITE_OR_KEY
protected static final java.lang.String RQL_QUERY_BY_KEY
protected static final java.lang.String RQL_QUERY_BY_SITE_OR_TAG
protected static final java.lang.String RQL_QUERY_BY_TAG
public static final java.lang.String TEXT_PROPERTY_NAME
public static final java.lang.String TYPE_PROPERTY_NAME
public static final java.lang.String LIST_PROPERTY_NAME
public static final java.lang.String LIST_TYPE
Constructor Detail |
---|
public StoreTextDroplet()
Method Detail |
---|
public void setDefaultTextTemplate(java.lang.String pDefaultTextTemplate)
pDefaultTextTemplate
- the defaultTextTemplate to setpublic java.lang.String getDefaultTextTemplate()
public java.lang.String getDefaultText(java.lang.String pKey)
pKey
- the key
public void setSiteKeyTemplate(java.lang.String pSiteKeyTemplate)
pSiteKeyTemplate
- the siteKeyTemplate to setpublic java.lang.String getSiteKeyTemplate()
public java.lang.String getSiteKey(java.lang.String pKey)
pKey
- the key to get
public void setSiteTagTemplate(java.lang.String pSiteTagTemplate)
pSiteTagTemplate
- the siteTagTemplate to setpublic java.lang.String getSiteTagTemplate()
public java.lang.String getSiteTag(java.lang.String pTag)
pTag
- the tag to get
public void setRepository(atg.repository.Repository pRepository)
pRepository
- the repository to setpublic atg.repository.Repository getRepository()
public void setItemDescriptorName(java.lang.String pItemDescriptorName)
pItemDescriptorName
- the itemDescriptorName to setpublic java.lang.String getItemDescriptorName()
public void service(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
service
in class atg.servlet.DynamoServlet
pRequest
- - HTTP requestpResponse
- - HTTP response
javax.servlet.ServletException
- if an error occurs
java.io.IOException
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |