Class AhcHelper
- java.lang.Object
-
- org.apache.camel.component.ahc.helper.AhcHelper
-
public final class AhcHelper extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static URI
createURI(org.apache.camel.Exchange exchange, String url, AhcEndpoint endpoint)
Creates the URI to invoke.static String
createURL(org.apache.camel.Exchange exchange, AhcEndpoint endpoint)
Creates the URL to invoke.static Object
deserializeJavaObjectFromStream(InputStream is)
Deserializes the input stream to a Java objectstatic void
setCharsetFromContentType(String contentType, org.apache.camel.Exchange exchange)
static void
writeObjectToStream(OutputStream stream, Object target)
Writes the given object as response body to the output stream
-
-
-
Method Detail
-
writeObjectToStream
public static void writeObjectToStream(OutputStream stream, Object target) throws IOException
Writes the given object as response body to the output stream- Parameters:
stream
- output streamtarget
- object to write- Throws:
IOException
- is thrown if error writing
-
deserializeJavaObjectFromStream
public static Object deserializeJavaObjectFromStream(InputStream is) throws ClassNotFoundException, IOException
Deserializes the input stream to a Java object- Parameters:
is
- input stream for the Java object- Returns:
- the java object, or null if input stream was null
- Throws:
ClassNotFoundException
- is thrown if class not foundIOException
- can be thrown
-
setCharsetFromContentType
public static void setCharsetFromContentType(String contentType, org.apache.camel.Exchange exchange)
-
createURL
public static String createURL(org.apache.camel.Exchange exchange, AhcEndpoint endpoint) throws URISyntaxException, UnsupportedEncodingException
Creates the URL to invoke.- Parameters:
exchange
- the exchangeendpoint
- the endpoint- Returns:
- the URL to invoke
- Throws:
URISyntaxException
- is thrown if the URL is invalidUnsupportedEncodingException
-
createURI
public static URI createURI(org.apache.camel.Exchange exchange, String url, AhcEndpoint endpoint) throws URISyntaxException
Creates the URI to invoke.- Parameters:
exchange
- the exchangeurl
- the url to invokeendpoint
- the endpoint- Returns:
- the URI to invoke
- Throws:
URISyntaxException
-
-