Translet, BeanRegistry, MessageSourcepublic class CoreTranslet extends java.lang.Object implements Translet
This class is generally not thread-safe. It is primarily designed for use in a single thread only.
| Constructor | Description |
|---|---|
CoreTranslet(CoreActivity activity) |
Instantiates a new CoreTranslet.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
acceptsProfiles(java.lang.String... profiles) |
Return whether the given profile is active.
|
boolean |
containsBean(java.lang.Class<?> requiredType) |
Return whether a bean with the specified object type is present.
|
boolean |
containsBean(java.lang.String id) |
Return whether a bean with the specified id is present.
|
java.util.Map<java.lang.String,java.lang.Object> |
copyAllParameters() |
Returns the parameter copied to the new instance.
|
void |
dispatch(DispatchResponseRule dispatchResponseRule) |
Dispatch to other resources as the given rule.
|
void |
dispatch(java.lang.String name) |
Dispatch to other resources as the given name.
|
void |
dispatch(java.lang.String name,
boolean immediately) |
Dispatch to other resources as the given name.
|
void |
fillAllParameters(java.util.Map<java.lang.String,java.lang.Object> targetParameters) |
Fills all parameters to the specified map.
|
void |
fillAttributeMap(java.util.Map<java.lang.String,java.lang.Object> attributeMap) |
Fills all attributes to the specified map.
|
void |
forward(ForwardResponseRule forwardResponseRule) |
Forward according to a given rule.
|
void |
forward(java.lang.String transletName) |
Forward to the specified translet immediately.
|
void |
forward(java.lang.String transletName,
boolean immediately) |
Forward to the specified translet.
|
ActivityDataMap |
getActivityDataMap() |
Returns an Activity Data Map containing the activity result data.
|
ActivityDataMap |
getActivityDataMap(boolean prefill) |
Returns an Activity Data Map containing the activity result data.
|
<T> T |
getAfterAdviceResult(java.lang.String aspectId) |
Gets the after advice result.
|
java.util.Map<java.lang.String,java.lang.Object> |
getAllAttributes() |
Return a mutable
Map of the request attributes,
with attribute names as map keys and attribute value as map value. |
java.util.Map<java.lang.String,java.lang.Object> |
getAllParameters() |
Return an immutable Map of the request parameters,
with parameter names as map keys and parameter values as map values.
|
<T> T |
getApplicationAdaptee() |
Returns the adaptee object to provide application information.
|
ApplicationAdapter |
getApplicationAdapter() |
Gets the application adapter.
|
<T> T |
getAroundAdviceResult(java.lang.String aspectId) |
Gets the around advice result.
|
<T> T |
getAspectAdviceBean(java.lang.String aspectId) |
Gets the aspect advice bean.
|
<T> T |
getAttribute(java.lang.String name) |
Returns the value of the named attribute as a given type,
or
null if no attribute of the given name exists. |
java.util.Enumeration<java.lang.String> |
getAttributeNames() |
Returns an
Enumeration containing the
names of the attributes available to this request. |
<T> T |
getBean(java.lang.Class<T> requiredType) |
Return an instance of the bean that matches the given object type.
|
<T> T |
getBean(java.lang.Class<T> requiredType,
java.lang.String id) |
Return an instance of the bean that matches the given object type.
|
<T> T |
getBean(java.lang.String id) |
Return an instance of the bean that matches the given id.
|
<T> T |
getBean(java.lang.String id,
java.lang.Class<T> requiredType) |
Return an instance of the bean that matches the given id.
|
<T> T |
getBeforeAdviceResult(java.lang.String aspectId) |
Gets the before advice result.
|
<T> T |
getConfigBean(java.lang.Class<T> classType) |
Return the bean instance that matches the specified object type.
|
java.lang.String |
getDescription() |
Returns a description of this
Translet. |
Environment |
getEnvironment() |
Returns the environment of the current activity context.
|
FileParameter |
getFileParameter(java.lang.String name) |
Returns a
FileParameter object as a given activity's request parameter name,
or null if the parameter does not exist. |
java.util.Enumeration<java.lang.String> |
getFileParameterNames() |
Returns an
Enumeration of String objects containing
the names of the file parameters contained in this request. |
FileParameter[] |
getFileParameterValues(java.lang.String name) |
Returns an array of
FileParameter objects containing all
of the values the given activity's request parameter has,
or null if the parameter does not exist. |
<T> T |
getFinallyAdviceResult(java.lang.String aspectId) |
Gets the finally advice result.
|
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args) |
Try to resolve the message.
|
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage) |
Try to resolve the message.
|
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage,
java.util.Locale locale) |
Try to resolve the message.
|
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.util.Locale locale) |
Try to resolve the message.
|
java.lang.String |
getName() |
Returns the name of this
Translet. |
java.lang.String |
getParameter(java.lang.String name) |
Returns the value of an activity's request parameter as a
String,
or null if the parameter does not exist. |
java.util.Enumeration<java.lang.String> |
getParameterNames() |
Returns an
Enumeration of String objects containing
the names of the parameters contained in this request. |
java.lang.String[] |
getParameterValues(java.lang.String name) |
Returns an array of
String objects containing all
of the values the given activity's request parameter has,
or null if the parameter does not exist. |
ProcessResult |
getProcessResult() |
Returns the process result.
|
java.lang.Object |
getProcessResult(java.lang.String actionId) |
Returns a action result for the specified action id from the process result,
or
null if the action does not exist. |
java.lang.Throwable |
getRaisedException() |
Returns the raised exception instance.
|
<T> T |
getRequestAdaptee() |
Returns the adaptee object to provide request information.
|
RequestAdapter |
getRequestAdapter() |
Gets the request adapter.
|
java.lang.String |
getRequestEncoding() |
Returns the request encoding.
|
MethodType |
getRequestMethod() |
Gets the request http method.
|
<T> T |
getResponseAdaptee() |
Returns the adaptee object to provide response information.
|
ResponseAdapter |
getResponseAdapter() |
Gets the response adapter.
|
java.lang.String |
getResponseEncoding() |
Returns the response encoding.
|
java.lang.Throwable |
getRootCauseOfRaisedException() |
Returns the innermost one of the chained (wrapped) exceptions.
|
<T> T |
getSessionAdaptee() |
Returns the adaptee object to provide session information.
|
SessionAdapter |
getSessionAdapter() |
Gets the session adapter.
|
<T> T |
getSetting(java.lang.String settingName) |
Gets the setting value in the translet scope.
|
java.lang.Class<? extends CoreTranslet> |
getTransletImplementationClass() |
Returns an implementation class for the
Translet. |
java.lang.Class<? extends Translet> |
getTransletInterfaceClass() |
Returns an interface class for the
Translet. |
boolean |
isExceptionRaised() |
Returns whether the exception was thrown.
|
void |
redirect(RedirectResponseRule redirectResponseRule) |
Redirect a client according to the given rule.
|
void |
redirect(java.lang.String target) |
Redirect a client to a new target resource.
|
void |
redirect(java.lang.String target,
boolean immediately) |
Redirect a client to a new target resource.
|
void |
redirect(java.lang.String target,
java.util.Map<java.lang.String,java.lang.String> parameters) |
Redirect to the other target resource.
|
void |
removeAttribute(java.lang.String name) |
Removes an attribute from this request.
|
void |
removeFileParameter(java.lang.String name) |
Removes the file parameter with the specified name.
|
void |
response() |
Respond immediately, and the remaining jobs will be canceled.
|
void |
response(Response response) |
Respond immediately, and the remaining jobs will be canceled.
|
void |
setAttribute(java.lang.String name,
java.lang.Object value) |
Stores an attribute in this request.
|
void |
setFileParameter(java.lang.String name,
FileParameter fileParameter) |
Sets the
FileParameter object to the file parameter with the given name. |
void |
setFileParameter(java.lang.String name,
FileParameter[] fileParameters) |
Sets the value to the file parameter with the given name.
|
void |
setParameter(java.lang.String name,
java.lang.String value) |
Sets the value to the parameter with the given name.
|
void |
setParameter(java.lang.String name,
java.lang.String[] values) |
Sets the value to the parameter with the given name.
|
void |
setProcessResult(ProcessResult processResult) |
Sets the process result.
|
ProcessResult |
touchProcessResult() |
Returns the ProcessResult.
|
ProcessResult |
touchProcessResult(java.lang.String contentsName) |
Returns the process result with the contents name.
|
ProcessResult |
touchProcessResult(java.lang.String contentsName,
int initialCapacity) |
Returns the process result with the contents name.
|
void |
transform(TransformRule transformRule) |
Transformation according to a given rule, and transmits this response.
|
public CoreTranslet(CoreActivity activity)
activity - the current Activitypublic java.lang.String getName()
TransletTranslet.public java.lang.String getDescription()
TransletTranslet.getDescription in interface TransletTransletpublic MethodType getRequestMethod()
TransletgetRequestMethod in interface Transletpublic Environment getEnvironment()
TransletgetEnvironment in interface Transletpublic ApplicationAdapter getApplicationAdapter()
TransletgetApplicationAdapter in interface Transletpublic SessionAdapter getSessionAdapter()
TransletgetSessionAdapter in interface Transletpublic RequestAdapter getRequestAdapter()
TransletgetRequestAdapter in interface Transletpublic ResponseAdapter getResponseAdapter()
TransletgetResponseAdapter in interface Transletpublic <T> T getApplicationAdaptee()
TransletgetApplicationAdaptee in interface TransletT - the type of the application adapteepublic <T> T getSessionAdaptee()
TransletgetSessionAdaptee in interface TransletT - the type of the session adapteepublic <T> T getRequestAdaptee()
TransletgetRequestAdaptee in interface TransletT - the type of the request adapteepublic <T> T getResponseAdaptee()
TransletgetResponseAdaptee in interface TransletT - the type of the response adapteepublic java.lang.String getRequestEncoding()
TransletgetRequestEncoding in interface Transletpublic java.lang.String getResponseEncoding()
TransletgetResponseEncoding in interface Transletpublic ProcessResult getProcessResult()
TransletgetProcessResult in interface Transletpublic java.lang.Object getProcessResult(java.lang.String actionId)
Transletnull if the action does not exist.getProcessResult in interface TransletactionId - the specified action idpublic void setProcessResult(ProcessResult processResult)
TransletsetProcessResult in interface TransletprocessResult - the new process resultpublic ProcessResult touchProcessResult()
TranslettouchProcessResult in interface Transletpublic ProcessResult touchProcessResult(java.lang.String contentsName)
TranslettouchProcessResult in interface TransletcontentsName - the contents namepublic ProcessResult touchProcessResult(java.lang.String contentsName, int initialCapacity)
TranslettouchProcessResult in interface TransletcontentsName - the contents nameinitialCapacity - the initial capacity of the process resultpublic ActivityDataMap getActivityDataMap()
TransletgetActivityDataMap in interface Transletpublic ActivityDataMap getActivityDataMap(boolean prefill)
TransletgetActivityDataMap in interface Transletprefill - whether data pre-fill.public <T> T getSetting(java.lang.String settingName)
TransletgetSetting in interface TransletT - the type of the valuesettingName - the setting namepublic java.lang.String getParameter(java.lang.String name)
TransletString,
or null if the parameter does not exist.getParameter in interface Transletname - a String specifying the name of the parameterString representing the
single value of the parameterTranslet.getParameterValues(java.lang.String)public java.lang.String[] getParameterValues(java.lang.String name)
TransletString objects containing all
of the values the given activity's request parameter has,
or null if the parameter does not exist.getParameterValues in interface Transletname - a String specifying the name of the parameterString objects
containing the parameter's valuesTranslet.getParameter(java.lang.String)public java.util.Enumeration<java.lang.String> getParameterNames()
TransletEnumeration of String objects containing
the names of the parameters contained in this request.
If the request has no parameters, the method returns an empty Enumeration.getParameterNames in interface TransletEnumeration of String objects, each String
containing the name of a request parameter;
or an empty Enumeration if the request has no parameterspublic void setParameter(java.lang.String name,
java.lang.String value)
TransletsetParameter in interface Transletname - a String specifying the name of the parametervalue - a String representing the
single value of the parameterTranslet.setParameter(String, String[])public void setParameter(java.lang.String name,
java.lang.String[] values)
TransletsetParameter in interface Transletname - a String specifying the name of the parametervalues - an array of String objects
containing the parameter's valuesTranslet.setParameter(java.lang.String, java.lang.String)public java.util.Map<java.lang.String,java.lang.Object> getAllParameters()
TransletgetAllParameters in interface Transletpublic java.util.Map<java.lang.String,java.lang.Object> copyAllParameters()
TransletcopyAllParameters in interface Transletpublic void fillAllParameters(java.util.Map<java.lang.String,java.lang.Object> targetParameters)
TransletfillAllParameters in interface TranslettargetParameters - the target parameter map to be filledpublic FileParameter getFileParameter(java.lang.String name)
TransletFileParameter object as a given activity's request parameter name,
or null if the parameter does not exist.getFileParameter in interface Transletname - a String specifying the name of the file parameterFileParameter representing the
single value of the parameterTranslet.getFileParameterValues(java.lang.String)public FileParameter[] getFileParameterValues(java.lang.String name)
TransletFileParameter objects containing all
of the values the given activity's request parameter has,
or null if the parameter does not exist.getFileParameterValues in interface Transletname - a String specifying the name of the file parameterFileParameter objects
containing the parameter's valuesTranslet.getFileParameter(java.lang.String)public java.util.Enumeration<java.lang.String> getFileParameterNames()
TransletEnumeration of String objects containing
the names of the file parameters contained in this request.
If the request has no parameters, the method returns an empty Enumeration.getFileParameterNames in interface TransletEnumeration of String objects, each String
containing the name of a file parameter;
or an empty Enumeration if the request has no file parameterspublic void setFileParameter(java.lang.String name,
FileParameter fileParameter)
TransletFileParameter object to the file parameter with the given name.setFileParameter in interface Transletname - a String specifying the name of the file parameterfileParameter - a FileParameter representing the
single value of the parameterTranslet.setFileParameter(String, FileParameter[])public void setFileParameter(java.lang.String name,
FileParameter[] fileParameters)
TransletsetFileParameter in interface Transletname - a String specifying the name of the file parameterfileParameters - an array of FileParameter objects
containing the file parameter's valuesTranslet.setFileParameter(java.lang.String, com.aspectran.core.activity.request.parameter.FileParameter)public void removeFileParameter(java.lang.String name)
TransletremoveFileParameter in interface Transletname - a String specifying the name of the file parameterpublic <T> T getAttribute(java.lang.String name)
Transletnull if no attribute of the given name exists.getAttribute in interface TransletT - the generic typename - a String specifying the name of the attributeObject containing the value of the attribute,
or null if the attribute does not existpublic void setAttribute(java.lang.String name,
java.lang.Object value)
TransletsetAttribute in interface Transletname - specifying the name of the attributevalue - the Object to be storedpublic java.util.Enumeration<java.lang.String> getAttributeNames()
TransletEnumeration containing the
names of the attributes available to this request.
This method returns an empty Enumeration
if the request has no attributes available to it.getAttributeNames in interface Transletpublic void removeAttribute(java.lang.String name)
TransletremoveAttribute in interface Transletname - a String specifying the name of the attribute to removepublic java.util.Map<java.lang.String,java.lang.Object> getAllAttributes()
TransletMap of the request attributes,
with attribute names as map keys and attribute value as map value.getAllAttributes in interface Transletpublic void fillAttributeMap(java.util.Map<java.lang.String,java.lang.Object> attributeMap)
TransletfillAttributeMap in interface TransletattributeMap - the attribute mappublic void response()
Transletpublic void response(Response response)
Transletpublic void transform(TransformRule transformRule)
Transletpublic void dispatch(DispatchResponseRule dispatchResponseRule)
Transletpublic void dispatch(java.lang.String name)
Transletpublic void dispatch(java.lang.String name,
boolean immediately)
Transletpublic void redirect(RedirectResponseRule redirectResponseRule)
Transletpublic void redirect(java.lang.String target)
Transletpublic void redirect(java.lang.String target,
boolean immediately)
Transletimmediately is true, create a new redirect response rule
and override the intended redirect response rule.public void redirect(java.lang.String target,
java.util.Map<java.lang.String,java.lang.String> parameters)
Transletpublic void forward(ForwardResponseRule forwardResponseRule)
Transletpublic void forward(java.lang.String transletName)
Transletpublic void forward(java.lang.String transletName,
boolean immediately)
Transletpublic boolean isExceptionRaised()
TransletisExceptionRaised in interface Transletpublic java.lang.Throwable getRaisedException()
TransletgetRaisedException in interface Transletpublic java.lang.Throwable getRootCauseOfRaisedException()
TransletgetRootCauseOfRaisedException in interface Transletpublic boolean acceptsProfiles(java.lang.String... profiles)
TransletacceptsProfiles in interface Transletprofiles - the profilestrue if profile is active, otherwise falsepublic <T> T getAspectAdviceBean(java.lang.String aspectId)
TransletgetAspectAdviceBean in interface TransletT - the generic typeaspectId - the aspect idpublic <T> T getBeforeAdviceResult(java.lang.String aspectId)
TransletgetBeforeAdviceResult in interface TransletT - the generic typeaspectId - the aspect idpublic <T> T getAfterAdviceResult(java.lang.String aspectId)
TransletgetAfterAdviceResult in interface TransletT - the generic typeaspectId - the aspect idpublic <T> T getAroundAdviceResult(java.lang.String aspectId)
TransletgetAroundAdviceResult in interface TransletT - the generic typeaspectId - the aspect idpublic <T> T getFinallyAdviceResult(java.lang.String aspectId)
TransletgetFinallyAdviceResult in interface TransletT - the generic typeaspectId - the aspect idpublic java.lang.Class<? extends Translet> getTransletInterfaceClass()
TransletTranslet.getTransletInterfaceClass in interface Transletpublic java.lang.Class<? extends CoreTranslet> getTransletImplementationClass()
TransletTranslet.getTransletImplementationClass in interface Transletpublic <T> T getBean(java.lang.String id)
BeanRegistrygetBean in interface BeanRegistryT - the generic typeid - the id of the bean to retrievepublic <T> T getBean(java.lang.Class<T> requiredType)
BeanRegistrygetBean in interface BeanRegistryT - the generic typerequiredType - the type the bean must match; can be an interface or superclass. null is disallowed.public <T> T getBean(java.lang.String id,
java.lang.Class<T> requiredType)
BeanRegistrygetBean in interface BeanRegistryT - the generic typeid - the id of the bean to retrieverequiredType - type the bean must match; can be an interface or superclass. null is disallowed.public <T> T getBean(java.lang.Class<T> requiredType,
java.lang.String id)
BeanRegistrygetBean in interface BeanRegistryT - the generic typerequiredType - type the bean must match; can be an interface or superclass. null is allowed.id - the id of the bean to retrieve; if requiredType is null.public <T> T getConfigBean(java.lang.Class<T> classType)
BeanRegistryBeanNotOfRequiredTypeException.getConfigBean in interface BeanRegistryT - the generic typeclassType - type the bean must match; can be an interface or superclass. null is disallowed.public boolean containsBean(java.lang.String id)
BeanRegistrycontainsBean in interface BeanRegistryid - the id of the bean to querypublic boolean containsBean(java.lang.Class<?> requiredType)
BeanRegistrycontainsBean in interface BeanRegistryrequiredType - the object type of the bean to querypublic java.lang.String getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage,
java.util.Locale locale)
MessageSourcegetMessage in interface MessageSourcecode - the code to lookup up, such as 'calculator.noRateSet'. Users of
this class are encouraged to base message names on the relevant fully
qualified class name, thus avoiding conflict and ensuring maximum clarity.args - array of arguments that will be filled in for params within
the message (params look like "{0}", "{1,date}", "{2,time}" within a message),
or null if none.defaultMessage - String to return if the lookup failslocale - the Locale in which to do the lookupMessageFormatpublic java.lang.String getMessage(java.lang.String code,
java.lang.Object[] args,
java.util.Locale locale)
throws NoSuchMessageException
MessageSourcegetMessage in interface MessageSourcecode - the code to lookup up, such as 'calculator.noRateSet'args - Array of arguments that will be filled in for params within
the message (params look like "{0}", "{1,date}", "{2,time}" within a message),
or null if none.locale - the Locale in which to do the lookupNoSuchMessageException - if the message wasn't foundMessageFormatpublic java.lang.String getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage)
TransletgetMessage in interface Transletcode - the code to lookup up, such as 'calculator.noRateSet'. Users of
this class are encouraged to base message names on the relevant fully
qualified class name, thus avoiding conflict and ensuring maximum clarity.args - array of arguments that will be filled in for params within
the message (params look like "{0}", "{1,date}", "{2,time}" within a message),
or null if none.defaultMessage - String to return if the lookup failsMessageFormatpublic java.lang.String getMessage(java.lang.String code,
java.lang.Object[] args)
throws NoSuchMessageException
TransletgetMessage in interface Transletcode - the code to lookup up, such as 'calculator.noRateSet'args - Array of arguments that will be filled in for params within
the message (params look like "{0}", "{1,date}", "{2,time}" within a message),
or null if none.NoSuchMessageException - if the message wasn't foundMessageFormatCopyright © 2008–2018 The Aspectran Project. All rights reserved.