use of org.apache.axis2.description.AxisBindingMessage in project pentaho-platform by pentaho.
the class AbstractAxisServiceContentGenerator method processAxisFault.
/**
* Handles processing of Axis exceptions.
*
* @param msgContext
* The message context that experienced an error
* @param out
* The output stream to write to
* @param e
* The error that occurred
*/
protected void processAxisFault(MessageContext msgContext, OutputStream out, Throwable e) {
// $NON-NLS-1$
IParameterProvider pathParams = parameterProviders.get("path");
// is this HTTP?
boolean http = msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE) != null;
if (http) {
// $NON-NLS-1$
HttpServletResponse res = (HttpServletResponse) pathParams.getParameter("httpresponse");
// If the fault is not going along the back channel we should be 202ing
if (AddressingHelper.isFaultRedirected(msgContext)) {
res.setStatus(HttpServletResponse.SC_ACCEPTED);
} else {
// set the status of the HTTP response
String status = (String) msgContext.getProperty(Constants.HTTP_RESPONSE_STATE);
try {
if (status == null) {
res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} else {
int sc = Integer.parseInt(status);
if (sc >= 400) {
res.sendError(sc);
} else {
res.setStatus(sc);
}
}
} catch (IOException e1) {
if (status == null) {
res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} else {
int sc = Integer.parseInt(status);
res.setStatus(sc);
}
}
AxisBindingOperation axisBindingOperation = (AxisBindingOperation) msgContext.getProperty(Constants.AXIS_BINDING_OPERATION);
if (axisBindingOperation != null) {
AxisBindingMessage fault = axisBindingOperation.getFault((String) msgContext.getProperty(Constants.FAULT_NAME));
if (fault != null) {
Integer code = (Integer) fault.getProperty(WSDL2Constants.ATTR_WHTTP_CODE);
if (code != null) {
res.setStatus(code.intValue());
}
}
}
}
}
try {
// now process the fault
handleFault(msgContext, out, http, e);
} catch (IOException axisFault) {
// $NON-NLS-1$
String message = Messages.getInstance().getErrorString("WebServiceContentGenerator.ERROR_0003_PROCESSING_FAULT");
getLogger().error(message, axisFault);
}
}
Aggregations