org.objectweb.telosys.util.web
Class WebUtil

java.lang.Object
  extended byorg.objectweb.telosys.util.web.WebUtil

public final class WebUtil
extends java.lang.Object


Method Summary
static void error(javax.servlet.http.HttpServletResponse response, java.lang.String sMsg)
           
static void error(javax.servlet.http.HttpServletResponse response, java.lang.String sMsg, java.util.ListIterator iter)
           
static boolean forward(java.lang.String sUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
static java.lang.String getContextResourceURI(javax.servlet.http.HttpServletRequest request, java.lang.String sResourcePath)
          Returns the context URI for the given resource path
static java.lang.String getContextResourceURL(javax.servlet.http.HttpServletRequest request, java.lang.String sResourcePath)
          Returns the full "client side" http URL for the given resource path
static java.lang.String getContextRootURI(javax.servlet.http.HttpServletRequest request)
          Returns the context root URI for the given request
( e.g. : "/WebAppContext" )
static java.lang.String getContextRootURL(javax.servlet.http.HttpServletRequest request)
          Returns the full context root URL for the given request
( e.g. : "http://server:8080/WebAppContext" )
static java.lang.String getRootUrl(javax.servlet.http.HttpServletRequest request)
          Deprecated. : use getContextRootURL() instead
static void info(javax.servlet.http.HttpServletResponse response, java.lang.String sMsg)
           
static void msgPage(javax.servlet.http.HttpServletResponse response, java.lang.String sTitle, java.lang.String sMsg)
           
static void noCache(javax.servlet.http.HttpServletResponse response)
          Set the HTTP headers to avoid caching
static boolean redirect(java.lang.String sUrl, javax.servlet.http.HttpServletResponse response)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

forward

public static boolean forward(java.lang.String sUrl,
                              javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws javax.servlet.ServletException,
                              java.io.IOException
Parameters:
sUrl - :
request - :
response - :
Returns:
boolean :
Throws:
javax.servlet.ServletException - :
java.io.IOException - :

redirect

public static boolean redirect(java.lang.String sUrl,
                               javax.servlet.http.HttpServletResponse response)
Parameters:
sUrl - : "HTTP redirection" to an other URL ( HTTP code "302" )
response - :
Returns:
boolean : true = OK, false = ERR

noCache

public static void noCache(javax.servlet.http.HttpServletResponse response)
Set the HTTP headers to avoid caching

Parameters:
response -

info

public static void info(javax.servlet.http.HttpServletResponse response,
                        java.lang.String sMsg)
                 throws javax.servlet.ServletException,
                        java.io.IOException
Parameters:
response - :
sMsg - :
Throws:
javax.servlet.ServletException - :
java.io.IOException - :

error

public static void error(javax.servlet.http.HttpServletResponse response,
                         java.lang.String sMsg)
                  throws javax.servlet.ServletException,
                         java.io.IOException
Parameters:
response - :
sMsg - :
Throws:
javax.servlet.ServletException - :
java.io.IOException - :

error

public static void error(javax.servlet.http.HttpServletResponse response,
                         java.lang.String sMsg,
                         java.util.ListIterator iter)
                  throws javax.servlet.ServletException,
                         java.io.IOException
Parameters:
response - :
sMsg - :
iter - :
Throws:
javax.servlet.ServletException - :
java.io.IOException - :

msgPage

public static void msgPage(javax.servlet.http.HttpServletResponse response,
                           java.lang.String sTitle,
                           java.lang.String sMsg)

getRootUrl

public static java.lang.String getRootUrl(javax.servlet.http.HttpServletRequest request)
Deprecated. : use getContextRootURL() instead

Returns the full context root URL for the given request with "/" at the end
( e.g. : "http://server:8080/WebAppContext/" )

Parameters:
request -
Returns:

getContextRootURL

public static java.lang.String getContextRootURL(javax.servlet.http.HttpServletRequest request)
Returns the full context root URL for the given request
( e.g. : "http://server:8080/WebAppContext" )

Parameters:
request -
Returns:
"http://server:8080/WebAppContext"

getContextRootURI

public static java.lang.String getContextRootURI(javax.servlet.http.HttpServletRequest request)
Returns the context root URI for the given request
( e.g. : "/WebAppContext" )

Parameters:
request -
Returns:
"/WebAppContext"

getContextResourceURL

public static java.lang.String getContextResourceURL(javax.servlet.http.HttpServletRequest request,
                                                     java.lang.String sResourcePath)
Returns the full "client side" http URL for the given resource path

Parameters:
request -
sResourcePath - : the server side context resource path
( ie : "/folder/file", "folder/file", "/file", "file" )
Returns:
: the full URL ( ie : "http://myhost:8080/contextname/folder/file")

getContextResourceURI

public static java.lang.String getContextResourceURI(javax.servlet.http.HttpServletRequest request,
                                                     java.lang.String sResourcePath)
Returns the context URI for the given resource path

Parameters:
request -
sResourcePath - : the server side context resource path
( ie : "/folder/file", "folder/file", "/file", "file" )
Returns:
: the URI ( ie : "/contextname/folder/file" )