public final class HttpUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ACCESS_CONTROL_ALLOW_ORIGIN_HEADER |
| Modifier and Type | Method and Description |
|---|---|
static List<Pair<String,String>> |
getCachingHeadersToSet(int ttl,
boolean noProxy) |
static int |
getDefaultTtl() |
static TimeSource |
getTimeSource() |
static boolean |
isJSONP(javax.servlet.http.HttpServletRequest request) |
static void |
setCachingHeaders(javax.servlet.http.HttpServletResponse response)
Sets HTTP headers that instruct the browser to cache content.
|
static void |
setCachingHeaders(javax.servlet.http.HttpServletResponse response,
boolean noProxy)
Sets HTTP headers that instruct the browser to cache content.
|
static void |
setCachingHeaders(javax.servlet.http.HttpServletResponse response,
int ttl)
Sets HTTP headers that instruct the browser to cache content.
|
static void |
setCachingHeaders(javax.servlet.http.HttpServletResponse response,
int ttl,
boolean noProxy)
Sets HTTP headers that instruct the browser to cache content.
|
static void |
setCORSheader(javax.servlet.http.HttpServletResponse resp,
Collection<String> validOrigins)
Set the header for Cross-Site Resource Sharing.
|
static void |
setDefaultTtl(int defaultTtl) |
static void |
setNoCache(javax.servlet.http.HttpServletResponse response) |
static void |
setTimeSource(TimeSource timeSource) |
public static final String ACCESS_CONTROL_ALLOW_ORIGIN_HEADER
public static void setTimeSource(TimeSource timeSource)
public static TimeSource getTimeSource()
public static void setCachingHeaders(javax.servlet.http.HttpServletResponse response)
response - The HTTP responsepublic static void setCachingHeaders(javax.servlet.http.HttpServletResponse response,
boolean noProxy)
response - The HTTP responsenoProxy - True if you don't want the response to be cacheable by proxies.public static void setCachingHeaders(javax.servlet.http.HttpServletResponse response,
int ttl)
response - The HTTP responsettl - The time to cache for, in seconds. If 0, then insure that
this object is not cached.public static void setNoCache(javax.servlet.http.HttpServletResponse response)
public static void setCachingHeaders(javax.servlet.http.HttpServletResponse response,
int ttl,
boolean noProxy)
response - The HTTP responsettl - The time to cache for, in seconds. If 0, then insure that
this object is not cached.noProxy - True if you don't want the response to be cacheable by proxies.public static List<Pair<String,String>> getCachingHeadersToSet(int ttl, boolean noProxy)
public static int getDefaultTtl()
public static void setDefaultTtl(int defaultTtl)
public static boolean isJSONP(javax.servlet.http.HttpServletRequest request)
throws IllegalArgumentException
IllegalArgumentExceptionpublic static void setCORSheader(javax.servlet.http.HttpServletResponse resp,
Collection<String> validOrigins)
resp - HttpServletResponse to modifyvalidOrigins - a space separated list of Origins as defined by the html5 spechttp://dev.w3.org/html5/spec/browsers.html#origin-0Copyright © 2007-2012. All Rights Reserved.