Package org.jboss.soa.esb.message

Examples of org.jboss.soa.esb.message.Properties


            messageTL.set(message);

            RequestHandler requestHandler = endpoint.getRequestHandler();

            final Map<String, List<String>> headers = new HashMap<String, List<String>>() ;
            final Properties properties = message.getProperties() ;
            final String[] names = properties.getNames() ;
            for(final String name: names)
            {
                final Object value = properties.getProperty(name) ;
                if (value != null)
                {
                    String normalisedName = name.toLowerCase() ;

                    if ("content-type".equals(normalisedName))
                    {
                        if ("application/octet-stream".equals(value))
                        {
                            continue;
                        }
                        else
                        {
                            // CXF needs it to be case sensitive
                            normalisedName = "Content-Type";
                        }
                    }

                    final List<String> values = headers.get(normalisedName) ;
                    if (values == null)
                    {
                        final List<String> newValues = new ArrayList<String>() ;
                        newValues.add(value.toString()) ;
                        headers.put(normalisedName, newValues) ;
                    }
                    else
                    {
                        values.add(value.toString()) ;
                    }
                }
            }

            //CXF throws NPE in handler if content-length not set
            List<String> newValues = new ArrayList<String>();
            newValues.add(String.valueOf(soapMessage.length));
            headers.put("content-length", newValues);

            final String endpointAddress = endpoint.getAddress() ;
            String path = null ;
            if (endpointAddress != null)
            {
                try
                {
                    path = new URI(endpointAddress).getPath() ;
                }
                catch (final URISyntaxException urise) {} //ignore
            }
            if (path == null)
            {
                path = getHeaderValue(headers, "path") ;
            }

            final SOAPProcessorHttpServletRequest servletRequest = new SOAPProcessorHttpServletRequest(path, soapMessage, headers) ;
            final SOAPProcessorHttpServletResponse servletResponse = new SOAPProcessorHttpServletResponse() ;
            final ServletContext servletContext = SOAPProcessorFactory.getFactory().createServletContext(endpoint) ;

            EndpointAssociation.setEndpoint(endpoint);
            final ClassLoader old = Thread.currentThread().getContextClassLoader();
            try
            {
                initialiseContextClassLoader(endpoint);
                requestHandler.handleHttpRequest(endpoint, servletRequest, servletResponse, servletContext) ;
            }
            finally
            {
                Thread.currentThread().setContextClassLoader(old);
                EndpointAssociation.removeEndpoint();
            }
           
            // This may have been changed, make sure we get the current version.
            message = messageTL.get();
            final Properties responseProperties = message.getProperties() ;
            final String contentType = servletResponse.getContentType() ;
            final Map<String, List<String>> responseHeaders = servletResponse.getHeaders() ;
            // We deal with Content-Type below
            // HTTP Headers *should* be case-insensitive but not with JBR
            responseHeaders.remove("content-type") ;
          
            for(Map.Entry<String, List<String>> header: responseHeaders.entrySet())
            {
                // We can only deal with the first value in the list.
              // JBESB-2511
              new ResponseHeader(header.getKey(), header.getValue().get(0)).setPropertyNameThis(properties);
            }
            // JBESB-2761
            if (httpResponseStatusEnabled) {
              ResponseStatus.setHttpProperties(properties, servletResponse.getStatus(), servletResponse.getStatusMessage());
            }
           
            final byte[] responseData = servletResponse.getContent() ;
            if(contentType != null) {
                responseProperties.setProperty("Content-Type", new ResponseHeader("Content-Type", contentType));
            } else {
                responseProperties.setProperty("Content-Type", new ResponseHeader("Content-Type", "text/xml"));
            }
           
            if ((contentType != null) && contentType.startsWith("multipart/")) {
                payloadProxy.setPayload(message, responseData) ;
            } else {
View Full Code Here


   * @param messageType The response type.
   */
  private void sendToDLQ(final Call callDetails, final Message message,
    final MessageType messageType)
  {
    final Properties properties = message.getProperties() ;
    properties.setProperty(MessageStore.CLASSIFICATION, MessageStore.CLASSIFICATION_DLQ);
    properties.setProperty(ActionProcessingConstants.PROPERTY_FAILURE_CALL_DETAILS, callDetails.toString()) ;
    properties.setProperty(ActionProcessingConstants.PROPERTY_FAILURE_RESPONSE_TYPE, messageType.name()) ;

    try
    {
      final ServiceInvoker serviceInvoker = new ServiceInvoker(ServiceInvoker.dlqService) ;

View Full Code Here

        {
            type = null;
            name = null;
        }

        final Properties props = msg.getProperties();
        setProperty(props, Environment.TRANSPORT_TYPE, type);
        setProperty(props, Environment.MESSAGE_SOURCE, name);
        return msg;
    }
View Full Code Here

   * @param configTree The configTree the properties on the ESB Message object will override.
   * @deprecated Use {@link Emailer#overrideSmtpProperties(Message, ConfigTree)} instead
   */
  protected void overrideSmtpProperties(final Message message, final ConfigTree configTree)
    {
      final Properties properties = message.getProperties();
      override(Email.HOST, properties, configTree);
      override(Email.PORT, properties, configTree);
      override(Email.USERNAME, properties, configTree);
      override(Email.PASSWORD, properties, configTree);
      override(Email.AUTH, properties, configTree);
View Full Code Here

        }
    }

    private void attachResponseDetails(Message message, HttpMethodBase method, int responseCode) {
        HttpResponse response = new HttpResponse(responseCode);
        Properties properties = message.getProperties();

        response.setEncoding(method.getResponseCharSet());
        response.setLength(method.getResponseContentLength());

        Header[] responseHeaders = method.getResponseHeaders();
View Full Code Here

        }
    }
   
  private void setMappedHttpHeaders(HttpMethodBase method, Message message) {
      HttpRequest request = HttpRequest.getRequest(message);
      Properties properties = message.getProperties();
      for (String headerName : mappedHeaderList) {
        String headerValue = null;
        if (request != null) {
          headerValue = getHttpHeaderValue(request, headerName);
        }
View Full Code Here

   *
   * @throws JMSException
   */
  private void setProperties( final org.jboss.soa.esb.message.Message fromESBMessage, final Message toJMSMessage ) throws JMSException
  {
    Properties properties = fromESBMessage.getProperties();
    for ( String key : properties.getNames() )
    {
      if ( !Strings.isValidJavaIdentifier( key ))
        continue;
     
            if (key.startsWith("JMSX"))
            {
                if (!JMSX_GROUP_ID.equals(key) && !JMSX_GROUP_SEQ.equals(key))
                {
                    continue ;
                }
            }
            else if (key.startsWith("JMS_"))
            {
                continue ;
            }
           
      Object value = properties.getProperty( key );
      log.debug( "Setting outgoing JMSProperty, key : " + key + ", value : " + value );
      if ( value instanceof String  )
        toJMSMessage.setStringProperty( key, (String) value );
      else if ( value instanceof Boolean  )
        toJMSMessage.setBooleanProperty( key, (Boolean)value );
View Full Code Here

   * Override to modify mapping behavior.
   * @param esbMessageIn ESB message.
   * @param camelMessageIn Camel message.
   */
  protected void mapHeaders(Message esbMessageIn, T camelMessageIn) {
    Properties properties = esbMessageIn.getProperties();
    for (Entry<String, Object> entry : camelMessageIn.getHeaders().entrySet()) {
      String name = entry.getKey();
     
      if(mapHeaders != null && !mapHeaders.contains(name)) {
        // skip header mapping...
        continue;
      }
     
      Object value = entry.getValue();
      if (value instanceof Serializable) {
        properties.setProperty(name, value);
      } else {
        if(value != null && logger.isDebugEnabled()) {
          logger.debug("Camel header '" + name + "' is not Serializable (type " + value.getClass().getName() + ").  Cannot map to ESB Properties.  Ignoring.");
        }
      }
View Full Code Here

    if (camelMessageIn != null) {
      setRelatesTo(camelMessageIn.getExchange(), esbMessageOut);
    }
   
    // set camel headers from esb properties
    Properties properties = esbMessageOut.getProperties();
    for (String name : properties.getNames()) {
      Object value = properties.getProperty(name);
      if (value != null) {
        camelMessageOut.setHeader(name, value);
      }
    }
   
View Full Code Here

      this.paramType = paramType;
      this.property = property;
    }

    public Object getParam(Message message) throws MessageDeliverException {
      Properties properties = message.getProperties();
     
      String propertyName = AnnotationUtil.getPropertyName(property);
      if(propertyName != null) {
        Object param = properties.getProperty(propertyName);
        if(param != null && !paramType.isInstance(param)) {
          throw new MessageDeliverException("Named property '" + propertyName + "' exists on ESB message but is not of type '" + paramType.getName() + "'.");
        }
        return param;
      } else {
        for(String propertyNameOnMessage : properties.getNames()) {
          Object param = properties.getProperty(propertyNameOnMessage);
          if(param != null && paramType.isInstance(param)) {
            return param;
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.message.Properties

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.