org.apache.jetspeed.services.webpage
Class WebPageHelper

java.lang.Object
  extended byorg.apache.jetspeed.services.webpage.WebPageHelper

public class WebPageHelper
extends java.lang.Object

Helper methods for WebPage Service

Version:
$Id: WebPageHelper.java,v 1.3 2004/02/23 03:46:26 jford Exp $
Author:
David Sean Taylor

Field Summary
static int CT_APPLICATION
           
static int CT_BINARY
           
static int CT_CSS
           
static int CT_HTML
           
static int CT_IMAGE
           
static int CT_JS
           
static int CT_TEXT
           
 
Constructor Summary
WebPageHelper()
           
 
Method Summary
static java.lang.String buildCookieString(javax.servlet.http.Cookie cookie)
          Given a cookie object, build a http-compliant cookie string header
static java.lang.String concatURLs(java.lang.String base, java.lang.String path)
          Given a base string and a path string, concatenates the strings to make a full URL.
static long generateId()
           
static java.lang.String getAvailabilityStatus(int status)
           
static int getContentType(java.lang.String typeString, java.lang.String resource)
          Given the content-type header string, returns a content type id
static java.lang.String getIP(java.lang.String hostname)
           
static boolean parseCookies(java.lang.String cookieHeader, SiteSession session)
          Parses cookies from the HTTP response header string and stores them into this instance's cookies collection
static java.lang.StringBuffer replaceAll(java.lang.StringBuffer buffer, java.lang.String find, java.lang.String replacement)
          given a stringbuffer, replaces 'find' with 'replacement'
static void writeHeader(java.io.FileOutputStream fos, java.lang.String resource)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CT_TEXT

public static final int CT_TEXT
See Also:
Constant Field Values

CT_BINARY

public static final int CT_BINARY
See Also:
Constant Field Values

CT_APPLICATION

public static final int CT_APPLICATION
See Also:
Constant Field Values

CT_HTML

public static final int CT_HTML
See Also:
Constant Field Values

CT_IMAGE

public static final int CT_IMAGE
See Also:
Constant Field Values

CT_CSS

public static final int CT_CSS
See Also:
Constant Field Values

CT_JS

public static final int CT_JS
See Also:
Constant Field Values
Constructor Detail

WebPageHelper

public WebPageHelper()
Method Detail

getContentType

public static int getContentType(java.lang.String typeString,
                                 java.lang.String resource)
Given the content-type header string, returns a content type id

Parameters:
typeString - the http content-type header string.
Returns:
the integer value of the content-type

buildCookieString

public static java.lang.String buildCookieString(javax.servlet.http.Cookie cookie)
Given a cookie object, build a http-compliant cookie string header

Returns:
the cookie string formatted as a http header.

parseCookies

public static boolean parseCookies(java.lang.String cookieHeader,
                                   SiteSession session)
Parses cookies from the HTTP response header string and stores them into this instance's cookies collection

Parameters:
cookieHeader - the string from the response header with the cookies.
Returns:
true when cookies were found, otherwise false

replaceAll

public static java.lang.StringBuffer replaceAll(java.lang.StringBuffer buffer,
                                                java.lang.String find,
                                                java.lang.String replacement)
given a stringbuffer, replaces 'find' with 'replacement'

Parameters:
buffer - the string to be manipulated.
find - the string to be replaced.
replacement - the string that is put in place.

concatURLs

public static java.lang.String concatURLs(java.lang.String base,
                                          java.lang.String path)
Given a base string and a path string, concatenates the strings to make a full URL. Handles the concatenation for proper path separators.

Parameters:
base - the base part of a URL, such as http://localhost/
path - the path part of the url, such as /webinterface/controllers/x.php

getAvailabilityStatus

public static java.lang.String getAvailabilityStatus(int status)

writeHeader

public static void writeHeader(java.io.FileOutputStream fos,
                               java.lang.String resource)
                        throws java.io.IOException
Throws:
java.io.IOException

getIP

public static java.lang.String getIP(java.lang.String hostname)

generateId

public static long generateId()


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