javax.xml.ws.handler.LogicalHandler Java Examples

The following examples show how to use javax.xml.ws.handler.LogicalHandler. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClientLogicalHandlerTube.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void setUpProcessor() {
    if (handlers == null) {
            // Take a snapshot, User may change chain after invocation, Same chain
            // should be used for the entire MEP
            handlers = new ArrayList<Handler>();
            WSBinding binding = getBinding();
            List<LogicalHandler> logicalSnapShot= ((BindingImpl) binding).getHandlerConfig().getLogicalHandlers();
            if (!logicalSnapShot.isEmpty()) {
                handlers.addAll(logicalSnapShot);
                if (binding.getSOAPVersion() == null) {
                    processor = new XMLHandlerProcessor(this, binding,
                            handlers);
                } else {
                    processor = new SOAPHandlerProcessor(true, this, binding,
                            handlers);
                }
            }
    }
}
 
Example #2
Source File: HandlerResolverImpl.java    From tomee with Apache License 2.0 6 votes vote down vote up
/**
 * sorts the handlers into correct order. All of the logical handlers first
 * followed by the protocol handlers
 *
 * @param handlers
 * @return sorted list of handlers
 */
private List<Handler> sortHandlers(final List<Handler> handlers) {
    final List<LogicalHandler> logicalHandlers = new ArrayList<>();
    final List<Handler> protocolHandlers = new ArrayList<>();

    for (final Handler handler : handlers) {
        if (handler instanceof LogicalHandler) {
            logicalHandlers.add((LogicalHandler) handler);
        } else {
            protocolHandlers.add(handler);
        }
    }

    final List<Handler> sortedHandlers = new ArrayList<>();
    sortedHandlers.addAll(logicalHandlers);
    sortedHandlers.addAll(protocolHandlers);
    return sortedHandlers;
}
 
Example #3
Source File: ClientHandlerResolverImpl.java    From tomee with Apache License 2.0 6 votes vote down vote up
/**
 * sorts the handlers into correct order. All of the logical handlers first
 * followed by the protocol handlers
 *
 * @param handlers List
 * @return sorted list of handlers
 */
private List<Handler> sortHandlers(final List<Handler> handlers) {
    final List<LogicalHandler> logicalHandlers = new ArrayList<LogicalHandler>();
    final List<Handler> protocolHandlers = new ArrayList<Handler>();

    for (final Handler handler : handlers) {
        if (handler instanceof LogicalHandler) {
            logicalHandlers.add((LogicalHandler) handler);
        } else {
            protocolHandlers.add(handler);
        }
    }

    final List<Handler> sortedHandlers = new ArrayList<Handler>();
    sortedHandlers.addAll(logicalHandlers);
    sortedHandlers.addAll(protocolHandlers);
    return sortedHandlers;
}
 
Example #4
Source File: HandlerChainBuilder.java    From cxf with Apache License 2.0 6 votes vote down vote up
/**
 * sorts the handlers into correct order. All of the logical handlers first
 * followed by the protocol handlers
 *
 * @param handlers
 * @return sorted list of handlers
 */
public List<Handler> sortHandlers(List<Handler> handlers) {

    final int size = handlers.size();
    List<Handler> logicalHandlers = new ArrayList<>(size);
    List<Handler> protocolHandlers = new ArrayList<>(Math.min(10, size));

    for (Handler<?> handler : handlers) {
        if (handler instanceof LogicalHandler) {
            logicalHandlers.add(handler);
        } else {
            protocolHandlers.add(handler);
        }
    }

    if (!protocolHandlers.isEmpty()) {
        logicalHandlers.addAll(protocolHandlers);
    }
    return logicalHandlers;
}
 
Example #5
Source File: HandlerChainInvoker.java    From cxf with Apache License 2.0 6 votes vote down vote up
public HandlerChainInvoker(@SuppressWarnings("rawtypes") List<Handler> hc, boolean isOutbound) {
    if (LOG.isLoggable(Level.FINE)) {
        LOG.log(Level.FINE, "invoker for chain size: " + (hc != null ? hc.size() : 0));
    }

    if (hc != null) {
        for (Handler<?> h : hc) {
            if (h instanceof LogicalHandler) {
                logicalHandlers.add((LogicalHandler<?>)h);
            } else {
                protocolHandlers.add(h);
            }
        }
    }
    outbound = isOutbound;
}
 
