|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.service.request.Command
public final class Command
implements a Command used to control the pulse container.
It is initialised by the init(StringBuilder,ServiceRequest) method
where it parses the request string and thereof derives the current locale,
mode, bundle, action and the parameters of the current request. New instances
of the command should be created by the newInstance or
createCopy methods.
The pulse command URIs are structured as follows:
| path to servlet | parsable URI part | suffix and request parameters |
|---|---|---|
http://some.server.com/webapp/ServletName/ |
{locale}.{bundle}.{action}.{sitemapID}.{pulseParameters}/ |
{suffix}?{httpParameters} |
Below the parsable part is explained in more detail:
Locale (e.g. 'de_DE_EURO')Bundle).Action).SitemapNode the
Command is associated with (see: View, SitemapNode)URI. The default suffix is index.html.
In the case of file uploads, via multipart/form-data an
UploadProgress can be added by adding the
pulseParameter addUploadProgress with an
per-session unique identifier as the value.
| Constructor Summary | |
|---|---|
Command()
raw constructor for pulse internal purposes. |
|
| Method Summary | |
|---|---|
Command |
addHttpParameter(Parameter p)
adds an HTTP Parameter to the Command. |
Command |
addHttpParameter(java.lang.String name,
java.util.List<java.lang.String> values)
adds an HTTP Parameter to the Command. |
Command |
addHttpParameter(java.lang.String name,
java.lang.String value)
adds an HTTP Parameter to the Command. |
Command |
addPulseParameter(Parameter p)
adds an HTTP Parameter to the Command. |
Command |
addPulseParameter(java.lang.String name,
java.util.List<java.lang.String> values)
adds a Parameter to the Command. |
Command |
addPulseParameter(java.lang.String name,
java.lang.String value)
adds an HTTP Parameter to the Command. |
Command |
clearParameters()
clears all parameters of the Command. |
Command |
createCopy()
returns a deep copy of the Command. |
Command |
createCopy(boolean withParams)
returns a copy of the Command either with or without its
parameters. |
org.jdom.Element |
deserializeToJDOM()
this will deserialize the state of the JDOMable as a JDOM
Element. |
boolean |
equals(java.lang.Object obj)
returns whether the given object is equal to the Command. |
static Command |
fromParsable(java.lang.String parsable, ServiceRequest sr)
utility method to build a Command from a parsable fragment. |
protected java.lang.String |
generateParsableCommandURI(java.util.Locale localeParam, ServiceSession session)
generates an URL fragment containing the locale, mode, bundle, action and pulse-parameters. |
java.lang.String |
getAction()
|
java.lang.String |
getBundle()
|
long |
getETagValue()
returns the ETag value for this command. |
Parameter |
getHttpParameter(java.lang.String name)
gets a pulse parameter by name. |
java.util.List<Parameter> |
getHttpParameters()
returns the HTTP parameters of the Command. |
java.util.Locale |
getLocale()
|
Parameter |
getParameter(java.lang.String name)
|
java.util.List<java.lang.String> |
getParameterNames()
|
java.util.Set<Parameter> |
getParameters()
|
protected java.util.Set<Parameter> |
getParametersJAXB()
For JAXB only. |
Parameter |
getPulseParameter(java.lang.String name)
gets a pulse parameter by name. |
java.util.List<Parameter> |
getPulseParameters()
returns the pulse parameters of the Command. |
Action.Security |
getSecurity()
returns the current security setting of the command. |
java.lang.Long |
getSitemapID()
|
java.lang.String |
getSuffix()
returns the suffix that is added after the parsable command URI. |
int |
hashCode()
returns the hash code for the Command. |
Command |
init(java.lang.StringBuilder parsable, ServiceRequest sr)
initialises the command from the given parsable part and updates the service request where necessary. |
boolean |
isTokenValid(ServiceSession session)
checks whether the current Command requires a token and if the
token is valid. |
Command |
newInstance(java.util.Locale newLocale,
java.lang.String newBundle,
java.lang.String newAction,
java.util.List<Parameter> pulseParams,
java.util.List<Parameter> httpParams)
|
Command |
newInstance(java.util.Locale newLocale,
java.lang.String newBundle,
java.lang.String newAction,
java.util.Set<Parameter> params)
|
Command |
removeHttpParameter(java.lang.String name)
removes a pulse parameter by name. |
Command |
removeParameter(Parameter parameter)
Removes the Parameter parameter from the Command. |
Command |
removeParameter(java.lang.String name)
removes the Parameter with the given name from the
Command. |
Command |
removePulseParameter(java.lang.String name)
removes a pulse parameter by name. |
Command |
setAction(java.lang.String act)
Use for testing only. |
Command |
setBundle(java.lang.String name)
sets the name of the Bundle. |
Command |
setHttpParameters(java.util.Map<java.lang.String,Parameter> hp)
sets the HttpParameters of the Command. |
Command |
setLocale(java.util.Locale loc)
sets the Locale of the Command. |
Command |
setLocaleFormString(java.lang.String localeString)
set the locale for the Command from a locale string. |
Command |
setPulseParameters(java.util.Map<java.lang.String,Parameter> pp)
sets the Parameters of the Command. |
Command |
setSecurity(Action.Security s)
sets the level of security to be used when generating the command. |
Command |
setSitemapID(java.lang.Long id)
sets the id of the SitemapNode referenced by the Command. |
Command |
setSuffix(java.lang.String s)
sets the suffix that is added after the parsable command URI (default: index.html). |
java.lang.String |
toCommandURL(ServiceRequest request)
|
java.lang.String |
toCommandURL(ServiceRequest request,
java.util.Locale localeParam)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Command()
| Method Detail |
|---|
protected java.lang.String generateParsableCommandURI(java.util.Locale localeParam, ServiceSession session)
localeParam - the Locale as parameter.session - the service session for access to the token secret
public Command init(java.lang.StringBuilder parsable, ServiceRequest sr)
parsable - the parsable part of the URLsr - the service request
UnparsableRequestException - on errors extracting the commandpublic boolean isTokenValid(ServiceSession session)
Command requires a token and if the
token is valid.
session - the current session to access the secret
false, if and only if, the current Command is
requiring a token for execution and the given token is wrong.
Otherwise true.public Action.Security getSecurity()
public Command setSecurity(Action.Security s)
s - the level of security to be used when generating the command.
public java.util.Locale getLocale()
getLocale()public Command setLocale(java.util.Locale loc)
Locale of the Command.
loc - the locale to set
public Command setLocaleFormString(java.lang.String localeString)
localeString - the locale string
public java.lang.String getBundle()
getBundle()public Command setBundle(java.lang.String name)
Bundle.
name - the name of the Bundle to set
public java.lang.String getAction()
getAction()public Command setAction(java.lang.String act)
act - the action to set
public java.lang.Long getSitemapID()
SitemapNode reference by the Command or
null, if no SitemapNode is referenced.public Command setSitemapID(java.lang.Long id)
SitemapNode referenced by the Command.
id - the id of the SitemapNode referenced by the
Command or null, if no SitemapNode is
referenced.
public java.util.List<Parameter> getPulseParameters()
Command.
Commandpublic Command setPulseParameters(java.util.Map<java.lang.String,Parameter> pp)
Parameters of the Command.
pp - the pulse parameters to set
public java.util.List<Parameter> getHttpParameters()
Command.
Commandpublic Command setHttpParameters(java.util.Map<java.lang.String,Parameter> hp)
Command.
hp - the HTTP parameters to set
public Parameter getParameter(java.lang.String name)
name - the name of the parameter to fetch
getParameter(java.lang.String)public java.util.List<java.lang.String> getParameterNames()
getParameterNames()public java.util.Set<Parameter> getParameters()
getParameters()protected java.util.Set<Parameter> getParametersJAXB()
Command
public Command addPulseParameter(java.lang.String name,
java.util.List<java.lang.String> values)
Parameter to the Command.
name - the namevalues - the values
Command
public Command addPulseParameter(java.lang.String name,
java.lang.String value)
Command.
name - the namevalue - the value
Commandpublic Command addPulseParameter(Parameter p)
Command.
p - the parameter
Commandpublic Parameter getPulseParameter(java.lang.String name)
name - the name of the parameter
public Command removePulseParameter(java.lang.String name)
name - the name of the parameter
Command
public Command addHttpParameter(java.lang.String name,
java.util.List<java.lang.String> values)
Command.
name - the namevalues - the values
Command
public Command addHttpParameter(java.lang.String name,
java.lang.String value)
Command.
name - the namevalue - the value
Commandpublic Command addHttpParameter(Parameter p)
Command.
p - the parameter
Commandpublic Parameter getHttpParameter(java.lang.String name)
name - the name of the parameter
public Command removeHttpParameter(java.lang.String name)
name - the name of the parameter
Commandpublic Command removeParameter(Parameter parameter)
Parameter parameter from the Command.
parameter - the Parameter to be removed from the Command
Commandpublic Command removeParameter(java.lang.String name)
Parameter with the given name from the
Command.
name - the name of the Parameter to be removed
Commandpublic Command clearParameters()
Command.
Commandpublic java.lang.String getSuffix()
public Command setSuffix(java.lang.String s)
index.html).
s - the suffix to be added
public Command newInstance(java.util.Locale newLocale,
java.lang.String newBundle,
java.lang.String newAction,
java.util.Set<Parameter> params)
newLocale - the Locale for the new commandnewBundle - the application of the new commandnewAction - the action of the new commandparams - the parameters to add to the new command
public Command newInstance(java.util.Locale newLocale,
java.lang.String newBundle,
java.lang.String newAction,
java.util.List<Parameter> pulseParams,
java.util.List<Parameter> httpParams)
newLocale - the Locale for the new commandnewBundle - the application of the new commandnewAction - the action of the new commandpulseParams - the pulse parameters to add to the new commandhttpParams - the HTTP parameters to add to the new command
public java.lang.String toCommandURL(ServiceRequest request)
request - the service request
public java.lang.String toCommandURL(ServiceRequest request,
java.util.Locale localeParam)
request - the service requestlocaleParam - the local for the command
public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
Command.
hashCode in class java.lang.Objectpublic long getETagValue()
public boolean equals(java.lang.Object obj)
Command.
The given object is considered equal, if and only if, it is also a
Command with the same locale, bundle, action, sitemap ID and
parameters.
equals in class java.lang.Objectobj - the object to compare against
true, if and only if, the given object is equal to this
command. Otherwise false.public org.jdom.Element deserializeToJDOM()
JDOMableJDOMable as a JDOM
Element.
deserializeToJDOM in interface JDOMableElement representing the Command .public Command createCopy()
Command.
Commandpublic Command createCopy(boolean withParams)
Command either with or without its
parameters.
withParams - a flag indicating whether or not to copy the parameters as
well
Command either with or without its
parameterspublic static Command fromParsable(java.lang.String parsable, ServiceRequest sr)
Command from a parsable fragment.
parsable - the fragmentsr - the current request
Command
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||