Package org.apache.camel.http.base
Class HttpHelper
- java.lang.Object
-
- org.apache.camel.http.base.HttpHelper
-
public final class HttpHelper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidappendHeader(Map<String,Object> headers, String key, Object value)Appends the key/value to the headers.static ObjectextractHttpParameterValue(String value)Extracts the parameter value.static StringgetCharsetFromContentType(String contentType)static booleanisSecureConnection(String uri)static booleanisStatusCodeOk(int statusCode, String okStatusCodeRange)Checks whether the given http status code is within the ok rangestatic int[]parserHttpVersion(String s)static voidsetCharsetFromContentType(String contentType, org.apache.camel.Exchange exchange)
-
-
-
Method Detail
-
isSecureConnection
public static boolean isSecureConnection(String uri)
-
parserHttpVersion
public static int[] parserHttpVersion(String s) throws ProtocolException
- Throws:
ProtocolException
-
setCharsetFromContentType
public static void setCharsetFromContentType(String contentType, org.apache.camel.Exchange exchange)
-
appendHeader
public static void appendHeader(Map<String,Object> headers, String key, Object value)
Appends the key/value to the headers. This implementation supports keys with multiple values. In such situations the value will be aListthat contains the multiple values.- Parameters:
headers- headerskey- the keyvalue- the value
-
extractHttpParameterValue
public static Object extractHttpParameterValue(String value)
Extracts the parameter value. This implementation supports HTTP multi value parameters which is based on the syntax of [value1, value2, value3] by returning aListcontaining the values. If the value is not a HTTP mulit value the value is returned as is.- Parameters:
value- the parameter value- Returns:
- the extracted parameter value, see more details in javadoc.
-
isStatusCodeOk
public static boolean isStatusCodeOk(int statusCode, String okStatusCodeRange)Checks whether the given http status code is within the ok range- Parameters:
statusCode- the status codeokStatusCodeRange- the ok range (inclusive)- Returns:
- true if ok, false otherwise
-
-