Package com.aspectran.core.activity
Interface Translet
-
- All Known Implementing Classes:
AbstractTranslet,CoreTranslet
public interface TransletThe Interface Translet.Created: 2008. 7. 5. AM 12:35:44
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanacceptsProfiles(java.lang.String... profiles)Return whether the given profile is active.booleancontainsBean(java.lang.Class<?> type)Return whether a bean with the specified object type is present.booleancontainsBean(java.lang.Class<?> type, java.lang.String id)booleancontainsBean(java.lang.String id)Return whether a bean with the specified id is present.voiddispatch(DispatchRule dispatchRule)Dispatch to other resources as the given rule.voiddispatch(java.lang.String name)Dispatch to other resources as the given name.voiddispatch(java.lang.String name, java.lang.String dispatcherName)Dispatch to other resources as the given name.voidextractParameters(java.util.Map<java.lang.String,java.lang.Object> targetParameters)Extracts all the parameters and fills in the specified map.voidforward(ForwardRule forwardRule)Forward according to a given rule.voidforward(java.lang.String transletName)Forward to the specified translet immediately.ActivityDataMapgetActivityDataMap()Returns an Activity Data Map containing the activity result data.<V> VgetAfterAdviceResult(java.lang.String aspectId)Gets the after advice result.java.util.Map<java.lang.String,java.lang.Object>getAllParameters()Return an mutable Map of the request parameters, with parameter names as map keys and parameter values as map values.ApplicationAdaptergetApplicationAdapter()Gets the application adapter.<V> VgetAroundAdviceResult(java.lang.String aspectId)Gets the around advice result.<V> VgetAspectAdviceBean(java.lang.String aspectId)Gets the aspect advice bean.<V> VgetAttribute(java.lang.String name)Returns the value of the named attribute as a given type, ornullif no attribute of the given name exists.java.util.Collection<java.lang.String>getAttributeNames()Returns aCollectioncontaining the names of the attributes available to this request.<V> VgetBean(java.lang.Class<V> type)Return an instance of the bean that matches the given object type.<V> VgetBean(java.lang.Class<V> type, java.lang.String id)Return an instance of the bean that matches the given object type.<V> VgetBean(java.lang.String id)Return an instance of the bean that matches the given id.<V> VgetBeforeAdviceResult(java.lang.String aspectId)Gets the before advice result.ResponsegetDeclaredResponse()Returns the originally declared response.java.lang.StringgetDescription()Returns a description of thisTranslet.EnvironmentgetEnvironment()Returns the environment of the current activity context.FileParametergetFileParameter(java.lang.String name)Returns aFileParameterobject as a given activity's request parameter name, ornullif the parameter does not exist.java.util.Collection<java.lang.String>getFileParameterNames()Returns aCollectionofStringobjects containing the names of the file parameters contained in this request.FileParameter[]getFileParameterValues(java.lang.String name)Returns an array ofFileParameterobjects containing all of the values the given activity's request parameter has, ornullif the parameter does not exist.<V> VgetFinallyAdviceResult(java.lang.String aspectId)Gets the finally advice result.java.lang.StringgetIntendedRequestEncoding()Returns the intended request encoding.java.lang.StringgetIntendedResponseEncoding()Returns the intended response encoding.java.lang.StringgetMessage(java.lang.String code, java.lang.Object[] args)Try to resolve the message.java.lang.StringgetMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage)Try to resolve the message.java.lang.StringgetMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage, java.util.Locale locale)Try to resolve the message.java.lang.StringgetMessage(java.lang.String code, java.lang.Object[] args, java.util.Locale locale)Try to resolve the message.java.lang.StringgetParameter(java.lang.String name)Returns the value of an activity's request parameter as aString, ornullif the parameter does not exist.java.util.Collection<java.lang.String>getParameterNames()Returns aCollectionofStringobjects containing the names of the parameters contained in this request.java.lang.String[]getParameterValues(java.lang.String name)Returns an array ofStringobjects containing all of the values the given activity's request parameter has, ornullif the parameter does not exist.ProcessResultgetProcessResult()Returns the process result.java.lang.ObjectgetProcessResult(java.lang.String actionId)Returns a action result for the specified action id from the process result, ornullif the action does not exist.<V> VgetProperty(java.lang.String name)Returns the value of the property on environment.java.lang.ThrowablegetRaisedException()Returns the raised exception instance.<V> VgetRequestAdaptee()Returns the adaptee object to provide request information.RequestAdaptergetRequestAdapter()Gets the request adapter.MethodTypegetRequestMethod()Gets the request http method.java.lang.StringgetRequestName()Returns the request name for thisTranslet.<V> VgetResponseAdaptee()Returns the adaptee object to provide response information.ResponseAdaptergetResponseAdapter()Gets the response adapter.java.lang.ThrowablegetRootCauseOfRaisedException()Returns the innermost one of the chained (wrapped) exceptions.<V> VgetSessionAdaptee()Returns the adaptee object to provide session information.SessionAdaptergetSessionAdapter()Gets the session adapter.<V> VgetSetting(java.lang.String settingName)Gets the setting value in the translet scope.booleanhasPathVariables()Returns whether the translet name has tokens for extracting parameters or attributes.booleanisExceptionRaised()Returns whether the exception was thrown.voidredirect(RedirectRule redirectRule)Redirect a client according to the given rule.voidredirect(java.lang.String path)Redirect a client to a new target resource.voidredirect(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> parameters)Redirect to the other target resource.voidremoveAttribute(java.lang.String name)Removes an attribute from this request.voidremoveFileParameter(java.lang.String name)Removes the file parameter with the specified name.voidremoveRaisedException()Remove the raised exception.voidresponse()Respond immediately, and the remaining jobs will be canceled.voidresponse(Response response)Respond immediately, and the remaining jobs will be canceled.voidsetAttribute(java.lang.String name, java.lang.Object value)Stores an attribute in this request.voidsetFileParameter(java.lang.String name, FileParameter fileParameter)Sets theFileParameterobject to the file parameter with the given name.voidsetFileParameter(java.lang.String name, FileParameter[] fileParameters)Sets the value to the file parameter with the given name.voidsetParameter(java.lang.String name, java.lang.String value)Sets the value to the parameter with the given name.voidsetParameter(java.lang.String name, java.lang.String[] values)Sets the value to the parameter with the given name.voidsetProcessResult(ProcessResult processResult)Sets the process result.voidtransform(CustomTransformer transformer)voidtransform(TransformRule transformRule)Transformation according to a given rule, and transmits this response.
-
-
-
Method Detail
-
getRequestName
java.lang.String getRequestName()
Returns the request name for thisTranslet.- Returns:
- the request name
-
getRequestMethod
MethodType getRequestMethod()
Gets the request http method.- Returns:
- the request method
-
getDescription
java.lang.String getDescription()
Returns a description of thisTranslet.- Returns:
- a description of this
Translet
-
getEnvironment
Environment getEnvironment()
Returns the environment of the current activity context.- Returns:
- the environment
-
getApplicationAdapter
ApplicationAdapter getApplicationAdapter()
Gets the application adapter.- Returns:
- the application adapter
-
getSessionAdapter
SessionAdapter getSessionAdapter()
Gets the session adapter.- Returns:
- the session adapter
-
getRequestAdapter
RequestAdapter getRequestAdapter()
Gets the request adapter.- Returns:
- the request adapter
-
getResponseAdapter
ResponseAdapter getResponseAdapter()
Gets the response adapter.- Returns:
- the response adapter
-
getSessionAdaptee
<V> V getSessionAdaptee()
Returns the adaptee object to provide session information.- Type Parameters:
V- the type of the session adaptee- Returns:
- the session adaptee object
-
getRequestAdaptee
<V> V getRequestAdaptee()
Returns the adaptee object to provide request information.- Type Parameters:
V- the type of the request adaptee- Returns:
- the request adaptee object
-
getResponseAdaptee
<V> V getResponseAdaptee()
Returns the adaptee object to provide response information.- Type Parameters:
V- the type of the response adaptee- Returns:
- the response adaptee object
-
getIntendedRequestEncoding
java.lang.String getIntendedRequestEncoding()
Returns the intended request encoding.- Returns:
- the intended request encoding
-
getIntendedResponseEncoding
java.lang.String getIntendedResponseEncoding()
Returns the intended response encoding.- Returns:
- the intended response encoding
-
getProcessResult
ProcessResult getProcessResult()
Returns the process result.- Returns:
- the process result
-
getProcessResult
java.lang.Object getProcessResult(java.lang.String actionId)
Returns a action result for the specified action id from the process result, ornullif the action does not exist.- Parameters:
actionId- the specified action id- Returns:
- the action result
-
setProcessResult
void setProcessResult(ProcessResult processResult)
Sets the process result.- Parameters:
processResult- the new process result
-
getActivityDataMap
ActivityDataMap getActivityDataMap()
Returns an Activity Data Map containing the activity result data.- Returns:
- the activity data map
-
getSetting
<V> V getSetting(java.lang.String settingName)
Gets the setting value in the translet scope.- Type Parameters:
V- the type of the value- Parameters:
settingName- the setting name- Returns:
- the setting value
-
getProperty
<V> V getProperty(java.lang.String name)
Returns the value of the property on environment.- Type Parameters:
V- the type of the value- Parameters:
name- the given property name- Returns:
- the value of the property on environment
-
getParameter
java.lang.String getParameter(java.lang.String name)
Returns the value of an activity's request parameter as aString, ornullif the parameter does not exist.- Parameters:
name- aStringspecifying the name of the parameter- Returns:
- a
Stringrepresenting the single value of the parameter - See Also:
getParameterValues(java.lang.String)
-
getParameterValues
java.lang.String[] getParameterValues(java.lang.String name)
Returns an array ofStringobjects containing all of the values the given activity's request parameter has, ornullif the parameter does not exist.- Parameters:
name- aStringspecifying the name of the parameter- Returns:
- an array of
Stringobjects containing the parameter's values - See Also:
getParameter(java.lang.String)
-
getParameterNames
java.util.Collection<java.lang.String> getParameterNames()
Returns aCollectionofStringobjects containing the names of the parameters contained in this request. If the request has no parameters, the method returns an emptyCollection.- Returns:
- an
CollectionofStringobjects, eachStringcontaining the name of a request parameter; or an emptyCollectionif the request has no parameters
-
setParameter
void setParameter(java.lang.String name, java.lang.String value)Sets the value to the parameter with the given name.- Parameters:
name- aStringspecifying the name of the parametervalue- aStringrepresenting the single value of the parameter- See Also:
setParameter(String, String[])
-
setParameter
void setParameter(java.lang.String name, java.lang.String[] values)Sets the value to the parameter with the given name.- Parameters:
name- aStringspecifying the name of the parametervalues- an array ofStringobjects containing the parameter's values- See Also:
setParameter(java.lang.String, java.lang.String)
-
getAllParameters
java.util.Map<java.lang.String,java.lang.Object> getAllParameters()
Return an mutable Map of the request parameters, with parameter names as map keys and parameter values as map values. If the parameter value type is theStringthen map value will be of typeString. If the parameter value type is theStringarray then map value will be of typeStringarray.- Returns:
- the mutable parameter map
- Since:
- 1.4.0
-
extractParameters
void extractParameters(java.util.Map<java.lang.String,java.lang.Object> targetParameters)
Extracts all the parameters and fills in the specified map.- Parameters:
targetParameters- the target parameter map to be filled- Since:
- 2.0.0
-
getFileParameter
FileParameter getFileParameter(java.lang.String name)
Returns aFileParameterobject as a given activity's request parameter name, ornullif the parameter does not exist.- Parameters:
name- aStringspecifying the name of the file parameter- Returns:
- a
FileParameterrepresenting the single value of the parameter - See Also:
getFileParameterValues(java.lang.String)
-
getFileParameterValues
FileParameter[] getFileParameterValues(java.lang.String name)
Returns an array ofFileParameterobjects containing all of the values the given activity's request parameter has, ornullif the parameter does not exist.- Parameters:
name- aStringspecifying the name of the file parameter- Returns:
- an array of
FileParameterobjects containing the parameter's values - See Also:
getFileParameter(java.lang.String)
-
getFileParameterNames
java.util.Collection<java.lang.String> getFileParameterNames()
Returns aCollectionofStringobjects containing the names of the file parameters contained in this request. If the request has no parameters, the method returns an emptyCollection.- Returns:
- an
CollectionofStringobjects, eachStringcontaining the name of a file parameter; or an emptyCollectionif the request has no file parameters
-
setFileParameter
void setFileParameter(java.lang.String name, FileParameter fileParameter)Sets theFileParameterobject to the file parameter with the given name.- Parameters:
name- aStringspecifying the name of the file parameterfileParameter- aFileParameterrepresenting the single value of the parameter- See Also:
setFileParameter(String, FileParameter[])
-
setFileParameter
void setFileParameter(java.lang.String name, FileParameter[] fileParameters)Sets the value to the file parameter with the given name.- Parameters:
name- aStringspecifying the name of the file parameterfileParameters- an array ofFileParameterobjects containing the file parameter's values- See Also:
setFileParameter(java.lang.String, com.aspectran.core.activity.request.FileParameter)
-
removeFileParameter
void removeFileParameter(java.lang.String name)
Removes the file parameter with the specified name.- Parameters:
name- aStringspecifying the name of the file parameter
-
getAttribute
<V> V getAttribute(java.lang.String name)
Returns the value of the named attribute as a given type, ornullif no attribute of the given name exists.- Type Parameters:
V- the result type of the bean- Parameters:
name- aStringspecifying the name of the attribute- Returns:
- an
Objectcontaining the value of the attribute, ornullif the attribute does not exist
-
setAttribute
void setAttribute(java.lang.String name, java.lang.Object value)Stores an attribute in this request.- Parameters:
name- specifying the name of the attributevalue- theObjectto be stored
-
getAttributeNames
java.util.Collection<java.lang.String> getAttributeNames()
Returns aCollectioncontaining the names of the attributes available to this request. This method returns an emptyCollectionif the request has no attributes available to it.- Returns:
- the attribute names
-
removeAttribute
void removeAttribute(java.lang.String name)
Removes an attribute from this request.- Parameters:
name- aStringspecifying the name of the attribute to remove
-
getDeclaredResponse
Response getDeclaredResponse()
Returns the originally declared response.- Returns:
- the declared response
- Since:
- 5.2.0
-
response
void response()
Respond immediately, and the remaining jobs will be canceled.
-
response
void response(Response response)
Respond immediately, and the remaining jobs will be canceled.- Parameters:
response- the response
-
transform
void transform(TransformRule transformRule)
Transformation according to a given rule, and transmits this response.- Parameters:
transformRule- the transformation rule
-
transform
void transform(CustomTransformer transformer)
-
dispatch
void dispatch(java.lang.String name)
Dispatch to other resources as the given name.- Parameters:
name- the dispatch name
-
dispatch
void dispatch(java.lang.String name, java.lang.String dispatcherName)Dispatch to other resources as the given name.- Parameters:
name- the dispatch namedispatcherName- the id or class name of the view dispatcher bean
-
dispatch
void dispatch(DispatchRule dispatchRule)
Dispatch to other resources as the given rule.- Parameters:
dispatchRule- the dispatch rule
-
forward
void forward(java.lang.String transletName)
Forward to the specified translet immediately.- Parameters:
transletName- the translet name of the target to be forwarded
-
forward
void forward(ForwardRule forwardRule)
Forward according to a given rule.- Parameters:
forwardRule- the forward rule
-
redirect
void redirect(java.lang.String path)
Redirect a client to a new target resource. If an intended redirect rule exists, that may be used.- Parameters:
path- the redirect path
-
redirect
void redirect(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> parameters)Redirect to the other target resource.- Parameters:
path- the redirect pathparameters- the parameters
-
redirect
void redirect(RedirectRule redirectRule)
Redirect a client according to the given rule.- Parameters:
redirectRule- the redirect rule
-
isExceptionRaised
boolean isExceptionRaised()
Returns whether the exception was thrown.- Returns:
- true, if is exception raised
-
getRaisedException
java.lang.Throwable getRaisedException()
Returns the raised exception instance.- Returns:
- the raised exception instance
-
getRootCauseOfRaisedException
java.lang.Throwable getRootCauseOfRaisedException()
Returns the innermost one of the chained (wrapped) exceptions.- Returns:
- the innermost one of the chained (wrapped) exceptions
-
removeRaisedException
void removeRaisedException()
Remove the raised exception.
-
acceptsProfiles
boolean acceptsProfiles(java.lang.String... profiles)
Return whether the given profile is active. If active profiles are empty whether the profile should be active by default.- Parameters:
profiles- the profiles- Returns:
trueif profile is active, otherwisefalse
-
getAspectAdviceBean
<V> V getAspectAdviceBean(java.lang.String aspectId)
Gets the aspect advice bean.- Type Parameters:
V- the result type of the advice- Parameters:
aspectId- the aspect id- Returns:
- the aspect advice bean
-
getBeforeAdviceResult
<V> V getBeforeAdviceResult(java.lang.String aspectId)
Gets the before advice result.- Type Parameters:
V- the result type of the before advice- Parameters:
aspectId- the aspect id- Returns:
- the before advice result
-
getAfterAdviceResult
<V> V getAfterAdviceResult(java.lang.String aspectId)
Gets the after advice result.- Type Parameters:
V- the result type of the after advice- Parameters:
aspectId- the aspect id- Returns:
- the after advice result
-
getAroundAdviceResult
<V> V getAroundAdviceResult(java.lang.String aspectId)
Gets the around advice result.- Type Parameters:
V- the result type of the around advice- Parameters:
aspectId- the aspect id- Returns:
- the around advice result
-
getFinallyAdviceResult
<V> V getFinallyAdviceResult(java.lang.String aspectId)
Gets the finally advice result.- Type Parameters:
V- the result type of the finally advice- Parameters:
aspectId- the aspect id- Returns:
- the finally advice result
-
hasPathVariables
boolean hasPathVariables()
Returns whether the translet name has tokens for extracting parameters or attributes.- Returns:
- true if the translet name has tokens for extracting parameters or attributes
-
getBean
<V> V getBean(java.lang.String id)
Return an instance of the bean that matches the given id.- Type Parameters:
V- the result type of the bean- Parameters:
id- the id of the bean to retrieve- Returns:
- an instance of the bean
-
getBean
<V> V getBean(java.lang.Class<V> type)
Return an instance of the bean that matches the given object type.- Type Parameters:
V- the result type of the bean- Parameters:
type- the type the bean must match; can be an interface or superclass.nullis disallowed.- Returns:
- an instance of the bean
- Since:
- 1.3.1
-
getBean
<V> V getBean(java.lang.Class<V> type, java.lang.String id)Return an instance of the bean that matches the given object type.- Type Parameters:
V- the result type of the bean- Parameters:
type- type the bean must match; can be an interface or superclass.nullis allowed.id- the id of the bean to retrieve- Returns:
- an instance of the bean
- Since:
- 2.0.0
-
containsBean
boolean containsBean(java.lang.String id)
Return whether a bean with the specified id is present.- Parameters:
id- the id of the bean to query- Returns:
- whether a bean with the specified id is present
-
containsBean
boolean containsBean(java.lang.Class<?> type)
Return whether a bean with the specified object type is present.- Parameters:
type- the object type of the bean to query- Returns:
- whether a bean with the specified type is present
-
containsBean
boolean containsBean(java.lang.Class<?> type, java.lang.String id)
-
getMessage
java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.lang.String defaultMessage)Try to resolve the message. Return default message if no message was found.- Parameters:
code- 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), ornullif none.defaultMessage- String to return if the lookup fails- Returns:
- the resolved message if the lookup was successful; otherwise the default message passed as a parameter
- See Also:
MessageFormat
-
getMessage
java.lang.String getMessage(java.lang.String code, java.lang.Object[] args) throws NoSuchMessageExceptionTry to resolve the message. Treat as an error if the message can't be found.- Parameters:
code- 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), ornullif none.- Returns:
- the resolved message
- Throws:
NoSuchMessageException- if the message wasn't found- See Also:
MessageFormat
-
getMessage
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. Return default message if no message was found.- Parameters:
code- 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), ornullif none.defaultMessage- String to return if the lookup failslocale- the Locale in which to do the lookup- Returns:
- the resolved message if the lookup was successful; otherwise the default message passed as a parameter
- See Also:
MessageFormat
-
getMessage
java.lang.String getMessage(java.lang.String code, java.lang.Object[] args, java.util.Locale locale) throws NoSuchMessageExceptionTry to resolve the message. Treat as an error if the message can't be found.- Parameters:
code- 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), ornullif none.locale- the Locale in which to do the lookup- Returns:
- the resolved message
- Throws:
NoSuchMessageException- if the message wasn't found- See Also:
MessageFormat
-
-