org.jpublish.util
Class URLUtilities

java.lang.Object
  |
  +--org.jpublish.util.URLUtilities

public class URLUtilities
extends java.lang.Object


Field Summary
static java.lang.String URL_PATH_SEPARATOR
          The URL path separator.
 
Constructor Summary
URLUtilities(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
protected  java.lang.String build(java.lang.String path, java.lang.String protocol, int port)
          Build a URL using the given path, protocol and port.
 java.lang.String buildSecure(java.lang.String path)
          Build an HTTPS (Secure Socket Layer) method relative to the application context using the given path.
 java.lang.String buildSecure(java.lang.String path, int port)
          Build an HTTPS (Secure Socket Layer) method relative to the application context using the given path.
 java.lang.String buildStandard(java.lang.String path)
          Build an HTTP URL relative to the application context using the given path.
 java.lang.String buildStandard(java.lang.String path, int port)
          Build an HTTP URL relative to the application context using the given path.
 java.lang.String encode(java.lang.String s)
          Percent-encode the given String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_PATH_SEPARATOR

public static final java.lang.String URL_PATH_SEPARATOR
The URL path separator.
Constructor Detail

URLUtilities

public URLUtilities(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
Method Detail

buildStandard

public java.lang.String buildStandard(java.lang.String path)
Build an HTTP URL relative to the application context using the given path.
Parameters:
path - The path

buildStandard

public java.lang.String buildStandard(java.lang.String path,
                                      int port)
Build an HTTP URL relative to the application context using the given path. This version of the buildStandard method allows you to specify the port number. A port number of 0 will cause the port argument to be ignored.
Parameters:
path - The path
port - The port

buildSecure

public java.lang.String buildSecure(java.lang.String path)
Build an HTTPS (Secure Socket Layer) method relative to the application context using the given path.
Parameters:
path - The path

buildSecure

public java.lang.String buildSecure(java.lang.String path,
                                    int port)
Build an HTTPS (Secure Socket Layer) method relative to the application context using the given path. This version of the buildSecure method allows you to specify the port number. A port number of 0 will cause the port argument to be ignored.
Parameters:
path - The path
port - The port

build

protected java.lang.String build(java.lang.String path,
                                 java.lang.String protocol,
                                 int port)
Build a URL using the given path, protocol and port. The path will be relative to the current context.
Parameters:
path - The path
protocol - (i.e. http or https)
port - The port (0 to ignore the port argument)
Returns:
The URL as a String

encode

public java.lang.String encode(java.lang.String s)
Percent-encode the given String. This method delegates to the URLEncoder.encode() method.
Parameters:
s - The String to encode
Returns:
The encoded String
See Also:
URLEncoder


Copyright (C) 2001 Anthony Eden. All Rights Reserved.