org.apache.turbine.util
Class ServletUtils

java.lang.Object
  |
  +--org.apache.turbine.util.ServletUtils

public class ServletUtils
extends java.lang.Object

This is where common Servlet manipulation routines should go.

Version:
$Id: ServletUtils.java,v 1.1.1.1 2001/08/16 05:09:41 jvanzyl Exp $
Author:
Gonzalo Diethelm

Field Summary
static int FTP_PORT
          The default FTP port number.
static int HTTP_PORT
          The default HTTP port number.
static int HTTPS_PORT
          The default HTTPS port number.
static java.lang.String URI_SCHEME_SEPARATOR
          The part of the URI which separates the protocol indicator (i.e.
 
Constructor Summary
ServletUtils()
           
 
Method Summary
static java.lang.String expandRelative(javax.servlet.ServletConfig config, java.lang.String text)
          Expands a string that points to a relative path or path list, leaving it as an absolute path based on the servlet context.
static java.lang.StringBuffer hostURL(javax.servlet.http.HttpServletRequest req)
          Defaults to the scheme used in the supplied request.
static java.lang.StringBuffer hostURL(javax.servlet.http.HttpServletRequest req, java.lang.String scheme)
          Returns a URL fragment derived from the provided HTTP request, including the protocol used to address the server (if non-standard for HTTP/HTTPS).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_PORT

public static final int HTTP_PORT
The default HTTP port number.

HTTPS_PORT

public static final int HTTPS_PORT
The default HTTPS port number.

FTP_PORT

public static final int FTP_PORT
The default FTP port number.

URI_SCHEME_SEPARATOR

public static final java.lang.String URI_SCHEME_SEPARATOR
The part of the URI which separates the protocol indicator (i.e. the scheme) from the rest of the URI.
Constructor Detail

ServletUtils

public ServletUtils()
Method Detail

expandRelative

public static java.lang.String expandRelative(javax.servlet.ServletConfig config,
                                              java.lang.String text)
Expands a string that points to a relative path or path list, leaving it as an absolute path based on the servlet context. It will return null if the text is empty or the config object is null.
Parameters:
config - The ServletConfig.
text - The String containing a path or path list.
Returns:
A String with the expanded path or path list.

hostURL

public static java.lang.StringBuffer hostURL(javax.servlet.http.HttpServletRequest req)
Defaults to the scheme used in the supplied request.
See Also:
hostURL(HttpServletRequest req, String proto)

hostURL

public static java.lang.StringBuffer hostURL(javax.servlet.http.HttpServletRequest req,
                                             java.lang.String scheme)
Returns a URL fragment derived from the provided HTTP request, including the protocol used to address the server (if non-standard for HTTP/HTTPS). Returns the fragment as a buffer
Parameters:
req - The request to extract information from.
scheme - The protocol indicator to prefix the host name with, or the protocol used to address the server with if null.
Returns:
The desired URL fragment.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.