org.apache.camel.component.ahc.helper
Class AhcHelper

java.lang.Object
  extended by org.apache.camel.component.ahc.helper.AhcHelper

public final class AhcHelper
extends Object


Method Summary
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 object
static 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 stream
target - 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 found
IOException - 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 exchange
endpoint - the endpoint
Returns:
the URL to invoke
Throws:
URISyntaxException - is thrown if the URL is invalid
UnsupportedEncodingException


Apache CAMEL