*/
protected void doPostRapidMode(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
// get the message context
MessageContext messageContext = RapidWSServlet.getMessageContext();
// initialize the message context
RapidWSServlet.initializeMessageContext(messageContext, request);
// get input and output streams
InputStream inputStream = new BufferedInputStream(request.getInputStream());
OutputStream outputStream = new BufferedOutputStream(response.getOutputStream());
// get the message processor
MessageProcessor messageProcessor = MessageProcessorFactory.getMessageProcessor(
this.getMessageProcessorName());
// process the message
messageProcessor.processMessage(messageContext, inputStream, outputStream);
String contentType = TextContent.EMPTY;
String outputText = TextContent.EMPTY;
if (messageContext.isError())
{
// prep return headers
contentType = RapidWSServlet.CONTENT_TYPE_TEXT_XML + ";charset=UTF-8";
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
outputText = messageContext.getErrorText();
}
else
{
String returnAction = messageContext.getReturnAction();
if (returnAction.length() > 0)
{
// prep return headers
contentType = RapidWSServlet.SOAP_RESPONSE_CONTENT_TYPE + "; action=\"urn:" + returnAction + "\";charset=UTF-8";
response.setStatus(HttpServletResponse.SC_OK);
}
else
{
// prep return headers
contentType = RapidWSServlet.CONTENT_TYPE_TEXT_XML + ";charset=UTF-8";
response.setStatus(HttpServletResponse.SC_ACCEPTED);
response.setContentLength(0);
}
outputText = messageContext.getOutgoingText();
}
// output result
response.setContentType(contentType);
IOHelper.writeString(outputStream, outputText);