1 23 24 27 28 package com.sun.enterprise.webservice.monitoring; 29 30 import com.sun.xml.rpc.spi.runtime.SOAPMessageContext; 31 import com.sun.xml.rpc.spi.runtime.SystemHandlerDelegate; 32 33 38 public class JAXRPCEndpointImpl extends EndpointImpl implements SystemHandlerDelegate { 39 40 SystemHandlerDelegate parent = null; 41 42 43 JAXRPCEndpointImpl(String endpointSelector, EndpointType type) { 44 super(endpointSelector, type); 45 } 46 47 public boolean processRequest(SOAPMessageContext messageContext) { 48 49 boolean status = true; 50 51 if (parent!=null) { 52 status = parent.processRequest(messageContext); 53 } 54 55 WebServiceEngineImpl wsEngine = WebServiceEngineImpl.getInstance(); 57 try { 58 if (!listeners.isEmpty() || wsEngine.hasGlobalMessageListener()) { 59 60 ThreadLocalInfo config = 62 (ThreadLocalInfo) wsEngine.getThreadLocal().get(); 63 64 if (config!=null && config.getMessageId()!=null) { 66 HttpRequestInfoImpl info = new HttpRequestInfoImpl(config.getRequest()); 67 wsEngine.processRequest(config.getMessageId(), messageContext, info); 68 } 69 70 if (!listeners.isEmpty()) { 72 if (config==null) { 73 config = new ThreadLocalInfo(null, null); 74 } 75 MessageTraceImpl request = new MessageTraceImpl(); 77 request.setEndpoint(this); 78 request.setMessageContext(messageContext); 79 if (config.getRequest()!=null) { 80 request.setTransportInfo(new HttpRequestInfoImpl(config.getRequest())); 81 } 82 83 config.setRequestMessageTrace(request); 84 } 85 86 } 87 } catch(Throwable t) { 88 wsEngine.sLogger.warning("Exception while tracing request : " + t.getMessage()); 89 RuntimeException re; 90 if (t instanceof RuntimeException ) { 91 re = (RuntimeException ) t; 92 } else { 93 re = new RuntimeException (t); 94 } 95 throw re; 96 } 97 98 return status; 99 } 100 101 public void processResponse(SOAPMessageContext messageContext) { 102 103 WebServiceEngineImpl wsEngine = WebServiceEngineImpl.getInstance(); 105 try { 106 107 if (wsEngine.hasGlobalMessageListener() || !listeners.isEmpty()) { 108 109 ThreadLocalInfo config = 111 (ThreadLocalInfo) wsEngine.getThreadLocal().get(); 112 113 if (config!=null) { 114 if (config.getMessageId()!=null) { 116 wsEngine.processResponse(config.getMessageId(), messageContext); 117 } 118 119 if (!listeners.isEmpty()) { 121 MessageTraceImpl response = new MessageTraceImpl(); 122 response.setEndpoint(this); 123 response.setMessageContext(messageContext); 124 for (MessageListener listener : listeners) { 125 listener.invocationProcessed(config.getRequestMessageTrace(), response); 126 } 127 } 128 } 129 } 130 wsEngine.getThreadLocal().remove(); 132 133 if (parent!=null) { 135 parent.processResponse(messageContext); 136 } 137 138 } catch(Throwable t) { 139 wsEngine.sLogger.warning("Exception while tracing response : " + t.getMessage()); 140 RuntimeException re; 141 if (t instanceof RuntimeException ) { 142 re = (RuntimeException ) t; 143 } else { 144 re = new RuntimeException (t); 145 } 146 throw re; 147 } 148 149 } 150 151 public void setParent(SystemHandlerDelegate parent) { 152 this.parent = parent; 153 } 154 } 155 | Popular Tags |