jrun.jsp
Class Utils

java.lang.Object
  |
  +--jrun.jsp.Utils

public class Utils
extends java.lang.Object


Field Summary
static java.lang.String SERVLET_PATH
           
 
Constructor Summary
Utils()
           
 
Method Summary
static java.lang.String arrayToString(java.lang.String[] str, char sep)
          Convert a string array to a string separated by some char.
static java.lang.String canonicalizeURI(java.lang.String uri)
           
static java.lang.String collapseDotDots(java.lang.String str)
           
static java.lang.String convertValueToType(java.lang.String value, java.lang.String type)
           
static java.lang.String expandURI(java.lang.String parent, java.lang.String urlSpec)
           
static java.lang.String getHeaderParameter(java.lang.String header, java.lang.String parameter)
          Pull a parameter from a MIME message header
static java.lang.String getHeaderParameter(java.lang.String header, java.lang.String parameter, java.lang.String deflt)
          Pull a parameter from a MIME message header
static long getLastModified(javax.servlet.ServletContext application, java.lang.String resource)
           
static java.lang.String getPageClassName(java.lang.String pagePath)
           
static java.lang.String getPrefix(java.lang.String tag)
           
static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.Class clazz, java.lang.String property)
          get a bean property descriptor
static java.lang.String getServletPath(javax.servlet.http.HttpServletRequest request)
          Returns the servlet path by looking in the attribute set for javax.servlet.include.servlet_path and then calling getServletPath
static java.lang.String getSetter(java.lang.String s)
           
static java.lang.String getTagName(java.lang.String tag)
           
static boolean isJar(java.io.InputStream is)
           
static boolean isPrimitive(java.lang.String type)
           
static int occurrences(java.lang.String s, char c)
          count the occurances of a char in a string
static int[] segment(char[] chars)
           
static java.lang.String substitute(java.lang.String str, java.lang.String from, java.lang.String to)
          Simple string replace routine, return the same string with all instances of from replaced with to
static java.lang.String trimDuplicateSlashes(java.lang.String path)
          Remove any duplicate slashes in a path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVLET_PATH

public static final java.lang.String SERVLET_PATH
Constructor Detail

Utils

public Utils()
Method Detail

getHeaderParameter

public static java.lang.String getHeaderParameter(java.lang.String header,
                                                  java.lang.String parameter)
Pull a parameter from a MIME message header
Parameters:
header - The header to pull the param from
parameter - The parameter to look for

getHeaderParameter

public static java.lang.String getHeaderParameter(java.lang.String header,
                                                  java.lang.String parameter,
                                                  java.lang.String deflt)
Pull a parameter from a MIME message header
Parameters:
header - The header to pull the param from
parameter - The parameter to look for
default - Default value if the parameter isn't found

getPageClassName

public static java.lang.String getPageClassName(java.lang.String pagePath)

isPrimitive

public static boolean isPrimitive(java.lang.String type)

convertValueToType

public static java.lang.String convertValueToType(java.lang.String value,
                                                  java.lang.String type)

getSetter

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

getPrefix

public static java.lang.String getPrefix(java.lang.String tag)

getTagName

public static java.lang.String getTagName(java.lang.String tag)

expandURI

public static java.lang.String expandURI(java.lang.String parent,
                                         java.lang.String urlSpec)

getPropertyDescriptor

public static java.beans.PropertyDescriptor getPropertyDescriptor(java.lang.Class clazz,
                                                                  java.lang.String property)
                                                           throws java.beans.IntrospectionException
get a bean property descriptor
Parameters:
clazz - The bean type to set the property on
property - The name of the property
Throws:
java.beans.IntrospectionException - If an introspection error occurs trying to get property descriptor
NoSuchPropertyException - If the property doesn't exist on this bean

occurrences

public static int occurrences(java.lang.String s,
                              char c)
count the occurances of a char in a string

isJar

public static boolean isJar(java.io.InputStream is)

segment

public static int[] segment(char[] chars)

canonicalizeURI

public static java.lang.String canonicalizeURI(java.lang.String uri)

collapseDotDots

public static java.lang.String collapseDotDots(java.lang.String str)

substitute

public static java.lang.String substitute(java.lang.String str,
                                          java.lang.String from,
                                          java.lang.String to)
Simple string replace routine, return the same string with all instances of from replaced with to

trimDuplicateSlashes

public static java.lang.String trimDuplicateSlashes(java.lang.String path)
Remove any duplicate slashes in a path.
Parameters:
path - The path to check
Returns:
The path without duplicate slashes

getServletPath

public static java.lang.String getServletPath(javax.servlet.http.HttpServletRequest request)
Returns the servlet path by looking in the attribute set for javax.servlet.include.servlet_path and then calling getServletPath
Parameters:
request - The request

arrayToString

public static java.lang.String arrayToString(java.lang.String[] str,
                                             char sep)
Convert a string array to a string separated by some char.

getLastModified

public static long getLastModified(javax.servlet.ServletContext application,
                                   java.lang.String resource)
                            throws java.io.IOException


Copyright � 2002 Macromedia Corporation. All Rights Reserved.