org.apache.camel.util
Class MessageHelper

java.lang.Object
  extended by org.apache.camel.util.MessageHelper

public final class MessageHelper
extends Object

Some helper methods when working with Message.

Version:
$Revision: 767437 $

Method Summary
static String extractBodyAsString(Message message)
          Extracts the given body and returns it as a String, that can be used for logging etc.
static String getBodyTypeName(Message message)
          Gets the given body class type name as a String.
static void resetStreamCache(Message message)
          If the message body contains a StreamCache instance, reset the cache to enable reading from it again.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

extractBodyAsString

public static String extractBodyAsString(Message message)
Extracts the given body and returns it as a String, that can be used for logging etc.

Will handle stream based bodies wrapped in StreamCache.

Parameters:
message - the message with the body
Returns:
the body as String, can return null if no body

getBodyTypeName

public static String getBodyTypeName(Message message)
Gets the given body class type name as a String.

Will skip java.lang. for the build in Java types.

Parameters:
message - the message with the body
Returns:
the body typename as String, can return null if no body

resetStreamCache

public static void resetStreamCache(Message message)
If the message body contains a StreamCache instance, reset the cache to enable reading from it again.

Parameters:
message - the message for which to reset the body


Apache CAMEL