Author: asankha
Date: Fri Nov 13 09:09:08 2009
New Revision: 835783
URL: http://svn.apache.org/viewvc?rev=835783&view=rev
Log:
add a variant of the plain text message formatter/builder, which saves the
original content type of any textual content, and uses it to write back the
message with the same content type later. This allows proxying of text/plain,
text/html etc content easily
Added:
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/raw/
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/raw/RawTextMessageBuilder.java
- copied, changed from r835735,
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/hessian/HessianMessageBuilder.java
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/raw/RawTextMessageFormatter.java
- copied, changed from r835735,
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/hessian/HessianMessageFormatter.java
Modified:
synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
Modified:
synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
URL:
http://svn.apache.org/viewvc/synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java?rev=835783&r1=835782&r2=835783&view=diff
==============================================================================
---
synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
(original)
+++
synapse/branches/1.3/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
Fri Nov 13 09:09:08 2009
@@ -279,10 +279,6 @@
response.removeProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
}
- // copy the message type property thats used by the out message
to the response message
-
response.setProperty(org.apache.axis2.Constants.Configuration.MESSAGE_TYPE,
-
axisOutMsgCtx.getProperty(org.apache.axis2.Constants.Configuration.MESSAGE_TYPE));
-
// compare original received message (axisOutMsgCtx) soap version
with the response
// if they are different change to original version
if(axisOutMsgCtx.isSOAP11() != response.isSOAP11()) {
Copied:
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/raw/RawTextMessageBuilder.java
(from r835735,
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/hessian/HessianMessageBuilder.java)
URL:
http://svn.apache.org/viewvc/synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/raw/RawTextMessageBuilder.java?p2=synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/raw/RawTextMessageBuilder.java&p1=synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/hessian/HessianMessageBuilder.java&r1=835735&r2=835783&rev=835783&view=diff
==============================================================================
---
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/hessian/HessianMessageBuilder.java
(original)
+++
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/raw/RawTextMessageBuilder.java
Fri Nov 13 09:09:08 2009
@@ -17,137 +17,99 @@
* under the License.
*/
-package org.apache.synapse.format.hessian;
+package org.apache.synapse.format.raw;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.impl.llom.OMSourcedElementImpl;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.builder.Builder;
+import org.apache.axis2.builder.BuilderUtil;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.Parameter;
+import org.apache.axis2.format.PlainTextBuilder;
+import org.apache.axis2.format.WrappedTextNodeOMDataSourceFromDataSource;
+import org.apache.axis2.format.WrappedTextNodeOMDataSourceFromReader;
import org.apache.axis2.transport.base.BaseConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.SynapseConstants;
-import org.apache.synapse.core.SynapseEnvironment;
-import org.apache.synapse.transport.nhttp.NhttpConstants;
-import org.apache.synapse.util.SynapseBinaryDataSource;
+import org.apache.axis2.transport.base.BaseUtils;
-import javax.activation.DataHandler;
-
-import java.io.IOException;
+import javax.activation.DataSource;
+import javax.xml.namespace.QName;
import java.io.InputStream;
-import java.io.PushbackInputStream;
-
-/**
- * Enables a message encoded using the Hessian binary protocol to be received
by axis2/synapse
- * and this builds the HessianDataSource to represent the hessian message
inside the SOAP info-set
- *
- * @see org.apache.axis2.builder.Builder
- * @see org.apache.synapse.util.SynapseBinaryDataSource
- */
-public class HessianMessageBuilder implements Builder {
-
- private static final Log log =
LogFactory.getLog(HessianMessageBuilder.class);
-
- /**
- * Returns an OMElement from a Hessian encoded message
- *
- * @param inputStream stream containing the Hessian message to be built
- * @param contentType content type of the message
- * @param messageContext message to which the hessian message has to be
attached
- * @return OMElement containing Hessian data handler keeping the message
- * @throws AxisFault in case of a failure in building the hessian message
- *
- * @see
org.apache.axis2.builder.Builder#processDocument(java.io.InputStream,
- * String, org.apache.axis2.context.MessageContext)
- */
- public OMElement processDocument(final InputStream inputStream, final
String contentType,
- final MessageContext messageContext) throws AxisFault {
-
- if (log.isDebugEnabled()) {
- log.debug("Start building the hessian message in to a
HessianDataSource");
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+
+public class RawTextMessageBuilder extends PlainTextBuilder {
+
+ private final OMNamespace ns = OMAbstractFactory.getOMFactory().
+ createOMNamespace(BaseConstants.AXIOMPAYLOADNS, "ns");
+
+ private static QName getWrapperQName(MessageContext msgContext) {
+ QName wrapperQName = BaseConstants.DEFAULT_TEXT_WRAPPER;
+ if (msgContext.getAxisService() != null) {
+ Parameter wrapperParam
+ =
msgContext.getAxisService().getParameter(BaseConstants.WRAPPER_PARAM);
+ if (wrapperParam != null) {
+ wrapperQName =
BaseUtils.getQNameFromString(wrapperParam.getValue());
+ }
}
+ return wrapperQName;
+ }
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMNamespace ns =
factory.createOMNamespace(HessianConstants.HESSIAN_NAMESPACE_URI,
- HessianConstants.HESSIAN_NS_PREFIX);
- OMElement element = factory.createOMElement(
- HessianConstants.HESSIAN_ELEMENT_LOCAL_NAME, ns);
+ public OMElement processDocument(InputStream inputStream,
+ String contentType,
+ MessageContext msgContext) throws AxisFault {
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ String charSetEnc = BuilderUtil.getCharSetEncoding(contentType);
+ QName wrapperQName = getWrapperQName(msgContext);
+ Reader reader;
try {
-
- Parameter synEnv =
messageContext.getConfigurationContext().getAxisConfiguration()
- .getParameter(SynapseConstants.SYNAPSE_ENV);
-
- PushbackInputStream pis =
detectAndMarkMessageFault(messageContext, inputStream);
-
- DataHandler dataHandler;
- if (synEnv != null && synEnv.getValue() != null) {
- dataHandler = new DataHandler(new SynapseBinaryDataSource(pis,
contentType,
- (SynapseEnvironment) synEnv.getValue()));
- } else {
- // add Hessian data inside a data handler
- dataHandler = new DataHandler(new SynapseBinaryDataSource(pis,
contentType));
- }
- OMText textData = factory.createOMText(dataHandler, true);
- element.addChild(textData);
-
- // indicate that message faults shall be handled as http 200
- messageContext.setProperty(NhttpConstants.FAULTS_AS_HTTP_200,
NhttpConstants.TRUE);
-
- } catch (IOException e) {
- String msg = "Unable to create the HessianDataSource";
- log.error(msg, e);
- throw new AxisFault(msg, e);
+ reader = new InputStreamReader(inputStream, charSetEnc);
+ } catch (UnsupportedEncodingException ex) {
+ throw new AxisFault("Unsupported encoding: " + charSetEnc, ex);
}
+ OMElement ret = new OMSourcedElementImpl(wrapperQName, factory,
+ new WrappedTextNodeOMDataSourceFromReader(wrapperQName, reader));
+ ret.addAttribute("originalContentType", contentType, ns);
+ return ret;
+ }
- if (log.isDebugEnabled()) {
- log.debug("Building the hessian message using HessianDataSource is
successful");
- }
+ public OMElement processDocument(Reader reader,
+ String contentType,
+ MessageContext msgContext) throws AxisFault {
- return element;
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ QName wrapperQName = getWrapperQName(msgContext);
+ OMElement ret = new OMSourcedElementImpl(wrapperQName, factory,
+ new WrappedTextNodeOMDataSourceFromReader(wrapperQName, reader));
+ ret.addAttribute("originalContentType", contentType, ns);
+ return ret;
}
- /**
- * Reads the first four bytes of the inputstream to detect whether the
message represents a
- * fault message. Once a fault message has been detected, a property used
to mark fault messages
- * is stored in the Axis2 message context. The implementaton uses a
PushbackInputStream to be
- * able to put those four bytes back at the end of processing.
- *
- * @param messageContext the Axis2 message context
- * @param inputStream the inputstream to read the Hessian message
- *
- * @return the wrapped (pushback) input stream
- *
- * @throws IOException if an I/O error occurs
- */
- private PushbackInputStream detectAndMarkMessageFault(final MessageContext
messageContext,
- final InputStream inputStream) throws IOException {
-
- int bytesToRead = 4;
- PushbackInputStream pis = new PushbackInputStream(inputStream,
bytesToRead);
- byte[] headerBytes = new byte[bytesToRead];
- int n = pis.read(headerBytes);
-
- // checking fourth byte for fault marker
- if (n == bytesToRead) {
- if (headerBytes[bytesToRead - 1] ==
HessianConstants.HESSIAN_V1_FAULT_IDENTIFIER
- || headerBytes[bytesToRead - 1] ==
HessianConstants.HESSIAN_V2_FAULT_IDENTIFIER) {
- messageContext.setProperty(BaseConstants.FAULT_MESSAGE,
SynapseConstants.TRUE);
- if (log.isDebugEnabled()) {
- log.debug("Hessian fault detected, marking in Axis2
message context");
- }
- }
- pis.unread(headerBytes);
- } else if (n > 0) {
- byte[] bytesRead = new byte[n];
- System.arraycopy(headerBytes, 0, bytesRead, 0, n);
- pis.unread(bytesRead);
- }
- return pis;
+ public OMElement processDocument(String content,
+ String contentType,
+ MessageContext msgContext) throws AxisFault {
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMElement wrapper =
factory.createOMElement(getWrapperQName(msgContext), null);
+ factory.createOMText(wrapper, content);
+ wrapper.addAttribute("originalContentType", contentType, ns);
+ return wrapper;
+ }
+
+ public OMElement processDocument(DataSource dataSource,
+ String contentType,
+ MessageContext msgContext) throws AxisFault {
+
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ Charset cs =
Charset.forName(BuilderUtil.getCharSetEncoding(contentType));
+ QName wrapperQName = getWrapperQName(msgContext);
+ OMElement ret = new OMSourcedElementImpl(wrapperQName, factory,
+ new WrappedTextNodeOMDataSourceFromDataSource(wrapperQName,
dataSource, cs));
+ ret.addAttribute("originalContentType", contentType, ns);
+ return ret;
}
}
\ No newline at end of file
Copied:
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/raw/RawTextMessageFormatter.java
(from r835735,
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/hessian/HessianMessageFormatter.java)
URL:
http://svn.apache.org/viewvc/synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/raw/RawTextMessageFormatter.java?p2=synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/raw/RawTextMessageFormatter.java&p1=synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/hessian/HessianMessageFormatter.java&r1=835735&r2=835783&rev=835783&view=diff
==============================================================================
---
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/hessian/HessianMessageFormatter.java
(original)
+++
synapse/branches/1.3/modules/extensions/src/main/java/org/apache/synapse/format/raw/RawTextMessageFormatter.java
Fri Nov 13 09:09:08 2009
@@ -17,281 +17,98 @@
* under the License.
*/
-package org.apache.synapse.format.hessian;
+package org.apache.synapse.format.raw;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.soap.SOAPFault;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.format.MessageFormatterEx;
+import org.apache.axis2.format.TextFromElementDataSource;
+import org.apache.axis2.transport.base.BaseConstants;
+import org.apache.axis2.transport.base.BaseUtils;
import org.apache.axis2.transport.http.util.URLTemplatingUtil;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.util.SynapseBinaryDataSource;
-
-import javax.activation.DataHandler;
-
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.util.Iterator;
-
-/**
- * Enables a message encoded using the Hessian binary protocol to be written
to transport by
- * axis2/synapse and this formats the HessianDataSource to a Hessian message.
- *
- * @see org.apache.axis2.transport.MessageFormatter
- * @see org.apache.synapse.util.SynapseBinaryDataSource
- */
-public class HessianMessageFormatter implements MessageFormatter {
- private static final Log log =
LogFactory.getLog(HessianMessageFormatter.class);
-
- /**
- * Formats the content type to be written in to the transport
- *
- * @param msgCtxt message of which the content type has to be formatted
- * @param format fomat of the expected formatted message
- * @param soapActionString soap action of the message
- *
- * @return contentType formatted content type as a String
- */
- public String getContentType(MessageContext msgCtxt, OMOutputFormat format,
- String soapActionString) {
-
- String contentType = (String)
msgCtxt.getProperty(Constants.Configuration.CONTENT_TYPE);
- if (contentType == null) {
- contentType = HessianConstants.HESSIAN_CONTENT_TYPE;
- }
+import javax.activation.DataSource;
+import javax.xml.namespace.QName;
+import java.io.*;
+import java.net.URL;
- String encoding = format.getCharSetEncoding();
- if (encoding != null) {
- contentType += "; charset=" + encoding;
- }
+public class RawTextMessageFormatter implements MessageFormatterEx {
- return contentType;
+ public byte[] getBytes(MessageContext messageContext, OMOutputFormat
format) throws AxisFault {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ writeTo(messageContext, format, baos, true);
+ return baos.toByteArray();
}
- /**
- * Extract Hessian bytes from the received SOAP message and write it onto
the wire
- *
- * @param msgCtx message from which the Hessian message has to be extracted
- * @param format message format to be written
- * @param out stream to which the message is written
- * @param preserve whether to preserve the indentations
- *
- * @throws AxisFault in case of a failure in writing the message to the
provided stream
- */
- public void writeTo(MessageContext msgCtx, OMOutputFormat format,
OutputStream out,
- boolean preserve) throws AxisFault {
-
- if (log.isDebugEnabled()) {
- log.debug("Start writing the Hessian message to OutputStream");
- }
-
- // Check whether the message to be written is a fault message
- if (msgCtx.getFLOW() == MessageContext.OUT_FAULT_FLOW ||
msgCtx.getEnvelope().hasFault()) {
-
- SOAPFault soapFault = msgCtx.getEnvelope().getBody().getFault();
- convertAndWriteHessianFault(soapFault, out);
- } else {
-
- // no differentiation between normal reply and fault (pass the
original message through)
- writeHessianMessage(msgCtx, out);
- }
-
- if (log.isDebugEnabled()) {
- log.debug("Writing message as a Hessian message is successful");
+ public void writeTo(MessageContext messageContext, OMOutputFormat format,
OutputStream outputStream, boolean preserve) throws AxisFault {
+ OMElement textElt =
messageContext.getEnvelope().getBody().getFirstElement();
+ if (BaseConstants.DEFAULT_TEXT_WRAPPER.equals(textElt.getQName())) {
+ try {
+ Writer out = new OutputStreamWriter(outputStream,
format.getCharSetEncoding());
+ out.write(textElt.getText());
+ out.flush();
+ } catch (IOException e) {
+ throw new AxisFault("Error writing text message to stream", e);
+ }
}
}
- /**
- * This method is not supported because of large file handling limitations
- *
- * @param msgCtxt message which contains the Hessian message inside the
HessianDataSource
- * @param format message format to be written
- *
- * @return Hessian binary bytes of the message
- *
- * @throws AxisFault for any invocation
- */
- public byte[] getBytes(MessageContext msgCtxt, OMOutputFormat format)
throws AxisFault {
- throw new AxisFault("Method not supported. Use the "
- + "HessianMessageFormatter#writeTo method instead");
- }
-
- /**
- * {...@inheritdoc}
- *
- * Simply returns the soapAction unchanged.
- */
- public String formatSOAPAction(MessageContext messageContext,
OMOutputFormat format,
- String soapAction) {
-
- return soapAction;
- }
-
- /**
- * {...@inheritdoc}
- *
- * @return A templated URL based on the given target URL.
- */
- public URL getTargetAddress(MessageContext messageContext, OMOutputFormat
format, URL targetURL)
- throws AxisFault {
+ public String getContentType(MessageContext messageContext, OMOutputFormat
format, String soapAction) {
- return URLTemplatingUtil.getTemplatedURL(targetURL, messageContext,
false);
- }
+ OMElement textElt =
messageContext.getEnvelope().getBody().getFirstElement();
+ if (getWrapperQName(messageContext).equals(textElt.getQName())) {
+ return textElt.getAttributeValue(new
QName(BaseConstants.AXIOMPAYLOADNS, "originalContentType"));
- /**
- * Writes the Hessian message contained in the message context to the
provided output stream.
- *
- * @param msgCtxt the message context containing the Hessian message
- * @param out the provided output stream to which the message shall be
written
- *
- * @throws AxisFault if an error occurs writing to the output stream
- */
- private void writeHessianMessage(MessageContext msgCtxt, OutputStream out)
throws AxisFault {
-
- OMElement omElement =
msgCtxt.getEnvelope().getBody().getFirstElement();
- SynapseBinaryDataSource synapseBinaryDataSource =
extractSynapseBinaryDataSource(omElement);
+ } else {
+ String encoding = format.getCharSetEncoding();
+ String contentType = "text/plain";
- if (synapseBinaryDataSource != null) {
+ if (encoding != null) {
+ contentType += "; charset=" + encoding;
+ }
- InputStream inputStream = null;
- try {
- inputStream = synapseBinaryDataSource.getInputStream();
- IOUtils.copy(inputStream, out);
- } catch (IOException e) {
- handleException("Couldn't get the bytes from the
HessianDataSource", e);
- } finally {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (IOException ignore) {
- log.warn("Error closing input stream.", ignore);
- }
- }
- if (out != null) {
- try {
- out.close();
- } catch (IOException ignore) {
- log.warn("Error closing output stream.", ignore);
- }
- }
+ // if soap action is there (can be there is soap response MEP is
used) add it.
+ if ((soapAction != null)
+ && !"".equals(soapAction.trim())
+ && !"\"\"".equals(soapAction.trim())) {
+ contentType = contentType + ";action=\"" + soapAction + "\";";
}
- } else {
- handleException("Unable to find the Hessian content in the
payload");
+ return contentType;
}
}
- /**
- * Tries to extract the binary data source containing the Hessian message.
- *
- * @param omElement
- *
- * @return the binary data source containing the Hessian message or null,
if the OMElement
- * does not contain a binary datasource.
- */
- private SynapseBinaryDataSource extractSynapseBinaryDataSource(OMElement
omElement) {
-
- SynapseBinaryDataSource synapseBinaryDataSource = null;
- Iterator it = omElement.getChildren();
-
- while (it.hasNext() && synapseBinaryDataSource == null) {
-
- OMNode hessianElement = (OMNode) it.next();
- if (hessianElement instanceof OMText) {
-
- OMText tempNode = (OMText) hessianElement;
- if (tempNode.getDataHandler() != null
- && ((DataHandler)
tempNode.getDataHandler()).getDataSource() instanceof SynapseBinaryDataSource) {
-
- synapseBinaryDataSource = (SynapseBinaryDataSource)
((DataHandler) tempNode
- .getDataHandler()).getDataSource();
- }
- }
- }
+ public URL getTargetAddress(MessageContext msgCtxt, OMOutputFormat format,
URL targetURL) throws AxisFault {
+ // Check whether there is a template in the URL, if so we have to
replace then with data
+ // values and create a new target URL.
+ targetURL = URLTemplatingUtil.getTemplatedURL(targetURL, msgCtxt,
false);
+ return targetURL;
+ }
- return synapseBinaryDataSource;
+ public String formatSOAPAction(MessageContext messageContext,
OMOutputFormat format, String soapAction) {
+ return null;
}
- /**
- * Reads details from the SOAPFault and creates a new Hessian fault using
those details and
- * writes it to the output stream.
- *
- * @param soapFault the SOAP fault to convert and write as a Hessian fault
- * @param out the output stream to write the Hessian fault to
- *
- * @throws AxisFault if an error occurs writing the message to the output
stream
- */
- private void convertAndWriteHessianFault(SOAPFault soapFault, OutputStream
out) throws AxisFault {
-
- BufferedOutputStream faultOutStream = new BufferedOutputStream(out);
-
- try {
- String hessianFaultCode = "500";
- String hessianFaultMessage = "";
- String hessianFaultDetail = "";
-
- if (soapFault.getCode() != null) {
- hessianFaultCode = soapFault.getCode().getText();
- }
-
- if (soapFault.getReason() != null) {
- hessianFaultMessage = soapFault.getReason().getText();
- }
+ public DataSource getDataSource(MessageContext messageContext,
+ OMOutputFormat format, String soapAction) throws AxisFault {
+ return new TextFromElementDataSource(
+ messageContext.getEnvelope().getBody().getFirstElement(),
+ format.getCharSetEncoding(),
+ getContentType(messageContext, format, soapAction));
+ }
- if (soapFault.getDetail() != null) {
- hessianFaultDetail = soapFault.getDetail().getText();
- }
-
- HessianUtils.writeFault(hessianFaultCode, hessianFaultMessage,
hessianFaultDetail,
- faultOutStream);
- faultOutStream.flush();
-
- } catch (IOException e) {
- handleException("Unalbe to write the fault as a Hessian message",
e);
- } finally {
- try {
- if (faultOutStream != null) {
- faultOutStream.close();
- }
- } catch (IOException ignore) {
- log.warn("Error closing output stream.", ignore);
+ private static QName getWrapperQName(MessageContext msgContext) {
+ QName wrapperQName = BaseConstants.DEFAULT_TEXT_WRAPPER;
+ if (msgContext.getAxisService() != null) {
+ Parameter wrapperParam
+ =
msgContext.getAxisService().getParameter(BaseConstants.WRAPPER_PARAM);
+ if (wrapperParam != null) {
+ wrapperQName =
BaseUtils.getQNameFromString(wrapperParam.getValue());
}
}
+ return wrapperQName;
}
-
- /**
- * Logs the original exception, wrappes it in an AxisFault and rethrows it.
- *
- * @param msg the error message
- * @param e the original exception
- *
- * @throws AxisFault
- */
- private void handleException(String msg, Exception e) throws AxisFault {
- log.error(msg, e);
- throw new AxisFault(msg, e);
- }
-
- /**
- * Logs an error message and throws a newly created AxisFault.
- *
- * @param msg the error message
- *
- * @throws AxisFault
- */
- private void handleException(String msg) throws AxisFault {
- log.error(msg);
- throw new AxisFault(msg);
- }
-}
+}
\ No newline at end of file