Novell exteNd
Director 5.2 API

com.sssw.fw.util
Class EboRequestHelper

java.lang.Object
 |
 +--com.sssw.fw.util.EboRequestHelper

public final class EboRequestHelper
extends Object

HTTP Servlet Request and Portlet Request- related utilities.


Field Summary
static String BROWSER_AOL
          Value for use in equality comparisons for AOL browser
static String BROWSER_LYNX
          Value for use in equality comparisons for Lynx browser
static String BROWSER_MAJOR_VER
          Value for use in determining comparison target of a Browser's Major Version
static String BROWSER_MINOR_VER
          Value for use in determining comparison target of a Browser's Minor Version
static String BROWSER_MOSAIC
          Value for use in equality comparisons for NCSA Mosaic browser
static String BROWSER_MSIE
          Value for use in equality comparisons for MSIE browser
static String BROWSER_NAME
          Value for use in determining comparison target of user agent
static String BROWSER_NETSCAPE
          Value for use in equality comparisons for Netscape browser
static String BROWSER_NOKIA
          Value for use in equality comparisons for Nokia device
static String BROWSER_OPERA
          Value for use in equality comparisons for Opera browser
static String BROWSER_UP
          Value for use in equality comparisons for UP Browser
static String CONTENT_SEARCH_DTD
          Relative directory path and filename for CM system document meta-data search dtd.
static String CONTEXT_SUBST
          Place holder used by methods such as getFullPath() to build the full path up to the context Example: $context$/jsp/PropertySheet.jsp would be parsed and converted to http://host/context/jsp/PropertySheet.jsp
static String PLATFORM
          Value for use in determining comparison target of Platform
static String PLATFORM_LINUX
          Value for use in equality comparisons for Linux platform
static String PLATFORM_MAC
          Value for use in equality comparisons for MAC platform
static String PLATFORM_OS2
          Value for use in equality comparisons for OS2 platform
static String PLATFORM_PPC
          Value for use in equality comparisons for PPC platform
static String PLATFORM_SUN_OS
          Value for use in equality comparisons for Sun OS platform
static String PLATFORM_UNIX_OR_VMS
          Value for use in equality comparisons for UNIX/VMS platform
static String PLATFORM_WAP
          Value for use in equality comparisons for WAP platform
static String PLATFORM_WIN
          Value for use in equality comparisons for Windows platform
static String PLATFORM_X11
          Value for use in equality comparisons for X11 platform
static String PORTAL_APPLICATION_DTD
          Relative directory path and filename for Portal application dtd.
static String UNKNOWN
          Value for use in equality comparisons for Unknown browser
static String USER_AGENT
          This class provides utility methods for obtaining information on the browser platform based on the HTTP Servlet Request
 
Constructor Summary
EboRequestHelper()
           
 
Method Summary
static boolean equals(Map browserInfo1, Map browserInfo2, int mode)
          Check two browser info's for equality.
static Map getBrowserInfo(HttpServletRequest req)
          Extract the HTTP user-agent header from the HTTP Servlet Request and parse it out.
static String getFullContextPath(HttpServletRequest req)
          Assemble the fully qualified path up to the context of a request Example: http://host:port/context Where context is the silverstream database + / + war context, for SilverStream
static String getFullContextPath(HttpServletRequest req, String pathInfo)
          Assemble the fully qualified path up to the context of a request Example: http://host:port/context Where context is the silverstream database + / + war context, for SilverStream
static String getFullContextPath(javax.portlet.PortletRequest req)
          Assemble the fully qualified path up to the context of a portlet request Example: http://host:port/context Where context is the silverstream database + / + war context, for SilverStream
static String getFullContextPath(javax.portlet.PortletRequest req, String pathInfo)
          Assemble the fully qualified path up to the context of a request Example: http://host:port/context Where context is the silverstream database + / + war context, for SilverStream
static String getFullHostPath(HttpServletRequest req)
          Gets the full url of the host (port is returned if not the default 80).
static String getFullHostPath(javax.portlet.PortletRequest req)
          Gets the full url of the host (port is returned if not the default 80).
static String getFullPath(HttpServletRequest req, String relativePath)
          Build a full URL based on a relative path Example: /$context$/Login --> http://host/context/Login /Login --> http://host/Login http://host/warcontext/servlet/comp/Login --> http://host/warcontext/servlet/comp/Login Login --> Login
static Map parseUserAgent(String userAgent)
          Parse out browser information from the User Agent header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_AGENT

public static final String USER_AGENT
This class provides utility methods for obtaining information on the browser platform based on the HTTP Servlet Request

BROWSER_NAME

public static final String BROWSER_NAME
Value for use in determining comparison target of user agent

BROWSER_MAJOR_VER

public static final String BROWSER_MAJOR_VER
Value for use in determining comparison target of a Browser's Major Version

BROWSER_MINOR_VER

public static final String BROWSER_MINOR_VER
Value for use in determining comparison target of a Browser's Minor Version

PLATFORM

public static final String PLATFORM
Value for use in determining comparison target of Platform

UNKNOWN

public static final String UNKNOWN
Value for use in equality comparisons for Unknown browser

BROWSER_MSIE

public static final String BROWSER_MSIE
Value for use in equality comparisons for MSIE browser

BROWSER_NETSCAPE

public static final String BROWSER_NETSCAPE
Value for use in equality comparisons for Netscape browser

BROWSER_OPERA

public static final String BROWSER_OPERA
Value for use in equality comparisons for Opera browser

BROWSER_AOL

public static final String BROWSER_AOL
Value for use in equality comparisons for AOL browser

BROWSER_LYNX

public static final String BROWSER_LYNX
Value for use in equality comparisons for Lynx browser

