Search in sources :

Example 1 with Handler

use of javax.xml.rpc.handler.Handler in project tomee by apache.

the class HandlerChainImpl method handleRequest.

public boolean handleRequest(MessageContext context) {
    MessageSnapshot snapshot = new MessageSnapshot(context);
    try {
        for (int i = 0; i < size(); i++) {
            Handler currentHandler = (Handler) get(i);
            invokedHandlers.addFirst(currentHandler);
            try {
                if (!currentHandler.handleRequest(context)) {
                    return false;
                }
            } catch (SOAPFaultException e) {
                throw e;
            }
        }
    } finally {
        saveChanges(context);
    }
    if (!snapshot.equals(context)) {
        throw new IllegalStateException("The soap message operation or arguments were illegally modified by the HandlerChain");
    }
    return true;
}
Also used : Handler(javax.xml.rpc.handler.Handler) SOAPFaultException(javax.xml.rpc.soap.SOAPFaultException)

Example 2 with Handler

use of javax.xml.rpc.handler.Handler in project tomee by apache.

the class HandlerChainImpl method destroy.

public void destroy() {
    for (Iterator iterator = invokedHandlers.iterator(); iterator.hasNext(); ) {
        Handler handler = (Handler) iterator.next();
        handler.destroy();
    }
    invokedHandlers.clear();
    clear();
}
Also used : Iterator(java.util.Iterator) Handler(javax.xml.rpc.handler.Handler)

Example 3 with Handler

use of javax.xml.rpc.handler.Handler in project tomcat by apache.

the class ServiceRefFactory method initHandlerChain.

private void initHandlerChain(QName portName, HandlerRegistry handlerRegistry, HandlerInfo handlerInfo, ArrayList<String> soaprolesToAdd) {
    HandlerChain handlerChain = (HandlerChain) handlerRegistry.getHandlerChain(portName);
    @SuppressWarnings("unchecked") Iterator<Handler> iter = handlerChain.iterator();
    while (iter.hasNext()) {
        Handler handler = iter.next();
        handler.init(handlerInfo);
    }
    String[] soaprolesRegistered = handlerChain.getRoles();
    String[] soaproles = new String[soaprolesRegistered.length + soaprolesToAdd.size()];
    int i;
    for (i = 0; i < soaprolesRegistered.length; i++) soaproles[i] = soaprolesRegistered[i];
    for (int j = 0; j < soaprolesToAdd.size(); j++) soaproles[i + j] = soaprolesToAdd.get(j);
    handlerChain.setRoles(soaproles);
    handlerRegistry.setHandlerChain(portName, handlerChain);
}
Also used : HandlerChain(javax.xml.rpc.handler.HandlerChain) Handler(javax.xml.rpc.handler.Handler)

Aggregations

Handler (javax.xml.rpc.handler.Handler)3 Iterator (java.util.Iterator)1 HandlerChain (javax.xml.rpc.handler.HandlerChain)1 SOAPFaultException (javax.xml.rpc.soap.SOAPFaultException)1