Example #6
Source File: ClientLogicalHandlerTube.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
void setUpProcessor() {
    if (handlers == null) {
            // Take a snapshot, User may change chain after invocation, Same chain
            // should be used for the entire MEP
            handlers = new ArrayList<Handler>();
            WSBinding binding = getBinding();
            List<LogicalHandler> logicalSnapShot= ((BindingImpl) binding).getHandlerConfig().getLogicalHandlers();
            if (!logicalSnapShot.isEmpty()) {
                handlers.addAll(logicalSnapShot);
                if (binding.getSOAPVersion() == null) {
                    processor = new XMLHandlerProcessor(this, binding,
                            handlers);
                } else {
                    processor = new SOAPHandlerProcessor(true, this, binding,
                            handlers);
                }
            }
    }
}
 
Example #7
Source File: ClientLogicalHandlerTube.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
void setUpProcessor() {
    if (handlers == null) {
            // Take a snapshot, User may change chain after invocation, Same chain
            // should be used for the entire MEP
            handlers = new ArrayList<Handler>();
            WSBinding binding = getBinding();
            List<LogicalHandler> logicalSnapShot= ((BindingImpl) binding).getHandlerConfig().getLogicalHandlers();
            if (!logicalSnapShot.isEmpty()) {
                handlers.addAll(logicalSnapShot);
                if (binding.getSOAPVersion() == null) {
                    processor = new XMLHandlerProcessor(this, binding,
                            handlers);
                } else {
                    processor = new SOAPHandlerProcessor(true, this, binding,
                            handlers);
                }
            }
    }
}
 
Example #8
Source File: ClientLogicalHandlerTube.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void setUpProcessor() {
    if (handlers == null) {
            // Take a snapshot, User may change chain after invocation, Same chain
            // should be used for the entire MEP
            handlers = new ArrayList<Handler>();
            WSBinding binding = getBinding();
            List<LogicalHandler> logicalSnapShot= ((BindingImpl) binding).getHandlerConfig().getLogicalHandlers();
            if (!logicalSnapShot.isEmpty()) {
                handlers.addAll(logicalSnapShot);
                if (binding.getSOAPVersion() == null) {
                    processor = new XMLHandlerProcessor(this, binding,
                            handlers);
                } else {
                    processor = new SOAPHandlerProcessor(true, this, binding,
                            handlers);
                }
            }
    }
}
 
Example #9
Source File: ClientLogicalHandlerTube.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void setUpProcessor() {
    if (handlers == null) {
            // Take a snapshot, User may change chain after invocation, Same chain
            // should be used for the entire MEP
            handlers = new ArrayList<Handler>();
            WSBinding binding = getBinding();
            List<LogicalHandler> logicalSnapShot= ((BindingImpl) binding).getHandlerConfig().getLogicalHandlers();
            if (!logicalSnapShot.isEmpty()) {
                handlers.addAll(logicalSnapShot);
                if (binding.getSOAPVersion() == null) {
                    processor = new XMLHandlerProcessor(this, binding,
                            handlers);
                } else {
                    processor = new SOAPHandlerProcessor(true, this, binding,
                            handlers);
                }
            }
    }
}
 
Example #10
Source File: ClientLogicalHandlerTube.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
void setUpProcessor() {
    if (handlers == null) {
            // Take a snapshot, User may change chain after invocation, Same chain
            // should be used for the entire MEP
            handlers = new ArrayList<Handler>();
            WSBinding binding = getBinding();
            List<LogicalHandler> logicalSnapShot= ((BindingImpl) binding).getHandlerConfig().getLogicalHandlers();
            if (!logicalSnapShot.isEmpty()) {
                handlers.addAll(logicalSnapShot);
                if (binding.getSOAPVersion() == null) {
                    processor = new XMLHandlerProcessor(this, binding,
                            handlers);
                } else {
                    processor = new SOAPHandlerProcessor(true, this, binding,
                            handlers);
                }
            }
    }
}
 
Example #11
Source File: ClientLogicalHandlerTube.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void setUpProcessor() {
    if (handlers == null) {
            // Take a snapshot, User may change chain after invocation, Same chain
            // should be used for the entire MEP
            handlers = new ArrayList<Handler>();
            WSBinding binding = getBinding();
            List<LogicalHandler> logicalSnapShot= ((BindingImpl) binding).getHandlerConfig().getLogicalHandlers();
            if (!logicalSnapShot.isEmpty()) {
                handlers.addAll(logicalSnapShot);
                if (binding.getSOAPVersion() == null) {
                    processor = new XMLHandlerProcessor(this, binding,
                            handlers);
                } else {
                    processor = new SOAPHandlerProcessor(true, this, binding,
                            handlers);
                }
            }
    }
}
 