BROWSER_MOSAIC

public static final String BROWSER_MOSAIC
Value for use in equality comparisons for NCSA Mosaic browser

BROWSER_UP

public static final String BROWSER_UP
Value for use in equality comparisons for UP Browser

BROWSER_NOKIA

public static final String BROWSER_NOKIA
Value for use in equality comparisons for Nokia device

PLATFORM_WIN

public static final String PLATFORM_WIN
Value for use in equality comparisons for Windows platform

PLATFORM_X11

public static final String PLATFORM_X11
Value for use in equality comparisons for X11 platform

PLATFORM_SUN_OS

public static final String PLATFORM_SUN_OS
Value for use in equality comparisons for Sun OS platform

PLATFORM_LINUX

public static final String PLATFORM_LINUX
Value for use in equality comparisons for Linux platform

PLATFORM_MAC

public static final String PLATFORM_MAC
Value for use in equality comparisons for MAC platform

PLATFORM_PPC

public static final String PLATFORM_PPC
Value for use in equality comparisons for PPC platform

PLATFORM_OS2

public static final String PLATFORM_OS2
Value for use in equality comparisons for OS2 platform

PLATFORM_UNIX_OR_VMS

public static final String PLATFORM_UNIX_OR_VMS
Value for use in equality comparisons for UNIX/VMS platform

PLATFORM_WAP

public static final String PLATFORM_WAP
Value for use in equality comparisons for WAP platform

CONTEXT_SUBST

public static final String CONTEXT_SUBST
Place holder used by methods such as getFullPath() to build the full path up to the context Example: $context$/jsp/PropertySheet.jsp would be parsed and converted to http://host/context/jsp/PropertySheet.jsp

CONTENT_SEARCH_DTD

public static final String CONTENT_SEARCH_DTD
Relative directory path and filename for CM system document meta-data search dtd.

PORTAL_APPLICATION_DTD

public static final String PORTAL_APPLICATION_DTD
Relative directory path and filename for Portal application dtd.
Constructor Detail

EboRequestHelper

public EboRequestHelper()
Method Detail

getBrowserInfo

public static final Map getBrowserInfo(HttpServletRequest req)
Extract the HTTP user-agent header from the HTTP Servlet Request and parse it out.

parseUserAgent

public static Map parseUserAgent(String userAgent)
Parse out browser information from the User Agent header. The User Agent is a special header which is used for identifying the Web client to the server.

See Section 14.42 of the HTTP 1.1 spec for more information.

Examples of user agent strings:

User Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)
User Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)
User Agent: Mozilla/4.5 (Macintosh; U; PPC)
User Agent: Mozilla/4.7 [en] (WinNT; I)
User Agent: Mozilla/3.0 (compatible; Opera/3.0; Windows 95/NT) 3.1
User Agent: Mozilla/4.03 [la] (X11; I; Linux 2.1.29 i586)
User Agent: Mozilla/2.0 (compatible; AOL 3.0; Mac_PowerPC)
User Agent: NCSA Mosaic/2.6b1 (X11;UNIX_SV 4.2MP R4000) libwww/2.12 modified
User Agent: Lynx/2.7 libwww-FM/2.14


equals

public static boolean equals(Map browserInfo1,
                             Map browserInfo2,
                             int mode)
Check two browser info's for equality.
Parameters:
browserInfo1 - the first info
browserInfo2 - the second info
checkMajorVersion - whether to compare major versions in addition to browser names
checkMinorVersion - whether to compare minor versions in addition to browser names and major versions

getFullContextPath

public static String getFullContextPath(javax.portlet.PortletRequest req)
Assemble the fully qualified path up to the context of a portlet request Example: http://host:port/context Where context is the silverstream database + / + war context, for SilverStream
Parameters:
req - the PortletRequest from which the context path should be assembled

getFullContextPath

public static String getFullContextPath(HttpServletRequest req)
Assemble the fully qualified path up to the context of a request Example: http://host:port/context Where context is the silverstream database + / + war context, for SilverStream
Parameters:
req - the HttpServletRequest from which the context path should be assembled

getFullContextPath

public static String getFullContextPath(HttpServletRequest req,
                                        String pathInfo)
Assemble the fully qualified path up to the context of a request Example: http://host:port/context Where context is the silverstream database + / + war context, for SilverStream
Parameters:
req - the HttpServletRequest from which the context path should be assembled
pathInfo - a String representing additional path info to be appended to the assembled path

getFullContextPath

public static String getFullContextPath(javax.portlet.PortletRequest req,
                                        String pathInfo)
Assemble the fully qualified path up to the context of a request Example: http://host:port/context Where context is the silverstream database + / + war context, for SilverStream
Parameters:
req - the PortletRequest from which the context path should be assembled
pathInfo - a String representing additional path info to be appended to the assembled path

getFullPath

public static String getFullPath(HttpServletRequest req,
                                 String relativePath)
Build a full URL based on a relative path Example: /$context$/Login --> http://host/context/Login /Login --> http://host/Login http://host/warcontext/servlet/comp/Login --> http://host/warcontext/servlet/comp/Login Login --> Login
Parameters:
req - - the HttpServletRequest from which the context path should be assembled
relativePath - - the relative path which we'll use to create a full URL pat,h

getFullHostPath

public static String getFullHostPath(HttpServletRequest req)
Gets the full url of the host (port is returned if not the default 80). Example: http://host[:port]
Parameters:
req - - the HttpServletRequest

getFullHostPath

public static String getFullHostPath(javax.portlet.PortletRequest req)
Gets the full url of the host (port is returned if not the default 80). Example: http://host[:port]
Parameters:
req - - the PortletRequest

Novell exteNd
Director 5.2 API