org.weborganic.bastille.pageseeder
Class PSResource

java.lang.Object
  extended by org.weborganic.bastille.pageseeder.PSResource

public final class PSResource
extends Object

Defines a resource to retrieve from PageSeeder.

Since:
0.6.2

Nested Class Summary
static class PSResource.Builder
          A builder for this resource.
 
Constructor Summary
PSResource(PSResourceType type, String name)
          Creates a new connection to the specified resource.
 
Method Summary
 void addParameter(String name, String value)
          Add a parameter to this request.
 String name()
          Returns the name of the resource to access.
 URL toURL(PSUser user)
          Returns the URL to access this resource.
 PSResourceType type()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSResource

public PSResource(PSResourceType type,
                  String name)
Creates a new connection to the specified resource.

Parameters:
type - The type of resource.
name - The name of the resource to access (depends on the type of resource)
Method Detail

type

public PSResourceType type()
Returns:
The type of resource requested.

name

public String name()
Returns the name of the resource to access.
servlet
The full class name of the servlet (may include parameters)
service
The path name of the servlet (may include parameters)
resource
The full path of the resource (may include parameters)

Returns:
the name of the resource to access.

addParameter

public void addParameter(String name,
                         String value)
Add a parameter to this request.

Parameters:
name - The name of the parameter
value - The value of the parameter

toURL

public URL toURL(PSUser user)
          throws MalformedURLException
Returns the URL to access this resource.

If the user is specified, its details will be included in the URL so that the resource can be accessed on his behalf.

Parameters:
user - A PageSeeder to access this resource.
Returns:
the URL to access this resource.
Throws:
MalformedURLException - If the URL is not well-formed