Methods Summary |
---|
protected void | configureFromContext(org.apache.axis.MessageContext msgContext)configure our elements from the context. Call this in the invoke()
implementation to set up the base class
this.development = ((Boolean) msgContext.getProperty
(HTTPConstants.PLUGIN_IS_DEVELOPMENT)).booleanValue();
this.exceptionLog = (Log) msgContext.getProperty
(HTTPConstants.PLUGIN_EXCEPTION_LOG);
this.log = (Log) msgContext.getProperty(HTTPConstants.PLUGIN_LOG);
|
protected void | configureResponseFromAxisFault(javax.servlet.http.HttpServletResponse response, org.apache.axis.AxisFault fault)Configure the servlet response status code and maybe other headers
from the fault info.
// then get the status code
// It's been suggested that a lack of SOAPAction
// should produce some other error code (in the 400s)...
int status = getHttpServletResponseStatus (fault);
if (status == HttpServletResponse.SC_UNAUTHORIZED) {
// unauth access results in authentication request
// TODO: less generic realm choice?
response.setHeader ("WWW-Authenticate", "Basic realm=\"AXIS\"");
}
response.setStatus (status);
|
protected org.apache.axis.Message | convertExceptionToAxisFault(java.lang.Exception exception, org.apache.axis.Message responseMsg)turn any Exception into an AxisFault, log it, set the response
status code according to what the specifications say and
return a response message for posting. This will be the response
message passed in if non-null; one generated from the fault otherwise.
logException (exception);
if (responseMsg == null) {
AxisFault fault = AxisFault.makeFault (exception);
processAxisFault (fault);
responseMsg = new Message (fault);
}
return responseMsg;
|
private int | getHttpServletResponseStatus(org.apache.axis.AxisFault af)Extract information from AxisFault and map it to a HTTP Status code.
// TODO: Should really be doing this with explicit AxisFault
// subclasses... --Glen
return af.getFaultCode().getLocalPart().startsWith ("Server.Unauth")
? HttpServletResponse.SC_UNAUTHORIZED
: HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
// This will raise a 401 for both
// "Unauthenticated" & "Unauthorized"...
|
protected boolean | isDevelopment()probe for the system being 'production'
return this.development;
|
private void | logException(java.lang.Exception e)log any exception to our output log, at our chosen level
exceptionLog.info (Messages.getMessage ("exception00"), e);
|
protected void | processAxisFault(org.apache.axis.AxisFault fault)routine called whenever an axis fault is caught; where they
are logged and any other business. The method may modify the fault
in the process
//log the fault
Element runtimeException = fault.lookupFaultDetail
(Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION);
if (runtimeException != null) {
exceptionLog.info (Messages.getMessage ("axisFault00"), fault);
//strip runtime details
fault.removeFaultDetail
(Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION);
}
else if (exceptionLog.isDebugEnabled()) {
exceptionLog.debug (Messages.getMessage ("axisFault00"), fault);
}
//dev systems only give fault dumps
if (!isDevelopment()) {
//strip out the stack trace
fault.removeFaultDetail (Constants.QNAME_FAULTDETAIL_STACKTRACE);
}
|
protected void | writeFault(java.io.PrintWriter writer, org.apache.axis.AxisFault axisFault)this method writes a fault out to an HTML stream. This includes
escaping the strings to defend against cross-site scripting attacks
String localizedMessage = XMLUtils.xmlEncodeString
(axisFault.getLocalizedMessage());
writer.println ("<pre>Fault - " + localizedMessage + "<br>");
writer.println (axisFault.dumpToString());
writer.println ("</pre>");
|