Methods Summary |
---|
static com.sun.enterprise.admin.wsmgmt.msg.MessageTraceFactory | getInstance()Returns the singleton instance.
return _instance;
|
private java.io.ByteArrayOutputStream | getMsgAsBytes(com.sun.enterprise.admin.wsmgmt.SOAPMessageContext smc)Returns the SOAP message as an output stream.
ByteArrayOutputStream baos = null;
if (smc!= null) {
baos = new ByteArrayOutputStream();
try {
smc.getMessage().writeTo(baos);
} catch (Exception e) {
String msg = "Error while retrieving SOAP message";
_logger.log(Level.FINE, msg, e);
}
}
return baos;
|
com.sun.appserv.management.ext.wsmgmt.MessageTrace | postProcessResponse(com.sun.enterprise.admin.wsmgmt.filter.spi.FilterContext ctx)Post Processing of the SOAP response.
String messageId = ctx.getMessageId();
com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl trace =
(com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl)
_messages.remove(messageId);
// sets response time
setResponseTime(trace, ctx.getExecutionTime());
return trace;
|
void | processRequest(com.sun.enterprise.admin.wsmgmt.filter.spi.FilterContext ctx, java.lang.String appId)Processes the SOAP request.
// message id
String messageId = ctx.getMessageId();
com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl trace = new
com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl(messageId,
MessageTrace.CLASS_NAME);
// sets the time stamp
trace.setTimeStamp( System.currentTimeMillis() );
// set application id, FQ endpoint name
trace.setEndpointName( ctx.getFullyQualifiedName() );
trace.setApplicationID(appId);
trace.setCallFlowEnabled(ctx.isCallFlowEnabled());
// set request content, size and http header
setRequestInfo(ctx.getMessageContext(), trace);
// set transport type
setTransportType(ctx, trace);
// sets client host
setClientHost(ctx.getMessageContext(), trace);
_messages.put(messageId, trace);
|
void | processResponse(com.sun.enterprise.admin.wsmgmt.filter.spi.FilterContext ctx)Processes the SOAP response.
String messageId = ctx.getMessageId();
com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl trace =
(com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl)
_messages.get(messageId);
SOAPMessageContext mctx = ctx.getMessageContext();
// sets response content, size and message header
setResponseInfo(mctx, trace);
// sets caller principal
setCallerPrincipal(trace);
// sets fault code, fault string and fault actor
setFaultInfo(mctx, trace);
|
private void | setCallerPrincipal(com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl trace)Sets caller principal information.
SecurityContext sc = SecurityContext.getCurrent();
if (sc != null) {
Principal p = sc.getCallerPrincipal();
if (p != null) {
trace.setPrincipalName( p.getName() );
_logger.fine("[MTF] Caller Principal: " + p.getName());
}
}
|
private void | setClientHost(com.sun.enterprise.admin.wsmgmt.SOAPMessageContext smc, com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl trace)Sets client host.
if (smc!= null) {
Iterator iter = smc.getPropertyNames();
if ( iter == null) {
return;
}
CoyoteRequestFacade httpReq =
(CoyoteRequestFacade) smc.getProperty(HTTP_REQUEST);
String clientHost = null;
if (httpReq != null) {
clientHost = httpReq.getRemoteAddr();
trace.setClientHost(clientHost);
}
}
|
private void | setFaultInfo(com.sun.enterprise.admin.wsmgmt.SOAPMessageContext smc, com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl trace)Sets faults information for a response.
if (smc != null) {
SOAPMessage sm = smc.getMessage();
try {
if (sm != null) {
SOAPBody sb = sm.getSOAPBody();
if (sb != null) {
SOAPFault fault = sb.getFault();
if ( fault != null) {
trace.setFaultCode( fault.getFaultCode() );
trace.setFaultString( fault.getFaultString() );
trace.setFaultActor( fault.getFaultString() );
}
}
}
} catch (SOAPException se) {
String msg = "Error while reading SOAP fault information";
_logger.log(Level.FINE, msg, se);
}
}
|
private void | setRequestInfo(com.sun.enterprise.admin.wsmgmt.SOAPMessageContext ctx, com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl trace)Sets SOAP message content, request size and HTTP headers.
ByteArrayOutputStream baos = null;
try {
// sets the SOAP message header
trace.setHTTPRequestHeaders(ctx.getHTTPRequestHeaders());
baos = getMsgAsBytes(ctx);
// sets the request size
trace.setRequestSize( baos.size() );
String soapMsg = baos.toString();
trace.setRequestContent(soapMsg);
} catch (Exception e) {
String msg =_stringMgr.getString(
"MessageTraceFactory_NoMessageTrace", e.getMessage());
_logger.log(Level.INFO, msg);
}finally {
try {
if (baos != null) {
baos.close();
}
} catch (Exception e) {
_logger.log(Level.FINE, "Web Service message stream could not be closed : " + e.getMessage());
}
}
|
private void | setResponseInfo(com.sun.enterprise.admin.wsmgmt.SOAPMessageContext ctx, com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl trace)Sets the response content, size and message header
ByteArrayOutputStream baos = null;
try {
baos = getMsgAsBytes(ctx);
if (baos == null) {
return;
}
// sets the request size
trace.setResponseSize( baos.size() );
String soapMsg = baos.toString();
trace.setResponseContent(soapMsg);
// sets the SOAP message header
trace.setHTTPResponseHeaders(ctx.getHTTPResponseHeaders());
} catch (Exception e) {
String msg =_stringMgr.getString(
"MessageTraceFactory_NoMessageTrace", e.getMessage());
_logger.log(Level.INFO, msg);
}finally {
try {
if (baos != null) {
baos.close();
}
} catch (Exception e) {
_logger.log(Level.FINE, "Web Service message stream could not be closed : " + e.getMessage());
}
}
|
private void | setResponseTime(com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl trace, long t)Sets response time for this request.
trace.setResponseTime(t);
|
private void | setTransportType(com.sun.enterprise.admin.wsmgmt.filter.spi.FilterContext ctx, com.sun.appserv.management.ext.wsmgmt.MessageTraceImpl trace)Sets the transport type.
TransportInfo ti = ctx.getTransportInfo();
if (ti != null) {
TransportType type = ti.getTransportType();
trace.setTransportType( type.name() );
}
|