public class CurrencyFormatter extends DynamoServlet
Example:
<importbean bean="/atg/dynamo/droplet/CurrencyFormatter">
<droplet bean="CurrencyFormatter">
<param name="currency" value="param:amount">
<param name="locale" value="bean:/OriginatingRequest.requestLocale.locale">
<oparam name="output">
<valueof param="formattedCurrency">no price</valueof>
</oparam>
</droplet>
Usage:
output parameter, this is the formatted currency
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
mAllowCleanupRequest, mParametersSERVLET_INFO_KEYSERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description |
|---|
CurrencyFormatter()
Constructs an instanceof CurrencyFormatter
|
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
formatCurrency(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Return the currency formatted in the given Locale as a String.
|
protected java.lang.Number |
getCurrency(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Returns the currency value from the request.
|
protected java.util.Locale |
getCurrencyLocale(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Returns the locale associated with the request.
|
java.util.Locale |
getDefaultLocale()
Returns property DefaultLocale.
|
protected java.lang.String |
getEuroSymbol(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Returns the symbol to use when formatting a price in Euros.
|
boolean |
isUseRequestLocale()
Returns property UseRequestLocale
|
void |
service(DynamoHttpServletRequest pRequest,
DynamoHttpServletResponse pResponse)
Takes the formatted currency String and sets a request parameter named
formattedCurrency, then services the output
parameter. |
void |
setDefaultLocale(java.util.Locale pDefaultLocale)
Sets property DefaultLocale
|
void |
setUseRequestLocale(boolean pUseRequestLocale)
Sets property UseRequestLocale
|
doDelete, doGet, doPost, doPut, getParameter, getParameters, getServletContext, init, service, service, setParameterdestroy, getServletConfig, getServletInfo, setServletInfogetAverageRequestHandlingTime, getHandledRequestCount, getRequestStartTime, getTotalRequestHandlingTime, isKeepingStatistics, notifyHandledRequest, resetStatistics, setKeepingStatisticsaddLogListener, 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, stopServicevlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic CurrencyFormatter()
public void setDefaultLocale(java.util.Locale pDefaultLocale)
public java.util.Locale getDefaultLocale()
public void setUseRequestLocale(boolean pUseRequestLocale)
public boolean isUseRequestLocale()
protected java.lang.Number getCurrency(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
currency, and if that cannot be found then return 0.0javax.servlet.ServletExceptionjava.io.IOExceptionprotected java.util.Locale getCurrencyLocale(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
locale. This value can be
either a java.util.Locale object or a String which represents the locale.
Next if the useRequestLocale property is true, then the locale
of the request will be returned. Finally, if the locale cannot be determined,
the the defaultLocale property is used.javax.servlet.ServletExceptionjava.io.IOExceptionprotected java.lang.String getEuroSymbol(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
javax.servlet.ServletExceptionjava.io.IOExceptionprotected java.lang.String formatCurrency(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
getCurrency(request, response)
and getCurrencyLocale(request, response) methods.javax.servlet.ServletExceptionjava.io.IOExceptionpublic void service(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
formattedCurrency, then services the output
parameter.service in class DynamoServletpRequest - the request to be processedpResponse - the response object for this requestjavax.servlet.ServletException - an application specific error occurred
processing this requestjava.io.IOException - an error occurred reading data from the request
or writing data to the response.