Package javax.xml.ws.handler

Examples of javax.xml.ws.handler.Handler


                Class<? extends Handler> handlerClass = Class.forName(h.getHandlerClass(), true,
                                                                      getHandlerClassLoader())
                    .asSubclass(Handler.class);

                Handler handler = handlerClass.newInstance();
                LOG.fine("adding handler to chain: " + handler);
                configureHandler(handler, h);
                handlerChain.add(handler);
            } catch (ClassNotFoundException e) {
                throw new WebServiceException(new Message("HANDLER_INSTANTIATION_EXC", LOG).toString(), e);
View Full Code Here


        if (null == userHandlers) {
            userHandlers = new ArrayList<Handler>();
        }
        Iterator<Handler> it = userHandlers.iterator();
        while (it.hasNext()) {
            Handler h = it.next();
            if (h instanceof LogicalHandler) {
                allHandlers.add(h);
            }
        }
        if (null != postLogicalSystemHandlers) {
            allHandlers.addAll(postLogicalSystemHandlers);
        }
        if (null != preProtocolSystemHandlers) {
            allHandlers.addAll(preProtocolSystemHandlers);
        }
        it = userHandlers.iterator();
        while (it.hasNext()) {
            Handler h = it.next();
            if (!(h instanceof StreamHandler || h instanceof LogicalHandler)) {
                allHandlers.add(h);
            }
        }
        if (null != postProtocolSystemHandlers) {
            allHandlers.addAll(postProtocolSystemHandlers);
        }
        it = userHandlers.iterator();
        while (it.hasNext()) {
            Handler h = it.next();
            if (h instanceof StreamHandler) {
                allHandlers.add(h);
            }
        }
        return allHandlers;
View Full Code Here

    public void testGetHandlerChain() {
        List<Handler> handlerChain = resolver.getHandlerChain(portInfo);
        assertNotNull(handlerChain);
        assertEquals(0, handlerChain.size());

        Handler handler = createMock(Handler.class);
        handlerChain.add(handler);

        handlerChain = resolver.getHandlerChain(portInfo);
        assertEquals(1, handlerChain.size());
        assertSame(handler, handlerChain.get(0));
View Full Code Here

    //
    // XXX do this by bubbling up instead of creating a new list
    List list = new ArrayList<Handler>();

    for (int i = 0; i < handlerChain.size(); i++) {
      Handler handler = handlerChain.get(i);

      if (handler instanceof LogicalHandler)
        list.add(handler);
    }

    for (int i = 0; i < handlerChain.size(); i++) {
      Handler handler = handlerChain.get(i);

      if (! (handler instanceof LogicalHandler))
        list.add(handler);
    }
View Full Code Here

                Class<? extends Handler> handlerClass = Class.forName(
                        trimString(ht.getHandlerClass()
                                .getStringValue()), true, classLoader)
                        .asSubclass(Handler.class);

                Handler handler = handlerClass.newInstance();
                log.debug("adding handler to chain: " + handler);
                handlerChain.add(handler);
            } catch (Exception e) {
                throw new WebServiceException("Failed to instantiate handler", e);
            }
View Full Code Here

        HandlerLifecycleManager hlm = createHandlerlifecycleManager();
        List<Handler> list = eic.getHandlers();
        if(list != null) {
            for (Iterator it = list.iterator(); it.hasNext();) {
                try {
                    Handler handler = (Handler) it.next();
                    hlm.destroyHandlerInstance(request, handler);
                } catch (Exception e) {
                    // TODO: can we ignore this?
                    throw ExceptionFactory.makeWebServiceException(e);
                }
View Full Code Here

                // to see if the current iterator handler is intended for this service.

                // TODO review: need to check for null getHandlerClass() return?
                // or will schema not allow it?
                String portHandler = handlerType.getHandlerClass().getValue();
                Handler handler = null;
                   
                //  instantiate portHandler class
                try {
                    handler = createHandlerInstance(loadClass(portHandler));
                } catch (Exception e) {
                    // TODO: should we just ignore this problem?
                    throw ExceptionFactory.makeWebServiceException(e);
                }
               
                if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
                    log.debug("Successfully instantiated the class: " + handler.getClass());
                }
               
                // 9.2.1.2 sort them by Logical, then SOAP
                if (LogicalHandler.class.isAssignableFrom(handler.getClass()))
                    handlers.add((LogicalHandler) handler);
                else if (SOAPHandler.class.isAssignableFrom(handler.getClass()))
                    // instanceof ProtocolHandler
                    handlers.add((SOAPHandler) handler);
                else if (Handler.class.isAssignableFrom(handler.getClass())) {
                    throw ExceptionFactory.makeWebServiceException(Messages
                            .getMessage("handlerChainErr1", handler
                                    .getClass().getName()));
                } else {
                    throw ExceptionFactory.makeWebServiceException(Messages
                            .getMessage("handlerChainErr2", handler
                                    .getClass().getName()));
                }
            }
        }
