Package javax.xml.ws.handler

Examples of javax.xml.ws.handler.MessageContext


    // CXF-3989
    @Test
    @SuppressWarnings("unchecked")
    public void testSetHttpRequestHeadersScope() {
        MessageImpl msg = new MessageImpl();
        MessageContext context = new WrappedMessageContext(msg);
        Map headers = new HashMap<String, List<String>>();
        List<String> values = new ArrayList<String>();
        values.add("Value1");
        headers.put("Header1", values);
        context.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
        context.setScope(MessageContext.HTTP_REQUEST_HEADERS, Scope.APPLICATION);
    }
View Full Code Here


  
        // Find processed token corresponding to the URI
        if (referenceURI.charAt(0) == '#') {
            referenceURI = referenceURI.substring(1);
        }
        MessageContext messageContext = wsContext.getMessageContext();
        final List<WSHandlerResult> handlerResults =
            CastUtils.cast((List<?>) messageContext.get(WSHandlerConstants.RECV_RESULTS));
       
        if (handlerResults != null && handlerResults.size() > 0) {
            WSHandlerResult handlerResult = handlerResults.get(0);
            List<WSSecurityEngineResult> engineResults = handlerResult.getResults();
           
View Full Code Here

          throw new RuntimeException("getHeaders() was not called on the handler");
      }
      */
     
        // for these properties tests to always pass, an inbound server-side handler must "put" them
        MessageContext mc = ctx.getMessageContext();
        String propKey1 = "AddNumbersLogicalHandlerInboundAppScopedProperty";
        String propKey2 = "AddNumbersLogicalHandlerInboundHandlerScopedProperty";
        String value = (String)mc.get(propKey1);
        if (value == null)
            throw new RuntimeException("Property value for key \"" + propKey1 + "\" was null, but is APPLICATION scoped and should be accessible by the endpoint");
        if (mc.containsKey(propKey2))  // instead of "get", use "containsKey" to be a little more robust in testing
            throw new RuntimeException("MessageContext.containsKey reported true for key \"" + propKey2 + "\" was not null.  This property is HANDLER scoped and should not be accessible by the endpoint");
        TestLogger.logger
                .debug(">> Received addNumbersHandler request for " + arg0 + " and " + arg1);
        if (arg0 == 101)
            throw new RuntimeException("Got value 101.  AddNumbersHandlerPortTypeImpl.addNumbersHandler method is correctly throwing this exception as part of testing");
View Full Code Here

       
        public boolean checkProofOfPossession(
            TokenRenewerParameters tokenParameters,
            SAMLKeyInfo subjectKeyInfo
        ) {
            MessageContext messageContext = tokenParameters.getWebServiceContext().getMessageContext();
            final List<WSHandlerResult> handlerResults =
                CastUtils.cast((List<?>) messageContext.get(WSHandlerConstants.RECV_RESULTS));

            List<WSSecurityEngineResult> signedResults = new ArrayList<WSSecurityEngineResult>();
            if (handlerResults != null && handlerResults.size() > 0) {
                WSHandlerResult handlerResult = handlerResults.get(0);
                List<WSSecurityEngineResult> results = handlerResult.getResults();
               
                WSSecurityUtil.fetchAllActionResults(results, WSConstants.SIGN, signedResults);
                WSSecurityUtil.fetchAllActionResults(results, WSConstants.UT_SIGN, signedResults);
            }
           
            TLSSessionInfo tlsInfo = (TLSSessionInfo)messageContext.get(TLSSessionInfo.class.getName());
            Certificate[] tlsCerts = null;
            if (tlsInfo != null) {
                tlsCerts = tlsInfo.getPeerCertificates();
            }
           
View Full Code Here

   
    private static AssertionWrapper fetchSAMLAssertionFromWSSecuritySAMLToken(
        WebServiceContext wsContext
    ) {
       
        MessageContext messageContext = wsContext.getMessageContext();
        final List<WSHandlerResult> handlerResults =
            CastUtils.cast((List<?>) messageContext.get(WSHandlerConstants.RECV_RESULTS));
       
        if (handlerResults != null && handlerResults.size() > 0) {
            WSHandlerResult handlerResult = handlerResults.get(0);
            List<WSSecurityEngineResult> engineResults = handlerResult.getResults();
           
View Full Code Here

            }
         }
      }

      HandlerChainExecutor executor = createExecutor(sepMetaData, type);
      MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
      return executor.handleMessage(msgContext);
   }
View Full Code Here

   public boolean callResponseHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
   {
      log.debug("callResponseHandlerChain: " + type);
      HandlerChainExecutor executor = getExecutor(type);
      MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
      boolean status = (executor != null ? executor.handleMessage(msgContext) : true);

      MessageAbstraction msg = ((CommonMessageContext)msgContext).getMessageAbstraction();
      if (msg instanceof SOAPMessage)
         XOPContext.visitAndRestoreXOPData();
View Full Code Here

   public void closeHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type)
   {
      log.debug("closeHandlerChain");
      HandlerChainExecutor executor = getExecutor(type);
      MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
      if (executor != null)
      {
         executor.close(msgContext);
         removeExecutor(type);
      }
View Full Code Here

   public boolean callFaultHandlerChain(ServerEndpointMetaData sepMetaData, HandlerType type, Exception ex)
   {
      log.debug("callFaultHandlerChain: " + type);
      HandlerChainExecutor executor = getExecutor(type);
      MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
      boolean status = (executor != null ? executor.handleFault(msgContext, ex) : true);

      MessageAbstraction msg = ((CommonMessageContext)msgContext).getMessageAbstraction();
      if (msg instanceof SOAPMessage)
         XOPContext.visitAndRestoreXOPData();
View Full Code Here

   {
      BindingExt binding = (BindingExt)bindingProvider.getBinding();
      HandlerChainExecutor executor = new HandlerChainExecutor(epMetaData, binding.getHandlerChain(type), false);
      executorMap.put(type, executor);

      MessageContext msgContext = (MessageContext)MessageContextAssociation.peekMessageContext();
      return executor.handleMessage(msgContext);
   }
View Full Code Here

TOP

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

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.