public class HttpUtil
extends com.labvantage.sapphire.BaseClass
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
STANDARD_ENCODE |
static java.lang.String |
UTF8 |
Constructor and Description |
---|
HttpUtil()
HttpUtil Constructor
|
HttpUtil(HttpServletRequest request,
HttpServletResponse response)
HttpUtil Constructor option2
|
HttpUtil(HttpServletResponse response)
HttpUtil Constructor option3
|
HttpUtil(PageContext pagecontext)
HttpUtil Constructor option1
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
appendRequestParameters(PageContext pageContext,
java.lang.String url) |
static java.lang.String |
decode(java.lang.String str)
Decodes a String that is encoded using HttpUtil.encode method
|
static java.lang.String |
decodeURIComponent(java.lang.String component)
Performs decoding on a URL component (individual parameter values) that has been encoded client-side using JavaScript encodeURIComponent.
|
static java.lang.String |
decodeURIComponent(java.lang.String component,
java.lang.String encoding)
Performs decoding on a URL component (individual parameter values) that has been encoded client-side using JavaScript encodeURIComponent
|
static java.lang.String |
decrypt(java.lang.String text) |
static java.lang.String |
encode(java.lang.String str)
Encodes a String value for BO authentication
|
static java.lang.String |
encodeURIComponent(java.lang.String component)
Performs encoding on a URL component (individual parameter values) that can safely be decoded on the client-side using JavaScript decodeURIComponent.
|
static java.lang.String |
encodeURIComponent(java.lang.String component,
java.lang.String encoding)
Performs encoding on a URL component (individual parameter values) that can safely be decoded on the client-side using JavaScript decodeURIComponent
|
boolean |
existCookie(java.lang.String name)
Checks for the existence of a cookie (requires constructor option1 or option2)
|
static java.lang.String |
getApplicationHome()
Gets the APPLICATION_HOME folder
|
static java.lang.String |
getAppRoot(ServletContext servletContext)
Gets the root folder for the application server
|
static java.lang.String |
getConnectionId(javax.servlet.jsp.PageContext pageContext)
Gets the current sapphire connectionid from the page Context
|
static com.labvantage.sapphire.services.ConnectionInfo |
getConnectionInfo(javax.servlet.jsp.PageContext pageContext)
Gets the current sapphire ConnectionInfo from the page Context
|
java.util.HashMap |
getCookies()
Get cookies
|
java.lang.String |
getCookieValue(java.lang.String name)
Gets a cookie value (requires constructor option1 or option2 or option3)
|
static java.lang.String |
getEncryptionJS()
Gets the core sapphire javascript encryption API
|
static java.lang.String |
getEncryptionJS(boolean useFullIncludes) |
static java.lang.String |
getEncryptionJS(java.lang.String pathpreifx) |
static java.lang.String |
getEncryptionJS(java.lang.String pathpreifx,
boolean useFullIncludes) |
static java.lang.String |
getGWTEncryptionJS(java.io.File consoleConfigFile) |
static java.lang.String |
getNameServerList(javax.servlet.jsp.PageContext pageContext)
Deprecated.
|
static java.util.HashMap<java.lang.String,java.lang.String> |
getQueryStringMap(java.net.URL url)
Converts a query string in a URL to a hashmap of parameter and value
|
static java.util.HashMap |
getRequestMap(ServletRequest request)
Puts the request parameters into a convenient hashmap
|
static PropertyList |
getRequestPropertyList(ServletRequest request)
Puts the request parameters into a convenient propertylist
|
static java.lang.String |
getSapphireHome()
Gets the SAPPHIRE_HOME folder
|
static java.util.Locale |
getSessionLocale(PageContext pageContext)
Returns the current user's locale
|
static java.util.TimeZone |
getSessionTimeZone(PageContext pageContext)
Returns the current user's timezone
|
static java.lang.String |
getWebAppRoot(ServletContext servletContext)
Gets the root folder for the web application
|
void |
goErrorPage(java.lang.String errorpage,
java.lang.String errormsg)
Redirects to an error page if the response has not been commited, otherwise displays the error message
(requires constructor option1)
|
void |
removeCookie(java.lang.String name)
Removes a cookie, i.e.
|
void |
setCookieValue(java.lang.String name,
java.lang.String value)
Sets a cookie value (requires constructor option1 or option2 or option3)
|
void |
setCookieValue(java.lang.String name,
java.lang.String value,
boolean permenant)
Sets a cookie value (requires constructor option1 or option2 or option3)
|
void |
setCookieValue(java.lang.String name,
java.lang.String value,
boolean permenant,
boolean httponly)
Sets a cookie value (requires constructor option1 or option2 or option3)
|
static void |
setRequestVariables(HttpServletRequest request,
java.lang.String varName,
PropertyList propertyList) |
public static final java.lang.String UTF8
public static final java.lang.String STANDARD_ENCODE
public HttpUtil()
public HttpUtil(PageContext pagecontext)
pagecontext
- A valid pointer to the PageContextpublic HttpUtil(HttpServletRequest request, HttpServletResponse response)
request
- A valid pointer to the HttpServletRequestresponse
- A valid pointer to the HttpServletResponsepublic HttpUtil(HttpServletResponse response)
response
- A valid pointer to the HttpServletResponsepublic boolean existCookie(java.lang.String name)
name
- Name of the cookie to retrievepublic void removeCookie(java.lang.String name)
name
- Name of the cookie to removepublic void setCookieValue(java.lang.String name, java.lang.String value)
name
- Name of the cookie to updatevalue
- New value for the cookiepublic void setCookieValue(java.lang.String name, java.lang.String value, boolean permenant)
name
- Name of the cookie to updatevalue
- New value for the cookiepermenant
- True if cookie is permenantpublic void setCookieValue(java.lang.String name, java.lang.String value, boolean permenant, boolean httponly)
name
- Name of the cookie to updatevalue
- New value for the cookiepermenant
- True if cookie is permenanthttponly
- True if cookie is to be httponlypublic java.lang.String getCookieValue(java.lang.String name)
name
- Name of the cookiepublic java.util.HashMap getCookies()
public void goErrorPage(java.lang.String errorpage, java.lang.String errormsg)
errorpage
- errormsg
- public static java.lang.String getAppRoot(ServletContext servletContext)
servletContext
- The current servletContextpublic static java.lang.String getWebAppRoot(ServletContext servletContext)
servletContext
- The current servletContextpublic static java.lang.String getSapphireHome()
public static java.lang.String getApplicationHome()
public static PropertyList getRequestPropertyList(ServletRequest request)
request
- The current servlet Requestpublic static java.util.HashMap getRequestMap(ServletRequest request)
request
- The current servlet Requestpublic static java.util.HashMap<java.lang.String,java.lang.String> getQueryStringMap(java.net.URL url)
url
- the url to processpublic static void setRequestVariables(HttpServletRequest request, java.lang.String varName, PropertyList propertyList)
public static java.lang.String appendRequestParameters(PageContext pageContext, java.lang.String url)
public static java.lang.String getConnectionId(javax.servlet.jsp.PageContext pageContext)
pageContext
- The current pageContextpublic static com.labvantage.sapphire.services.ConnectionInfo getConnectionInfo(javax.servlet.jsp.PageContext pageContext)
pageContext
- The current pageContextpublic static java.lang.String getNameServerList(javax.servlet.jsp.PageContext pageContext)
pageContext
- The current pageContextpublic static java.lang.String getEncryptionJS()
public static java.lang.String getEncryptionJS(boolean useFullIncludes)
public static java.lang.String getGWTEncryptionJS(java.io.File consoleConfigFile)
public static java.lang.String getEncryptionJS(java.lang.String pathpreifx)
public static java.lang.String getEncryptionJS(java.lang.String pathpreifx, boolean useFullIncludes)
public static java.lang.String encode(java.lang.String str)
str
- String to be encodedpublic static java.lang.String decode(java.lang.String str)
str
- String to be decodedpublic static java.util.TimeZone getSessionTimeZone(PageContext pageContext)
pageContext
- public static java.util.Locale getSessionLocale(PageContext pageContext)
pageContext
- public static java.lang.String encodeURIComponent(java.lang.String component)
component
- String to be encodedpublic static java.lang.String encodeURIComponent(java.lang.String component, java.lang.String encoding)
component
- String to be encodedencoding
- What encoding to usepublic static java.lang.String decodeURIComponent(java.lang.String component)
component
- String to be decodedpublic static java.lang.String decodeURIComponent(java.lang.String component, java.lang.String encoding)
component
- String to be decodedpublic static java.lang.String decrypt(java.lang.String text)