php.java.servlet
Class ServletUtil

java.lang.Object
  extended by php.java.servlet.ServletUtil

public class ServletUtil
extends java.lang.Object

Miscellaneous servlet functions.

Author:
jostb

Method Summary
static java.lang.String getHeaders(java.lang.StringBuffer buf, java.util.Enumeration enumeration)
           
static int getLocalPort(javax.servlet.ServletRequest req)
          Only for internal use.
static int getMBeanProperty(java.lang.String pattern, java.lang.String property)
          Return an mbean property.
static java.lang.String getRealPath(javax.servlet.ServletContext context2, java.lang.String pathInfoCGI)
          Identical to context2.getRealPath(pathInfoCGI).
static java.io.OutputStream getServletOutputStream(javax.servlet.http.HttpServletResponse response)
           
static boolean isJavaBridgeWc(java.lang.String contextPath)
           
static java.lang.String nullsToBlanks(java.lang.String s)
           
static java.lang.String nullsToString(java.lang.String couldBeNull, java.lang.String subForNulls)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRealPath

public static java.lang.String getRealPath(javax.servlet.ServletContext context2,
                                           java.lang.String pathInfoCGI)
Identical to context2.getRealPath(pathInfoCGI). On BEA WebLogic, which has a broken getRealPath() implementation, we use context2.getResource(pathInfoCGI)) instead.

Parameters:
context2 - The servlet context.
pathInfoCGI - may be "" or "/" for example.
Returns:
a valid path or null

getLocalPort

public static int getLocalPort(javax.servlet.ServletRequest req)
Only for internal use. Returns the port# of the local port

Parameters:
req - The servlet request
Returns:
The local port or the value from the server port variable.

isJavaBridgeWc

public static boolean isJavaBridgeWc(java.lang.String contextPath)

nullsToBlanks

public static java.lang.String nullsToBlanks(java.lang.String s)

nullsToString

public static java.lang.String nullsToString(java.lang.String couldBeNull,
                                             java.lang.String subForNulls)

getHeaders

public static java.lang.String getHeaders(java.lang.StringBuffer buf,
                                          java.util.Enumeration enumeration)

getServletOutputStream

public static java.io.OutputStream getServletOutputStream(javax.servlet.http.HttpServletResponse response)
                                                   throws java.io.IOException
Throws:
java.io.IOException

getMBeanProperty

public static int getMBeanProperty(java.lang.String pattern,
                                   java.lang.String property)
Return an mbean property. Example: Util.getMBeanProperty("*:type=ThreadPool,name=http*", "maxThreads") or Util.getMBeanProperty("*:ServiceModule=*,J2EEServer=*,name=JettyWebConnector,j2eeType=*", "maxThreads");

Parameters:
pattern - the pattern string
property - the property key
Returns:
the property value