PAJES 3.0.21

org.pajes.util
Class URI

java.lang.Object
  extended by org.pajes.util.URI
All Implemented Interfaces:
java.io.Serializable

public class URI
extends java.lang.Object
implements java.io.Serializable

Constructs URIs.

See Also:
Serialized Form

Constructor Summary
URI(java.lang.Class<? extends javax.servlet.GenericServlet> servlet)
          Deprecated. Most modern servlet containers do not by default allow dynamic servlet mappings.
URI(java.lang.Class<? extends javax.servlet.GenericServlet> servlet, java.lang.String name, java.lang.String value)
          Deprecated. Most modern servlet containers do not by default allow dynamic servlet mappings.
URI(java.lang.String servletName)
          Creates a URI.
 
Method Summary
 URI addParameter(java.lang.String name, java.lang.String value)
          Deprecated. Use addParameter(String, String, HttpServletRequest) instead so that the name and value are correctly encoded.
 URI addParameter(java.lang.String name, java.lang.String value, javax.servlet.http.HttpServletRequest request)
          Adds an additional parameter to the URI query string.
static java.lang.String encode(javax.servlet.http.HttpServletRequest request, java.lang.String value)
          Correctly encodes a name or value for the query string.
 int getParameterCount()
          Returns the parameter count.
 URI setPrefix(java.lang.String prefix)
          Sets the String that will be prepended to the returned URI String.
 java.lang.String toString()
          Return the complete URI, including any query string, as a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URI

@Deprecated
public URI(java.lang.Class<? extends javax.servlet.GenericServlet> servlet)
Deprecated. Most modern servlet containers do not by default allow dynamic servlet mappings.

Creates a relative URI with the servlet/ prefix to address a dynamic servlet.

Parameters:
servlet - the servlet class this URI will address.

URI

@Deprecated
public URI(java.lang.Class<? extends javax.servlet.GenericServlet> servlet,
                      java.lang.String name,
                      java.lang.String value)
Deprecated. Most modern servlet containers do not by default allow dynamic servlet mappings.

Creates a relative URI with the servlet/ prefix to address a dynamic servlet, with the specified query string parameter.

Parameters:
servlet - the servlet class this URI will address.
name - the name of a query string parameter to be passed to the servlet.
value - the value of the named query string parameter to be passed to the servlet.
See Also:
addParameter(java.lang.String, java.lang.String)

URI

public URI(java.lang.String servletName)
Creates a URI.

Parameters:
servletName - the name of the servlet this URI will address.
Method Detail

encode

public static java.lang.String encode(javax.servlet.http.HttpServletRequest request,
                                      java.lang.String value)
Correctly encodes a name or value for the query string.

Parameters:
request - the request object.
value - the value to be encoded.
Returns:
the encoded string

addParameter

@Deprecated
public URI addParameter(java.lang.String name,
                                   java.lang.String value)
Deprecated. Use addParameter(String, String, HttpServletRequest) instead so that the name and value are correctly encoded.

Adds an additional parameter to the URI query string. The name and value will be encoded using UTF-8.

Parameters:
name - the name of a query string parameter to be passed to the servlet.
value - the value of the named query string parameter to be passed to the servlet.
Returns:
the modified URI.

addParameter

public URI addParameter(java.lang.String name,
                        java.lang.String value,
                        javax.servlet.http.HttpServletRequest request)
Adds an additional parameter to the URI query string. The name and value will be appropriately encoded.

Parameters:
name - the name of a query string parameter to be passed to the servlet.
value - the value of the named query string parameter to be passed to the servlet.
request - the servlet request, so that the name and value can be encoded appropriately.
Returns:
the modified URI.

getParameterCount

public int getParameterCount()
Returns the parameter count.

Returns:
the number of parameters added.

setPrefix

public URI setPrefix(java.lang.String prefix)
Sets the String that will be prepended to the returned URI String. The default is null.

Parameters:
prefix - the prefix String, or null if no prefix is required.
Returns:
the modified URI instance.

toString

public java.lang.String toString()
Return the complete URI, including any query string, as a string.

Overrides:
toString in class java.lang.Object
Returns:
the relative URI constructed from the servlets, and any supplied query string parameters, appropriately encoded.

PAJES 3.0.21

Copyright © 1998-2007 Viridian Pty Limited. All Rights Reserved.