Package com.wowza.util
Class HTTPUtils
- Object
- 
- com.wowza.util.HTTPUtils
 
- 
 public class HTTPUtils extends ObjectHTTPUtils: utility class for making http requests. 
- 
- 
Field SummaryFields Modifier and Type Field Description static org.apache.commons.lang.time.FastDateFormatCOOKIEDATEFORMAT
 - 
Constructor SummaryConstructors Constructor Description HTTPUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static StringassembleQueryStr(java.util.Map<String,String> queryMap, boolean enableEncoding)Assemble a map of name value pairs into a single query string.static java.util.Map<String,String>expandHTTPHeadersStr(String httpUserHTTPHeadersStr)static StringformatDeleteCookie(String name, String path, String domain)Formats a cookie header value that is in the past to delete a cookiestatic StringformatSetCookie(String name, String value, int timeoffset, String path, String domain, boolean isSecure)Format a HTTP header Set-Cookie valuestatic byte[]HTTPRequestToByteArray(String inUrl, String method, String data, java.util.Map<String,String> headers)Make a HTTP request and return the result as a byte arraystatic byte[]HTTPRequestToByteArray(String inUrl, String method, String data, java.util.Map<String,String> inHeaders, java.util.Map<String,java.util.List<String>> outHeaders, long dataLimit)Make a HTTP request and return the result as a byte arraystatic booleanHTTPRequestToFile(java.io.File file, String inUrl, String method, String data, java.util.List headers)Make a HTTP request and have the result saved to a file.static java.util.List<String[]>splitCookie(String str)Breaks Cookies header value into a list of name/value pairs.static String[]splitPragmas(String str)Split HTTP Pragma values at commas that separate values.static java.util.Map<String,String>splitQueryStr(String queryStr)Split a query string into a map and URL decode the valuesstatic StringstatusCodeToStr(int statusCode)Convert an HTTP status code to a string
 
- 
- 
- 
Method Detail- 
HTTPRequestToFilepublic static boolean HTTPRequestToFile(java.io.File file, String inUrl, String method, String data, java.util.List headers)Make a HTTP request and have the result saved to a file.- Parameters:
- file- destination
- inUrl- url (will work with http and https)
- method- method (POST, GET)
- data- post data
- headers- map of headers (Content-type...)
- Returns:
- true if successful
 
 - 
HTTPRequestToByteArraypublic static byte[] HTTPRequestToByteArray(String inUrl, String method, String data, java.util.Map<String,String> headers)Make a HTTP request and return the result as a byte array- Parameters:
- inUrl- url (will work with http and https)
- method- method (POST, GET)
- data- post data
- headers- map of headers (Content-type...)
- Returns:
- byte array of result or null if not successful
 
 - 
HTTPRequestToByteArraypublic static byte[] HTTPRequestToByteArray(String inUrl, String method, String data, java.util.Map<String,String> inHeaders, java.util.Map<String,java.util.List<String>> outHeaders, long dataLimit)Make a HTTP request and return the result as a byte array- Parameters:
- inUrl- url (will work with http and https)
- method- method (POST, GET)
- data- data
- inHeaders- map of headers (Content-type...)
- outHeaders- response headers
- dataLimit- maximum number of bytes to read, zero for no limit
- Returns:
- byte array of result or null if not successful
 
 - 
assembleQueryStrpublic static String assembleQueryStr(java.util.Map<String,String> queryMap, boolean enableEncoding)Assemble a map of name value pairs into a single query string. URL encode query string values.- Parameters:
- queryMap- name value pairs
- Returns:
- query string
 
 - 
splitQueryStrpublic static java.util.Map<String,String> splitQueryStr(String queryStr) Split a query string into a map and URL decode the values- Parameters:
- queryStr- query string
- Returns:
- map of name value pairs
 
 - 
splitPragmaspublic static String[] splitPragmas(String str) Split HTTP Pragma values at commas that separate values. It deals with internal commas in strings. Example: no-cache, client-id=1485578017, features="seekable,stridable", timeout=6 Result: no-cache client-id=1485578017 features="seekable,stridable" timeout=6 - Parameters:
- str- Pragma value
- Returns:
- array of strings broken at commas
 
 - 
splitCookiepublic static java.util.List<String[]> splitCookie(String str) Breaks Cookies header value into a list of name/value pairs. The Cookie string: "name1=value1;name2;name1=value3" is returned as: List(item({"name1", "value1"}), item("name2", null), item("name1", "value3"))- Parameters:
- str- input string
- Returns:
- List of name value pairs
 
 - 
formatDeleteCookiepublic static String formatDeleteCookie(String name, String path, String domain)Formats a cookie header value that is in the past to delete a cookie- Parameters:
- name- variable name
- path- path
- domain- domain
- Returns:
- formatted cookie string
 
 - 
formatSetCookiepublic static String formatSetCookie(String name, String value, int timeoffset, String path, String domain, boolean isSecure)Format a HTTP header Set-Cookie value- Parameters:
- name- variable name
- value- variable value - null if no value
- timeoffset- expiration time in seconds
- path- cookie path
- domain- cookie domain
- isSecure- is cookie secure
- Returns:
- formatted cookie string
 
 - 
statusCodeToStrpublic static String statusCodeToStr(int statusCode) Convert an HTTP status code to a string- Parameters:
- statusCode- HTTP status code
- Returns:
- string
 
 - 
expandHTTPHeadersStrpublic static java.util.Map<String,String> expandHTTPHeadersStr(String httpUserHTTPHeadersStr) 
 
- 
 
-