Package javax.xml.ws.handler

Examples of javax.xml.ws.handler.Handler


    // handleFault() return true\false, throw Exception.
    @SuppressWarnings("unchecked")
    private boolean callReversedHandlesFault() {
        int index = invokedHandlers.size() - 2;
        while (index >= 0) {
            Handler handler = invokedHandlers.get(index);
            if (handler instanceof LogicalHandler) {
                if (Boolean.FALSE.equals(handler.
                                         handleFault(logicalMessageContext))) {
                    return false;
                }
            } else {
                if (Boolean.FALSE.equals(handler.
                                         handleFault(protocolMessageContext))) {
                    return false;
                }
            }
            index--;
View Full Code Here


    @SuppressWarnings("unchecked")
    private boolean callReversedHandlers(MessageContext ctx) {
        int index = invokedHandlers.size() - 2;
        if (responseExpected) {
            while (index >= 0) {
                Handler handler = invokedHandlers.get(index);
                if (handler instanceof LogicalHandler) {
                    if (Boolean.FALSE.equals(handler.
                                             handleMessage(logicalMessageContext))) {
                        return false;
                    }
                } else {
                    if (Boolean.FALSE.equals(handler.
                                             handleMessage(protocolMessageContext))) {
                        return false;
                    }
                }
                index--;
View Full Code Here

    }

    private void closeHandlers() {
        int index = invokedHandlers.size() - 1;
        while (index >= 0) {
            Handler handler = invokedHandlers.get(index);
            if (handler instanceof LogicalHandler) {
                handler.close(logicalMessageContext);
            } else {
                handler.close(protocolMessageContext);
            }
            invokedHandlers.remove(index);
            index--;
        }
        closed = true;
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

        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());
                }
                handler.handleMessage(currentMC);
            }
        } 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());
                }
                handler.handleMessage(currentMC);
            }
        }
    }
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());
                    }
                    handler.close(currentMC);
                   
                    // 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());
                    }
                    handler.close(currentMC);
                   
                    // 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) {
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

                        final Set<Bean<?>> beans = bm.getBeans(handler.getHandlerClass());
                        final Bean<?> bean = bm.resolve(beans);
                        if (bean != null) { // proxy so faster to do it
                            final boolean normalScoped = bm.isNormalScope(bean.getScope());
                            final CreationalContextImpl<?> creationalContext = bm.createCreationalContext(bean);
                            final Handler instance = Handler.class.cast(bm.getReference(bean, bean.getBeanClass(), creationalContext));

                            // hack for destroyHandlers()
                            handlers.add(instance);
                            handlerInstances.add(new InjectionProcessor<Handler>(instance, Collections.<Injection>emptySet(), null) {
                                @Override
                                public void preDestroy() {
                                    if (!normalScoped) {
                                        creationalContext.release();
                                    }
                                }
                            });
                            continue;
                        }
                    } catch (final InjectionException ie) {
                        LOGGER.info(ie.getMessage(), ie);
                    }
                }
            }

            try { // old way
                final Class<? extends Handler> handlerClass = handler.getHandlerClass().asSubclass(Handler.class);
                final InjectionProcessor<Handler> processor = new InjectionProcessor<Handler>(handlerClass,
                    injections,
                    handler.getPostConstruct(),
                    handler.getPreDestroy(),
                    unwrap(context));
                processor.createInstance();
                processor.postConstruct();
                final Handler handlerInstance = processor.getInstance();

                handlers.add(handlerInstance);
                handlerInstances.add(processor);
            } catch (final 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

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.