Example #12
Source File: ClientLogicalHandlerTube.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void setUpProcessor() {
    if (handlers == null) {
            // Take a snapshot, User may change chain after invocation, Same chain
            // should be used for the entire MEP
            handlers = new ArrayList<Handler>();
            WSBinding binding = getBinding();
            List<LogicalHandler> logicalSnapShot= ((BindingImpl) binding).getHandlerConfig().getLogicalHandlers();
            if (!logicalSnapShot.isEmpty()) {
                handlers.addAll(logicalSnapShot);
                if (binding.getSOAPVersion() == null) {
                    processor = new XMLHandlerProcessor(this, binding,
                            handlers);
                } else {
                    processor = new SOAPHandlerProcessor(true, this, binding,
                            handlers);
                }
            }
    }
}
 
Example #13
Source File: ServerLogicalHandlerTube.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    List<LogicalHandler> logicalSnapShot= ((BindingImpl) getBinding()).getHandlerConfig().getLogicalHandlers();
    if (!logicalSnapShot.isEmpty()) {
        handlers.addAll(logicalSnapShot);
    }
}
 
Example #14
Source File: HTTPBindingImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method separates the logical and protocol handlers and
 * sets the HandlerConfiguration.
 * Only logical handlers are allowed with HTTPBinding.
 * Setting SOAPHandlers throws WebServiceException
 */
public void setHandlerChain(List<Handler> chain) {
    for (Handler handler : chain) {
        if (!(handler instanceof LogicalHandler)) {
            throw new WebServiceException(ClientMessages.NON_LOGICAL_HANDLER_SET(handler.getClass()));
        }
    }
    setHandlerConfig(new HandlerConfiguration(Collections.<String>emptySet(), chain));
}
 
Example #15
Source File: ServerLogicalHandlerTube.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    List<LogicalHandler> logicalSnapShot= ((BindingImpl) getBinding()).getHandlerConfig().getLogicalHandlers();
    if (!logicalSnapShot.isEmpty()) {
        handlers.addAll(logicalSnapShot);
    }
}
 
Example #16
Source File: HandlerChainInvoker.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void invokeReversedClose() {
    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;
}
 
Example #17
Source File: HandlerChainInvoker.java    From cxf with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
private boolean invokeReversedHandleFault(MessageContext ctx) {
    boolean continueProcessing = true;

    try {
        int index = invokedHandlers.size() - 2;
        while (index >= 0 && continueProcessing) {
            Handler<? extends MessageContext> h = invokedHandlers.get(index);
            if (h instanceof LogicalHandler) {
                LogicalHandler<LogicalMessageContext> lh = (LogicalHandler<LogicalMessageContext>)h;
                continueProcessing = lh.handleFault(logicalMessageContext);
            } else {
                Handler<MessageContext> ph = (Handler<MessageContext>)h;
                continueProcessing = ph.handleFault(protocolMessageContext);
            }

            if (!continueProcessing) {
                invokeReversedClose();
                break;
            }
            index--;
        }
    } catch (RuntimeException e) {
        LOG.log(Level.WARNING, "HANDLER_RAISED_RUNTIME_EXCEPTION", e);
        invokeReversedClose();
        continueProcessing = false;
        closed = true;

        throw e;
    }
    invokeReversedClose();
    return continueProcessing;
}
 
Example #18
Source File: HTTPBindingImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method separates the logical and protocol handlers and
 * sets the HandlerConfiguration.
 * Only logical handlers are allowed with HTTPBinding.
 * Setting SOAPHandlers throws WebServiceException
 */
public void setHandlerChain(List<Handler> chain) {
    for (Handler handler : chain) {
        if (!(handler instanceof LogicalHandler)) {
            throw new WebServiceException(ClientMessages.NON_LOGICAL_HANDLER_SET(handler.getClass()));
        }
    }
    setHandlerConfig(new HandlerConfiguration(Collections.<String>emptySet(), chain));
}
 
Example #19
Source File: HTTPBindingImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void validate() {
    for (Handler<?> handler : this.getHandlerChain()) {
        if (!(handler instanceof LogicalHandler)) {
            throw new WebServiceException("Adding an incompatible handler in HTTPBinding: "
                                          + handler.getClass());
        }
    }
}
 
Example #20
Source File: ServerLogicalHandlerTube.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    List<LogicalHandler> logicalSnapShot= ((BindingImpl) getBinding()).getHandlerConfig().getLogicalHandlers();
    if (!logicalSnapShot.isEmpty()) {
        handlers.addAll(logicalSnapShot);
    }
}
 
Example #21
Source File: HTTPBindingImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method separates the logical and protocol handlers and
 * sets the HandlerConfiguration.
 * Only logical handlers are allowed with HTTPBinding.
 * Setting SOAPHandlers throws WebServiceException
 */
