edu.mayo.bsi.ngsportal.server
Class HTMLCoder

java.lang.Object
  extended by edu.mayo.bsi.ngsportal.server.HTMLCoder

public class HTMLCoder
extends Object

Class to encode and decode all the parameters needed to do a search on the server, or to rebuild the interface on the client.

@author Gregory Dougherty


Constructor Summary
HTMLCoder()
           
 
Method Summary
static String httpDecode(String token)
          Take a string that was HTML encoded and decode it
static String httpDecodeParameter(javax.servlet.http.HttpServletRequest request, String parameter)
          Extract a HTML encoded parameter from an HTTP Request and decode it
static String[] httpDecodeParameterValues(javax.servlet.http.HttpServletRequest request, String parameter)
          Extract all HTML encoded parameter values from an HTTP Request and decode them
static String httpEncode(String token)
          Take a string and encode it so that it can be safely sent via HTTP
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLCoder

public HTMLCoder()
Method Detail

httpEncode

public static String httpEncode(String token)
Take a string and encode it so that it can be safely sent via HTTP

Parameters:
token - String to encode
Returns:
String that is URL safe

httpDecode

public static String httpDecode(String token)
Take a string that was HTML encoded and decode it

Parameters:
token - URL safe string to be decoded
Returns:
The decoded string

httpDecodeParameter

public static String httpDecodeParameter(javax.servlet.http.HttpServletRequest request,
                                         String parameter)
Extract a HTML encoded parameter from an HTTP Request and decode it

Parameters:
request - Where to get the parameter. Must not be null
parameter - Name of the parameter to be decoded
Returns:
The decoded string, or null if no such parameter

httpDecodeParameterValues

public static String[] httpDecodeParameterValues(javax.servlet.http.HttpServletRequest request,
                                                 String parameter)
Extract all HTML encoded parameter values from an HTTP Request and decode them

Parameters:
request - Where to get the parameter. Must not be null
parameter - Name of the parameter values to be decoded
Returns:
An array of decoded strings, or null if no such parameter