Examples of MessageContext

  • org.springframework.binding.message.MessageContext
    A context for recording and retrieving messages for display.
  • org.springframework.ws.context.MessageContext
    Context holder for message requests.

    Contains both the message request as well as the response. Response message are usually lazily created (but do not have to be).

    Also contains properties, which can be used to by {@link EndpointInterceptor interceptors} to pass information on toendpoints. @author Arjen Poutsma @since 1.0.0

  • xsul.message_router.MessageContext

  • Examples of javax.xml.rpc.handler.MessageContext

        * @return configured JBoss invocation
        */
       private org.jboss.invocation.Invocation getMBeanInvocation(final Invocation wsInvocation)
       {
          // ensure preconditions
          final MessageContext msgContext = wsInvocation.getInvocationContext().getAttachment(MessageContext.class);
          if (msgContext == null)
          {
             throw new IllegalStateException("Cannot obtain MessageContext");
          }

    View Full Code Here

    Examples of javax.xml.ws.handler.MessageContext

      private static final String ORDER_ID_ATTR = "invoice.orderId";
      private static final String LINE_PRICE_ATTR = "invoice.linePrice";

      public void initiatePriceCalculation(CustomerInfo customerInfo,
          PurchaseOrder purchaseOrder) {
        MessageContext messageContext = serviceContext.getMessageContext();
        ServletContext servletContext =
            (ServletContext) messageContext.get(MessageContext.SERVLET_CONTEXT);
        servletContext.setAttribute(ORDER_ID_ATTR, purchaseOrder.getOrderId());
        // In our system the part number is also the unit price!
        servletContext.setAttribute(LINE_PRICE_ATTR,
            (float) purchaseOrder.getQuantity() * purchaseOrder.getPartNumber());
      }
     
    View Full Code Here

    Examples of javax.xml.ws.handler.MessageContext

          logger.log(Level.SEVERE, "failed to send invoice message", e);
        }
      }

      protected void sendInvoiceMessage(float shippingPrice) throws JMSException {
        MessageContext messageContext = serviceContext.getMessageContext();
        ServletContext servletContext =
            (ServletContext) messageContext.get(MessageContext.SERVLET_CONTEXT);
        Integer orderId = (Integer) servletContext.getAttribute(ORDER_ID_ATTR);
        Float linePrice = (Float) servletContext.getAttribute(LINE_PRICE_ATTR);
        float amount = linePrice + shippingPrice;

        // create a connection
    View Full Code Here

    Examples of org.apache.airavata.gfac.context.MessageContext

      public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException,GFacException {

          log.info("Invoking SCPInputHandler");


              MessageContext inputNew = new MessageContext();
              try {
                  MessageContext input = jobExecutionContext.getInMessageContext();
                  Set<String> parameters = input.getParameters().keySet();
                  for (String paramName : parameters) {
                      ActualParameter actualParameter = (ActualParameter) input.getParameters().get(paramName);
                      String paramValue = MappingFactory.toString(actualParameter);
                      //TODO: Review this with type
                      if ("URI".equals(actualParameter.getType().getType().toString())) {
                          ((URIParameterType) actualParameter.getType()).setValue(stageInputFiles(jobExecutionContext, paramValue));
                      } else if ("URIArray".equals(actualParameter.getType().getType().toString())) {
    View Full Code Here

    Examples of org.apache.airavata.gfac.core.context.MessageContext

        public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
            super.invoke(jobExecutionContext);
            int index = 0;
            int oldIndex = 0;
            List<String> oldFiles = new ArrayList<String>();
            MessageContext inputNew = new MessageContext();
            DataTransferDetails detail = new DataTransferDetails();
            TransferStatus status = new TransferStatus();
            StringBuffer data = new StringBuffer("|");
            try {
                String pluginData = GFacUtils.getPluginData(jobExecutionContext, this.getClass().getName());
                if (pluginData != null) {
                    try {
                        oldIndex = Integer.parseInt(pluginData.split("\\|")[0].trim());
                        oldFiles = Arrays.asList(pluginData.split("\\|")[1].split(","));
                        if (oldIndex == oldFiles.size()) {
                            log.info("Old data looks good !!!!");
                        } else {
                            oldIndex = 0;
                            oldFiles.clear();
                        }
                    } catch (NumberFormatException e) {
                        log.error("Previously stored data " + pluginData +" is wrong so we continue the operations");
                    }
                }
                if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT) == null) {
                    try {
                        GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
                    } catch (ApplicationSettingsException e) {
                        log.error(e.getMessage());
                        throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
                    }
                }
                log.info("Invoking SCPInputHandler");

                MessageContext input = jobExecutionContext.getInMessageContext();
                Set<String> parameters = input.getParameters().keySet();
                for (String paramName : parameters) {
                    ActualParameter actualParameter = (ActualParameter) input.getParameters().get(paramName);
                    String paramValue = MappingFactory.toString(actualParameter);
                    //TODO: Review this with type
                    if ("URI".equals(actualParameter.getType().getType().toString())) {
                        if (index < oldIndex) {
                            log.info("Input File: " + paramValue + " is already transfered, so we skip this operation !!!");
    View Full Code Here

    Examples of org.apache.axis.MessageContext

       this method save path to the config files in session
       */
      private void getPATH()
      {
        String PATH;
        MessageContext mc = MessageContext.getCurrentContext();
        PATH = (String)((HttpServlet)mc.getProperty(HTTPConstants.MC_HTTP_SERVLET)).getServletContext().getRealPath("/") + "WEB-INF/";
        session.set("PATH", PATH);
      }
    View Full Code Here

    Examples of org.apache.axis2.context.MessageContext

                try {
                    transportHeaders.put(VFSConstants.FILE_LENGTH, content.getSize());
                    transportHeaders.put(VFSConstants.LAST_MODIFIED, content.getLastModifiedTime());
                } catch (FileSystemException ignore) {}

                MessageContext msgContext = entry.createMessageContext();
               
                String contentType = entry.getContentType();
                if (BaseUtils.isBlank(contentType)) {
                    if (file.getName().getExtension().toLowerCase().endsWith(".xml")) {
                        contentType = "text/xml";
                    } else if (file.getName().getExtension().toLowerCase().endsWith(".txt")) {
                        contentType = "text/plain";
                    }
                } else {
                    // Extract the charset encoding from the configured content type and
                    // set the CHARACTER_SET_ENCODING property as e.g. SOAPBuilder relies on this.
                    String charSetEnc = null;
                    try {
                        if (contentType != null) {
                            charSetEnc = new ContentType(contentType).getParameter("charset");
                        }
                    } catch (ParseException ex) {
                        // ignore
                    }
                    msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEnc);
                }

                // if the content type was not found, but the service defined it.. use it
                if (contentType == null) {
                    if (entry.getContentType() != null) {
                        contentType = entry.getContentType();
                    } else if (VFSUtils.getProperty(
                        content, BaseConstants.CONTENT_TYPE) != null) {
                        contentType =
                            VFSUtils.getProperty(content, BaseConstants.CONTENT_TYPE);
                    }
                }

                // does the service specify a default reply file URI ?
                String replyFileURI = entry.getReplyFileURI();
                if (replyFileURI != null) {
                    msgContext.setProperty(Constants.OUT_TRANSPORT_INFO,
                            new VFSOutTransportInfo(replyFileURI, entry.isFileLockingEnabled()));
                }

                // Determine the message builder to use
                Builder builder;
                if (contentType == null) {
                    log.debug("No content type specified. Using SOAP builder.");
                    builder = new SOAPBuilder();
                } else {
                    int index = contentType.indexOf(';');
                    String type = index > 0 ? contentType.substring(0, index) : contentType;
                    builder = BuilderUtil.getBuilderFromSelector(type, msgContext);
                    if (builder == null) {
                        if (log.isDebugEnabled()) {
                            log.debug("No message builder found for type '" + type +
                                    "'. Falling back to SOAP.");
                        }
                        builder = new SOAPBuilder();
                    }
                }

                // set the message payload to the message context
                InputStream in;
                ManagedDataSource dataSource;
                if (builder instanceof DataSourceMessageBuilder && entry.isStreaming()) {
                    in = null;
                    dataSource = ManagedDataSourceFactory.create(
                            new FileObjectDataSource(file, contentType));
                } else {
                    in = content.getInputStream();
                    dataSource = null;
                }
               
                try {
                    OMElement documentElement;
                    if (in != null) {
                        documentElement = builder.processDocument(in, contentType, msgContext);
                    } else {
                        documentElement = ((DataSourceMessageBuilder)builder).processDocument(
                                dataSource, contentType, msgContext);
                    }
                    msgContext.setEnvelope(TransportUtils.createSOAPEnvelope(documentElement));
                   
                    handleIncomingMessage(
                        msgContext,
                        transportHeaders,
                        null, //* SOAP Action - not applicable *//
     
    View Full Code Here

    Examples of org.apache.axis2.context.MessageContext

                            "Possibly an RM terminate sequence message");
                }

            } else {
                if (responseMsgCtx == null) {
                    responseMsgCtx = new MessageContext();
                    responseMsgCtx.setOperationContext(outMsgCtx.getOperationContext());
                }

                responseMsgCtx.setServerSide(true);
                responseMsgCtx.setDoingREST(outMsgCtx.isDoingREST());
    View Full Code Here

    Examples of org.apache.axis2.context.MessageContext

            axis2Request.setCompleted(true);
            if (errorCode == -1 && errorMessage == null && exceptionToRaise == null) {
                return; // no need to continue
            }

            final MessageContext mc = axis2Request.getMsgContext();

            // if the request message is a sandesha messag we ignore the
            // exception handling
            // we cannot use the declared sandesha2 constant since
            // nhttp transport shouldn't take a sandesha2 dependency
            String done = (String) mc.getProperty("Sandesha2AppProcessingDone");
        if (JavaUtils.isTrueExplicitly(done)) {
          return;
        }

            if (mc.getAxisOperation() != null &&
                    mc.getAxisOperation().getMessageReceiver() != null) {

                if (metrics != null) {
                    if (metrics.getLevel() == MetricsCollector.LEVEL_FULL) {
                        if (errorCode == NhttpConstants.CONNECTION_TIMEOUT) {
                            metrics.incrementTimeoutsReceiving(mc);
                        } else {
                            metrics.incrementFaultsSending(errorCode, mc);
                        }
                    } else {
                        if (errorCode == NhttpConstants.CONNECTION_TIMEOUT) {
                            metrics.incrementTimeoutsReceiving();
                        } else {
                            metrics.incrementFaultsSending();
                        }
                    }
                }

                workerPool.execute( new Runnable() {
                    public void run() {
                        MessageReceiver mr = mc.getAxisOperation().getMessageReceiver();
                        try {
                            // This AxisFault is created to create the fault message context
                            // noinspection ThrowableInstanceNeverThrown
                            AxisFault axisFault = exceptionToRaise != null ?
                                    new AxisFault(errorMessage, exceptionToRaise) :
                                    new AxisFault(errorMessage);

                            MessageContext nioFaultMessageContext =
                                MessageContextBuilder.createFaultMessageContext(mc, axisFault);

                            SOAPEnvelope envelope = nioFaultMessageContext.getEnvelope();

                            if (log.isDebugEnabled()) {
                                log.debug("Sending Fault for Request with Message ID : "
                                        + mc.getMessageID());
                            }
                           
                            nioFaultMessageContext.setProperty(
                                NhttpConstants.SENDING_FAULT, Boolean.TRUE);
                            nioFaultMessageContext.setProperty(
                                    NhttpConstants.ERROR_MESSAGE, errorMessage);
                            if (errorCode != -1) {
                                nioFaultMessageContext.setProperty(
                                    NhttpConstants.ERROR_CODE, errorCode);
                            }
                            if (exceptionToRaise != null) {
                                nioFaultMessageContext.setProperty(
                                    NhttpConstants.ERROR_DETAIL, exceptionToRaise.toString());
                                nioFaultMessageContext.setProperty(
                                    NhttpConstants.ERROR_EXCEPTION, exceptionToRaise);
                                envelope.getBody().getFault().getDetail().setText(
                                    exceptionToRaise.toString());
                            } else {
                                nioFaultMessageContext.setProperty(
                                    NhttpConstants.ERROR_DETAIL, errorMessage);
                                envelope.getBody().getFault().getDetail().setText(errorMessage);
                            }
                            nioFaultMessageContext.setProperty(CLIENT_CONNECTION_DEBUG,
                                mc.getProperty(CLIENT_CONNECTION_DEBUG));
                            mr.receive(nioFaultMessageContext);

                        } catch (AxisFault af) {
                            log.error("Unable to report back failure to the message receiver", af);
    View Full Code Here

    Examples of org.apache.axis2.context.MessageContext

                        ccd.recordResponseCompletionTime();
                    }
                   
                    if (metrics != null) {
                        if (metrics.getLevel() == MetricsCollector.LEVEL_FULL) {
                            MessageContext mc = getMessageContext(conn);
                            metrics.incrementMessagesReceived(mc);
                            metrics.notifyReceivedMessageSize(
                                    mc, conn.getMetrics().getReceivedBytesCount());
                            metrics.notifySentMessageSize(mc, conn.getMetrics().getSentBytesCount());
                            metrics.reportResponseCode(mc, response.getStatusLine().getStatusCode());
    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.