Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

oracle.jbo.http
Class HttpUtil

java.lang.Object
  extended byoracle.jbo.http.HttpUtil

public class HttpUtil
extends java.lang.Object

Utilities for working with HTTP. NOTE: This source code copies the original implementation in the class : oracle.cabo.share.util.CaboHttpUtils. The reason for the copy is to avoid Cabo dependencies in the Core BC4J code.


Method Summary
static java.lang.String decodeRequestParameter(java.lang.String string, java.lang.String encoding, byte[] buffer)
          Given a parameter string and the name of a character encoding, fixes the string.
static java.util.Locale determineLocale(javax.servlet.ServletRequest request)
          Returns the locale to be used for a request, based on Accept-Language and Accept-Charset HTTP headers.
static java.lang.String getFullServletPath(javax.servlet.http.HttpServletRequest httpRequest)
          Returns the full servlet path: getRequestURI() - getPathInfo() .
static void setNoCacheHeaders(javax.servlet.http.HttpServletResponse response)
          Sets headers on a servlet reponse to completely block caching for even the most poorly written browsers.
static void validateEncoding(java.lang.String encoding)
          Throws an UnsupportedEncodingException if the provided encoding is not supported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFullServletPath

public static java.lang.String getFullServletPath(javax.servlet.http.HttpServletRequest httpRequest)
Returns the full servlet path: getRequestURI() - getPathInfo() . In the Servlet 2.1 API, this is just getServletPath() , but in Servlet 2.2, it's getContextPath() + getServletPath(), hence the need for a utility method that works in both versions.


setNoCacheHeaders

public static void setNoCacheHeaders(javax.servlet.http.HttpServletResponse response)
Sets headers on a servlet reponse to completely block caching for even the most poorly written browsers.


determineLocale

public static java.util.Locale determineLocale(javax.servlet.ServletRequest request)
Returns the locale to be used for a request, based on Accept-Language and Accept-Charset HTTP headers. Returns null if the locale cannot be determined.


validateEncoding

public static void validateEncoding(java.lang.String encoding)
                             throws java.io.UnsupportedEncodingException
Throws an UnsupportedEncodingException if the provided encoding is not supported.

Parameters:
encoding - the name of a character encoding
Throws:
java.io.UnsupportedEncodingException

decodeRequestParameter

public static final java.lang.String decodeRequestParameter(java.lang.String string,
                                                            java.lang.String encoding,
                                                            byte[] buffer)
                                                     throws java.io.UnsupportedEncodingException
Given a parameter string and the name of a character encoding, fixes the string. The Servlet API builds Strings for all submitted data as if they were ISO-8859-1 encoded; this function undoes the damage. Clients should pass in the same encoding that they used for generating the page that the submission comes from.

Parameters:
string - the string
encoding - the name of a character encoding
buffer - an optional byte buffer, for reuse; pass null if you're not calling this function repeatedly
Throws:
java.io.UnsupportedEncodingException

Oracle ADF Model and Business Components API Reference 10.1.2 B14022-01

 

Copyright © 1997, 2004, Oracle. All rights reserved.