|
PAJES 3.0.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pajes.html.PajeResource
public class PajeResource
A PajeResource identifies a collection of resources within a ServletContext that are mapped to a path that contains a variable component.
For example, a system may implement the display of different HTML documents based upon a customer ID. If the document names are all identical, but are identified by a different path that includes the customer ID, the PajeResource would be created as follows:
PajeResource res;
res = new PajeResource(context, "/templates/customer/{0}/details.html");
PajeFactory| Constructor Summary | |
|---|---|
PajeResource(javax.servlet.ServletContext context,
java.lang.String pathPattern)
Creates an PajeResource identifies a resource or a collection of resources within a ServletContext that are mapped to a path pattern. |
|
| Method Summary | |
|---|---|
java.lang.String |
getPath(java.lang.String[] arguments)
Returns the path of this PajeResource when the specified parameters have been substituted into the path pattern. |
java.lang.String |
getPathPattern()
Returns the String pattern passed to the constructor. |
java.net.URL |
getResource(java.lang.String[] arguments)
Returns a URL to the resource that is mapped to the path of this PajeResource when the specified parameters have been substituted into the path pattern. |
javax.servlet.ServletContext |
getServletContext()
Returns the servlet context that was specifed on the constructor. |
java.lang.String |
toString()
Returns a String representation of this resource. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PajeResource(javax.servlet.ServletContext context,
java.lang.String pathPattern)
The path pattern is of the form:
pathPattern := "/" string ( "{" variablePathElement "}" string )*
variablePathElement := argument
After the variable elements are substituted into the path pattern, it will be passed to ServletContext.getResource, and therefore must commence with a "/".
The string elements of the pattern are the fixed elements of the path.
The argument is a number from 0 to 9, which corresponds to the arguments presented in an array to be substituted into the pattern.
Note that the variablePathElement is optional - a path may
be defined with no variable elements, and therefore represents a single
resource. in this case, it is valid to pass null as the
arguments parameter to the getPath(java.lang.String[]) and getResource(java.lang.String[]) methods.
context - the servlet context which will be requested to return the
resource after the variable elements have been substituted in.pathPattern - the path pattern as described above.| Method Detail |
|---|
public java.lang.String getPath(java.lang.String[] arguments)
arguments - the array of arguments that will be substituted into the path
pattern to give a path.
String path.public java.lang.String getPathPattern()
String pattern passed to the constructor.
public java.net.URL getResource(java.lang.String[] arguments)
throws java.net.MalformedURLException
If the resource begins with a "/", it is interpreted as relative to the current context root and ServletContext.getResource will be used to retrieve the URL. Otherwise the request will be passed to the ClassLoader to search its own and the system class path.
arguments - the array of arguments that will be substituted into the path
pattern to give a path.
java.net.MalformedURLException - if the resulting path, after substituting the supplied
arguments, is not in the correct form.public javax.servlet.ServletContext getServletContext()
public java.lang.String toString()
toString in class java.lang.Object
|
PAJES 3.0.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||