super(phase);
}
public void handleMessage(Message message) throws Fault
{
final LoggingMessage buffer = new LoggingMessage("Inbound Message\n----------------------------");
buffer.getHeader().append(Message.CONTENT_TYPE).append(":").append(message.get(Message.CONTENT_TYPE));
String encoding = (String)message.get(Message.ENCODING);
if (encoding != null)
buffer.getEncoding().append(encoding);
Object headers = message.get(Message.PROTOCOL_HEADERS);
if (headers != null)
buffer.getHeader().append(headers);
InputStream is = message.getContent(InputStream.class);
if (is != null)
{
CachedOutputStream bos = new CachedOutputStream();
try
{
IOUtils.copy(is,bos);
bos.flush();
is.close();
message.setContent(InputStream.class,bos.getInputStream());
bos.writeCacheTo(buffer.getPayload(),limit);
bos.close();
}
catch (IOException e)
{
throw new Fault(e);
}
}
try
{
if (logMessage)
MessageManager.set(Utils.zip(buffer.toString()));
}
catch (IOException e)
{
if (logger.isInfoEnabled())
logger.error("",e);
else
logger.error(buffer.toString(),e);
}
if (logger.isInfoEnabled())
logger.info(buffer.toString());
}