Examples of HandlerChain


Examples of javax.jws.HandlerChain

        assertEquals(Arrays.asList(address.listFiles()).toString(), 6, files.length);
        File handlerConfig = new File(address, "Greeter_handler.xml");
        assertTrue(handlerConfig.exists());

        Class<?> clz = classLoader.loadClass("ws.address.Greeter");
        HandlerChain handlerChainAnno = AnnotationUtil.getPrivClassAnnotation(clz, HandlerChain.class);
        assertEquals("Greeter_handler.xml", handlerChainAnno.file());
        assertNotNull("Handler chain xml generate fail!", classLoader
            .getResource("ws/address/Greeter_handler.xml"));
    }
View Full Code Here

Examples of javax.xml.rpc.handler.HandlerChain

        SEIFactory seiFactory = (SEIFactory) portNameToSEIFactoryMap.get(portName);
        if (seiFactory == null) {
            return null;
        }
        HandlerChain handlerChain = seiFactory.createHandlerChain();
        return handlerChain;

    }
View Full Code Here

Examples of javax.xml.rpc.handler.HandlerChain

            throw new ServiceException("Could not construct service instance", e.getTargetException());
        }
    }

    public HandlerChain createHandlerChain() {
        HandlerChain handlerChain = handlerInfoChainFactory.createHandlerChain();
        return handlerChain;
    }
View Full Code Here

Examples of javax.xml.rpc.handler.HandlerChain

        SEIFactory seiFactory = (SEIFactory) portNameToSEIFactoryMap.get(portName);
        if (seiFactory == null) {
            return null;
        }
        HandlerChain handlerChain = seiFactory.createHandlerChain();
        return handlerChain;

    }
View Full Code Here

Examples of javax.xml.rpc.handler.HandlerChain

    }


    private void initHandlerChain(QName portName, HandlerRegistry handlerRegistry,
            HandlerInfo handlerInfo, ArrayList<String> soaprolesToAdd) {
        HandlerChain handlerChain = (HandlerChain) handlerRegistry.getHandlerChain(portName);
        @SuppressWarnings("unchecked") // Can't change the API
        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);
    }
View Full Code Here

Examples of javax.xml.rpc.handler.HandlerChain

        SEIFactory seiFactory = (SEIFactory) portNameToSEIFactoryMap.get(portName);
        if (seiFactory == null) {
            return null;
        }
        HandlerChain handlerChain = seiFactory.createHandlerChain();
        return handlerChain;

    }
View Full Code Here

Examples of javax.xml.rpc.handler.HandlerChain

            this.operation = operation;
        }

        @AroundInvoke
        public Object intercept(InvocationContext context) throws Exception {
            HandlerChain handlerChain = new HandlerChainImpl(handlerInfos);
            try {
                Object invocationResult = null;

                try {
                    if (handlerChain.handleRequest(messageContext)) {
                        // update arguments as handlers could change the soap msg
                        context.setParameters(getArguments());

                        invocationResult = context.proceed();

                        // update the soap msg so that handlers see invocation result
                        if (!handlerChain.isEmpty()) {
                            createResult(invocationResult);
                        }

                    } else {
                        /* The Handler implementation class has the responsibility of setting
                         * the response SOAP message in the handleRequest method and perform
                         * additional processing in the handleResponse method.
                         */
                        invocationResult = null;
                    }
                } catch (SOAPFaultException e) {
                    handlerChain.handleFault(messageContext);
                    throw e;
                }

                handlerChain.handleResponse(messageContext);

                if (!handlerChain.isEmpty()) {
                    /*
                     * Deserialize the result value from soap msg as handers could have
                     * changed it.
                     */
                    try {
                        invocationResult = demarshallResult();
                    } catch (Exception e) {
                        // if this fails, return invocationResult from above
                    }
                }

                return invocationResult;
            } finally {
                handlerChain.destroy();
            }
        }
View Full Code Here

Examples of javax.xml.rpc.handler.HandlerChain

    }


    private void initHandlerChain(QName portName, HandlerRegistry handlerRegistry,
            HandlerInfo handlerInfo, ArrayList<String> soaprolesToAdd) {
        HandlerChain handlerChain = (HandlerChain) handlerRegistry.getHandlerChain(portName);
        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);
    }
View Full Code Here

Examples of javax.xml.rpc.handler.HandlerChain

         }
      }

      boolean status = true;

      HandlerChain handlerChain = null;
      if (type == HandlerType.PRE)
         handlerChain = preHandlerChain;
      else if (type == HandlerType.ENDPOINT)
         handlerChain = jaxrpcHandlerChain;
      else if (type == HandlerType.POST)
         handlerChain = postHandlerChain;

      if (handlerChain != null)
         status = handlerChain.handleRequest(msgContext);

      return status;
   }
View Full Code Here

Examples of javax.xml.rpc.handler.HandlerChain

   public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
   {
      SOAPMessageContextJAXRPC msgContext = (SOAPMessageContextJAXRPC)MessageContextAssociation.peekMessageContext();

      HandlerChain handlerChain = null;
      if (type == HandlerType.PRE)
         handlerChain = preHandlerChain;
      else if (type == HandlerType.ENDPOINT)
         handlerChain = jaxrpcHandlerChain;
      else if (type == HandlerType.POST)
         handlerChain = postHandlerChain;

      boolean status = (handlerChain != null ? handlerChain.handleResponse(msgContext) : true);

      if (type == HandlerType.ENDPOINT)
         XOPContext.visitAndRestoreXOPData();

      return status;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.