View Full Code Here

        Iterator handlerIterator = handlers.iterator();
       
        while (handlerIterator.hasNext()) {
            // this is a safe cast since the handlerResolver and binding.setHandlerChain
            // and InvocationContext.setHandlerChain verifies it before we get here
            Handler handler = (Handler)handlerIterator.next();
            // JAXWS 9.2.1.2 sort them by Logical, then SOAP
            if (LogicalHandler.class.isAssignableFrom(handler.getClass()))
                logicalHandlers.add((LogicalHandler) handler);
            else if (SOAPHandler.class.isAssignableFrom(handler.getClass()))
                // instanceof ProtocolHandler
                protocolHandlers.add((SOAPHandler) handler);
            else if (Handler.class.isAssignableFrom(handler.getClass())) {
                throw ExceptionFactory.makeWebServiceException(Messages
                    .getMessage("handlerChainErr1", handler.getClass().getName()));
            } else {
                throw ExceptionFactory.makeWebServiceException(Messages
                    .getMessage("handlerChainErr2", handler.getClass().getName()));
            }
        }
       
        logicalLength = logicalHandlers.size();
       
View Full Code Here

        int i = start;

        if (direction == Direction.OUT) {
            for (; i <= end; i++) {
                switchContext(direction, i);
                Handler handler = (Handler) handlers.get(i);
               
                if (log.isDebugEnabled()) {
                    log.debug("Invoking handleMessage on: " + handler.getClass().getName());
                }
                callHandleMessageWithTracker(handler);
            }
        } else { // IN case
            for (; i >= end; i--) {
                switchContext(direction, i);
                Handler handler = (Handler) handlers.get(i);
              
                if (log.isDebugEnabled()) {
                    log.debug("Invoking handleMessage on: " + handler.getClass().getName());
                }
                callHandleMessageWithTracker(handler);
            }
        }
    }
View Full Code Here

        if (direction == Direction.OUT) {
            for (; i <= end; i++) {
                try {
                    switchContext(direction, i);
                    Handler handler = (Handler) handlers.get(i);
                    if (log.isDebugEnabled()) {
                        log.debug("Invoking close on: " + handler.getClass().getName());
                    }
                    callCloseWithTracker(handler);
                   
                    // TODO when we close, are we done with the handler instance, and thus
                    // may call the PreDestroy annotated method?  I don't think so, especially
                    // if we've cached the handler list somewhere.
                } catch (Exception e) {
                    if (log.isDebugEnabled()) {
                        log.debug("An Exception occurred while calling handler.close()");
                        log.debug("Exception: " + e.getClass().getName() + ":" + e.getMessage());
                    }
                }
            }
        } else { // IN case
            for (; i >= end; i--) {
                try {
                    switchContext(direction, i);
                    Handler handler = (Handler) handlers.get(i);
                    if (log.isDebugEnabled()) {
                        log.debug("Invoking close on: " + handler.getClass().getName());
                    }
                    callCloseWithTracker(handler);
                   
                    // TODO when we close, are we done with the handler instance, and thus
                    // may call the PreDestroy annotated method?  I don't think so, especially
View Full Code Here

TOP

Related Classes of javax.xml.ws.handler.Handler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.