public void setHandlerChain(List<Handler> chain) {
    for (Handler handler : chain) {
        if (!(handler instanceof LogicalHandler)) {
            throw new WebServiceException(ClientMessages.NON_LOGICAL_HANDLER_SET(handler.getClass()));
        }
    }
    setHandlerConfig(new HandlerConfiguration(Collections.<String>emptySet(), chain));
}
 
Example #22
Source File: ServerLogicalHandlerTube.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    List<LogicalHandler> logicalSnapShot= ((BindingImpl) getBinding()).getHandlerConfig().getLogicalHandlers();
    if (!logicalSnapShot.isEmpty()) {
        handlers.addAll(logicalSnapShot);
    }
}
 
Example #23
Source File: ServerLogicalHandlerTube.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    List<LogicalHandler> logicalSnapShot= ((BindingImpl) getBinding()).getHandlerConfig().getLogicalHandlers();
    if (!logicalSnapShot.isEmpty()) {
        handlers.addAll(logicalSnapShot);
    }
}
 
Example #24
Source File: HTTPBindingImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method separates the logical and protocol handlers and
 * sets the HandlerConfiguration.
 * Only logical handlers are allowed with HTTPBinding.
 * Setting SOAPHandlers throws WebServiceException
 */
public void setHandlerChain(List<Handler> chain) {
    for (Handler handler : chain) {
        if (!(handler instanceof LogicalHandler)) {
            throw new WebServiceException(ClientMessages.NON_LOGICAL_HANDLER_SET(handler.getClass()));
        }
    }
    setHandlerConfig(new HandlerConfiguration(Collections.<String>emptySet(), chain));
}
 
Example #25
Source File: ServerLogicalHandlerTube.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    List<LogicalHandler> logicalSnapShot= ((BindingImpl) getBinding()).getHandlerConfig().getLogicalHandlers();
    if (!logicalSnapShot.isEmpty()) {
        handlers.addAll(logicalSnapShot);
    }
}
 
Example #26
Source File: HTTPBindingImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method separates the logical and protocol handlers and
 * sets the HandlerConfiguration.
 * Only logical handlers are allowed with HTTPBinding.
 * Setting SOAPHandlers throws WebServiceException
 */
public void setHandlerChain(List<Handler> chain) {
    for (Handler handler : chain) {
        if (!(handler instanceof LogicalHandler)) {
            throw new WebServiceException(ClientMessages.NON_LOGICAL_HANDLER_SET(handler.getClass()));
        }
    }
    setHandlerConfig(new HandlerConfiguration(Collections.<String>emptySet(), chain));
}
 
Example #27
Source File: ServerLogicalHandlerTube.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    List<LogicalHandler> logicalSnapShot= ((BindingImpl) getBinding()).getHandlerConfig().getLogicalHandlers();
    if (!logicalSnapShot.isEmpty()) {
        handlers.addAll(logicalSnapShot);
    }
}
 
Example #28
Source File: HTTPBindingImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method separates the logical and protocol handlers and
 * sets the HandlerConfiguration.
 * Only logical handlers are allowed with HTTPBinding.
 * Setting SOAPHandlers throws WebServiceException
 */
public void setHandlerChain(List<Handler> chain) {
    for (Handler handler : chain) {
        if (!(handler instanceof LogicalHandler)) {
            throw new WebServiceException(ClientMessages.NON_LOGICAL_HANDLER_SET(handler.getClass()));
        }
    }
    setHandlerConfig(new HandlerConfiguration(Collections.<String>emptySet(), chain));
}
 
Example #29
Source File: HTTPBindingImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * This method separates the logical and protocol handlers and
 * sets the HandlerConfiguration.
 * Only logical handlers are allowed with HTTPBinding.
 * Setting SOAPHandlers throws WebServiceException
 */
public void setHandlerChain(List<Handler> chain) {
    for (Handler handler : chain) {
        if (!(handler instanceof LogicalHandler)) {
            throw new WebServiceException(ClientMessages.NON_LOGICAL_HANDLER_SET(handler.getClass()));
        }
    }
    setHandlerConfig(new HandlerConfiguration(Collections.<String>emptySet(), chain));
}
 
Example #30
Source File: ServerLogicalHandlerTube.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void setUpHandlersOnce() {
    handlers = new ArrayList<Handler>();
    List<LogicalHandler> logicalSnapShot= ((BindingImpl) getBinding()).getHandlerConfig().getLogicalHandlers();
    if (!logicalSnapShot.isEmpty()) {
        handlers.addAll(logicalSnapShot);
    }
}