FileDocCategorySizeDatePackage
JAXRPCServlet.javaAPI DocGlassfish v2 API6346Fri May 04 22:36:10 BST 2007com.sun.enterprise.webservice

JAXRPCServlet

public class JAXRPCServlet extends HttpServlet
The JAX-RPC dispatcher servlet.

Fields Summary
private com.sun.xml.rpc.spi.runtime.ServletDelegate
delegate_
private ServletWebServiceDelegate
myDelegate_
Constructors Summary
Methods Summary
public voiddestroy()

        if (delegate_ != null) {
            delegate_.destroy();
        }
        if (myDelegate_ != null) {
            myDelegate_.destroy();
        }
    
protected voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

        
        // test for tester servlet invocation.
        if ("Tester".equalsIgnoreCase(request.getQueryString())) {
            
            Endpoint endpt = WebServiceEngineImpl.getInstance().getEndpoint(request.getServletPath());
            if (endpt!=null && Boolean.parseBoolean(endpt.getDescriptor().getDebugging())) {
                Loader loader = (Loader) endpt.getDescriptor().getBundleDescriptor().getExtraAttribute("WEBLOADER");
                if (loader != null) {
                    endpt.getDescriptor().getBundleDescriptor().setClassLoader(loader.getClassLoader());
                    endpt.getDescriptor().getBundleDescriptor().removeExtraAttribute("WEBLOADER");
                }
                WebServiceTesterServlet.invoke(request, response,
                        endpt.getDescriptor());
                return;
            }
        }        
        if (delegate_ != null) {
            delegate_.doGet(request, response);
        }
    
protected voiddoPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

        
        WebServiceEngineImpl wsEngine_ = WebServiceEngineImpl.getInstance();
        
        if ("Tester".equalsIgnoreCase(request.getQueryString())) {            
            Endpoint endpt = wsEngine_.getEndpoint(request.getServletPath());
            if (endpt!=null && Boolean.parseBoolean(endpt.getDescriptor().getDebugging())) {
                WebServiceTesterServlet.invoke(request, response,
                        endpt.getDescriptor());
                return;
            }
        }        
                
        if (delegate_ != null) {
            // check if we need to trace this...        
            String messageId=null;
            if (wsEngine_.getGlobalMessageListener()!=null) {
                Endpoint endpt = wsEngine_.getEndpoint(request.getServletPath());                
                messageId = wsEngine_.preProcessRequest(endpt);  
                if (messageId!=null) {
                    ThreadLocalInfo config = new ThreadLocalInfo(messageId, request);
                    wsEngine_.getThreadLocal().set(config);
                }
            }
            
            delegate_.doPost(request, response);
            
            if (messageId!=null) {
                HttpResponseInfoImpl info = new HttpResponseInfoImpl(response);
                wsEngine_.postProcessResponse(messageId, info);
            }
        }
    
public voidinit(javax.servlet.ServletConfig servletConfig)


          
        try {
            super.init(servletConfig);
            JaxRpcObjectFactory rpcFactory = JaxRpcObjectFactory.newInstance();
            delegate_ = 
		(ServletDelegate) rpcFactory.createServletDelegate();
            myDelegate_ = new ServletWebServiceDelegate(delegate_);
            delegate_.setSecondDelegate(myDelegate_);
            delegate_.init(servletConfig);

        } catch (ServletException e) {
            throw e;
        } catch (Throwable e) {
            throw new ServletException(e);
        }