|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.stripes.action.OnwardResolution<T>
public abstract class OnwardResolution<T extends OnwardResolution<T>>
Abstract class that provides a consistent API for all Resolutions that send the user onward to another view - either by forwarding, redirecting or some other mechanism. Provides methods for getting and setting the path that the user should be sent to next.
The rather odd looking generic declaration on this class is called a self-bounding generic
type. The declaration allows methods in this class like addParameter(String, Object...)
to return the appropriate type when accessed through subclasses. I.e.
RedirectResolution.addParameter(String, Object...)
will return a reference of type
RedirectResolution instead of OnwardResolution.
Constructor Summary | |
---|---|
OnwardResolution(Class<? extends ActionBean> beanType)
Constructor that will extract the url binding for the ActionBean class supplied and use that as the path for the resolution. |
|
OnwardResolution(Class<? extends ActionBean> beanType,
String event)
Constructor that will extract the url binding for the ActionBean class supplied and use that as the path for the resolution and adds a parameter to ensure that the specified event is invoked. |
|
OnwardResolution(String path)
Default constructor that takes the supplied path and stores it for use. |
Method Summary | |
---|---|
T |
addParameter(String name,
Object... values)
Adds a request parameter with zero or more values to the URL. |
T |
addParameters(Map<String,? extends Object> parameters)
Bulk adds one or more request parameters to the URL. |
protected String |
getAnchor()
Get the name of the anchor to be appended to the URL. |
Map<String,Object> |
getParameters()
Provides access to the Map of parameters that has been accumulated so far for this resolution. |
String |
getPath()
Accessor for the path that the user should be sent to. |
String |
getUrl()
Deprecated. As of Stripes 1.5, this method has been replaced by getUrl(Locale) . |
String |
getUrl(Locale locale)
Constructs the URL for the resolution by taking the path and appending any parameters supplied. |
protected T |
setAnchor(String anchor)
Set the name of the anchor to be appended to the URL. |
void |
setPath(String path)
Setter for the path that the user should be sent to. |
String |
toString()
Method that will work for this class and subclasses; returns a String containing the class name, and the path to which it will send the user. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sourceforge.stripes.action.Resolution |
---|
execute |
Constructor Detail |
---|
public OnwardResolution(String path)
path
- the path to which the resolution should navigatepublic OnwardResolution(Class<? extends ActionBean> beanType)
beanType
- a Class that represents an ActionBeanpublic OnwardResolution(Class<? extends ActionBean> beanType, String event)
beanType
- a Class that represents an ActionBeanevent
- the String name of the event to trigger on navigationMethod Detail |
---|
public String getPath()
public void setPath(String path)
protected String getAnchor()
protected T setAnchor(String anchor)
public String toString()
toString
in class Object
public T addParameter(String name, Object... values)
Adds a request parameter with zero or more values to the URL. Values may be supplied using varargs, or alternatively by suppling a single value parameter which is an instance of Collection.
Note that this method is additive. Therefore writing things like
builder.addParameter("p", "one").addParameter("p", "two");
will add both p=one
and p=two
to the URL.
name
- the name of the URL parametervalues
- zero or more scalar values, or a single Collection
public T addParameters(Map<String,? extends Object> parameters)
Bulk adds one or more request parameters to the URL. Each entry in the Map represents a single named parameter, with the values being either a scalar value, an array or a Collection.
Note that this method is additive. If a parameter with name X has already been added and the map contains X as a key, the value(s) in the map will be added to the URL as well as the previously held values for X.
parameters
- a Map of parameters as described above
public Map<String,Object> getParameters()
Provides access to the Map of parameters that has been accumulated so far for this resolution. The reference returned is to the internal parameters map! As such any changed made to the Map will be reflected in the Resolution, and any subsequent calls to addParameter(s) will be reflected in the Map.
@Deprecated public String getUrl()
getUrl(Locale)
.
public String getUrl(Locale locale)
locale
- the locale to be used by Formatter
s when formatting parameters
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |