WUI : API


org.westofj.wui
Class WUtil

java.lang.Object
  extended byorg.westofj.wui.WUtil

public final class WUtil
extends Object

Non-instantiable class containing static utility functions.

Version:
$Revision: 1.4 $, $Date: 2004/03/08 01:57:35 $
Author:
bill

Method Summary
static void copyStream(InputStream in, OutputStream out)
           
static void copyStream(InputStream in, PrintWriter out)
           
static void filter(PrintWriter out, String text)
          Filters a string for display between HTML tags.
static String filter(String text)
          Filters a string for display between HTML tags.
static String getObjectText(WRunner runner, Object object)
          Returns the displayable text for an object.
static String join(String[] a, int start, String joinBy)
           
static void jsFilter(PrintWriter out, String text)
          Filters a string for display within a javascript expression.
static String jsFilter(String text)
          Filters a string for display within a javascript expression.
static void paramFilter(PrintWriter out, String text)
          Filters a string for display as a HTML attribute value.
static String paramFilter(String text)
          Filters a string for display as a HTML attribute value.
static void setDefaultExpiration(HttpServletResponse response)
           
static void setExpiration(HttpServletResponse response, long theDate)
           
static String toColorString(Color color)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

filter

public static void filter(PrintWriter out,
                          String text)
Filters a string for display between HTML tags.

Parameters:
out - the writer to output the filtered string to.
text - the string to filter.

filter

public static String filter(String text)
Filters a string for display between HTML tags.

Parameters:
text - the string to filter.
Returns:
String the filtered string.

jsFilter

public static void jsFilter(PrintWriter out,
                            String text)
Filters a string for display within a javascript expression.

Parameters:
out - the writer to output the filtered string to.
text - the string to filter.

jsFilter

public static String jsFilter(String text)
Filters a string for display within a javascript expression.

Parameters:
text - the string to filter.
Returns:
String the filtered string.

paramFilter

public static void paramFilter(PrintWriter out,
                               String text)
Filters a string for display as a HTML attribute value.

Parameters:
out - the writer to output the filtered string to.
text - the string to filter.

paramFilter

public static String paramFilter(String text)
Filters a string for display as a HTML attribute value.

Parameters:
text - the string to filter.
Returns:
String the filtered string.

getObjectText

public static String getObjectText(WRunner runner,
                                   Object object)
Returns the displayable text for an object. If the object is null, the empty text is displayed as non-breaking space. If the object is an instance of WDisplayable, the object is displayed by invoking WDisplayable.getText(org.westofj.wui.WRunner). Otherwise Object.toString() is invoked.

Parameters:
runner - the current runner context.
object - the object to display.
Returns:
String the textual display of the object.

toColorString

public static String toColorString(Color color)

copyStream

public static void copyStream(InputStream in,
                              OutputStream out)
                       throws IOException
Throws:
IOException

copyStream

public static void copyStream(InputStream in,
                              PrintWriter out)
                       throws IOException
Throws:
IOException

join

public static String join(String[] a,
                          int start,
                          String joinBy)

setDefaultExpiration

public static void setDefaultExpiration(HttpServletResponse response)

setExpiration

public static void setExpiration(HttpServletResponse response,
                                 long theDate)

Copyright (c) 2003 West of J - All rights reserved.