Package org.apache.axis2.transport.jms.iowrappers

Examples of org.apache.axis2.transport.jms.iowrappers.BytesMessageOutputStream


        t.start();
        log.info((sslContext == null ? "HTTP" : "HTTPS") + " Sender starting");

        // register with JMX
        mbeanSupport
            = new TransportMBeanSupport(this, "nio-http" + (sslContext == null ? "" : "s"));
        mbeanSupport.register();
       
        state = BaseConstants.STARTED;
    }
View Full Code Here


            String charSetEncoding = BuilderUtil.getCharSetEncoding(contentTypeStr);
            msgContext.setProperty(
                    Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding);
            boolean eprFound = false;
            if (endpointsConfiguration != null) {
                URLEndpoint epr = endpointsConfiguration.getEndpoint(request.getRequestLine().getUri());
                if (epr != null) {
                    eprFound = true;
                    String type = TransportUtils.getContentType(contentTypeStr, msgContext);
                    msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE, type);
                    epr.setParameters(msgContext);

                    Builder builder = epr.getBuilder(type);
                    if (HTTPTransportUtils.isRESTRequest(contentTypeStr)) {
                        RESTUtil.processPOSTRequest(msgContext, is, os,
                                request.getRequestLine().getUri(), contentType, builder, isRestDispatching);
                    } else {
View Full Code Here

            String contentTypeStr = contentType != null ?
                    contentType.getValue() : inferContentType();

            boolean eprFound = false;
            if (endpointsConfiguration != null) {
                URLEndpoint epr = endpointsConfiguration.getEndpoint(request.getRequestLine().getUri());
                if (epr != null) {
                    eprFound = true;
                    String type = TransportUtils.getContentType(contentTypeStr, msgContext);
                    msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE, type);

                    epr.setParameters(msgContext);

                    Builder builder = epr.getBuilder(type);
                    RESTUtil.processGetAndDeleteRequest(
                            msgContext, os, request.getRequestLine().getUri(),
                            request.getFirstHeader(HTTP.CONTENT_TYPE), builder,
                            method, isRestDispatching);
                }
View Full Code Here

        params = getListenerParameters();


        param = transportIn.getParameter(NhttpConstants.ENDPOINTS_CONFIGURATION);
        if (param != null && param.getValue() != null) {
            endpoints = new URLEndpointsConfigurationFactory().create(param.getValue().toString());
        }
    }
View Full Code Here

        HttpParams params = getClientParameters();
        try {
            String prefix = (sslContext == null ? "http" : "https") + "-Sender I/O dispatcher";
            ioReactor = new DefaultConnectingIOReactor(
                NHttpConfiguration.getInstance().getClientIOWorkers(),
                new NativeThreadFactory(new ThreadGroup(prefix + " thread group"), prefix), params);
            ioReactor.setExceptionHandler(new IOReactorExceptionHandler() {
                public boolean handle(IOException ioException) {
                    log.warn("System may be unstable: IOReactor encountered a checked exception : " +
                        ioException.getMessage(), ioException);
                    return true;
View Full Code Here

            OutputStream out;
            StringWriter sw;
            if (useBytesMessage) {
                BytesMessage bytesMsg = session.createBytesMessage();
                sw = null;
                out = new BytesMessageOutputStream(bytesMsg);
                message = bytesMsg;
            } else {
                sw = new StringWriter();
                try {
                    out = new WriterOutputStream(sw, format.getCharSetEncoding());
                } catch (UnsupportedCharsetException ex) {
                    handleException("Unsupported encoding " + format.getCharSetEncoding(), ex);
                    return null;
                }
            }
           
            try {
                messageFormatter.writeTo(msgContext, format, out, true);
                out.close();
            } catch (IOException e) {
                handleException("IO Error while creating BytesMessage", e);
            }

            if (!useBytesMessage) {
                TextMessage txtMsg = session.createTextMessage();
                txtMsg.setText(sw.toString());
                message = txtMsg;
            }
           
            if (contentTypeProperty != null) {
                message.setStringProperty(contentTypeProperty, contentType);
            }

        } else if (JMSConstants.JMS_BYTE_MESSAGE.equals(jmsPayloadType)) {
            message = session.createBytesMessage();
            BytesMessage bytesMsg = (BytesMessage) message;
            OMElement wrapper = msgContext.getEnvelope().getBody().
                getFirstChildWithName(BaseConstants.DEFAULT_BINARY_WRAPPER);
            OMNode omNode = wrapper.getFirstOMChild();
            if (omNode != null && omNode instanceof OMText) {
                Object dh = ((OMText) omNode).getDataHandler();
                if (dh != null && dh instanceof DataHandler) {
                    try {
                        ((DataHandler) dh).writeTo(new BytesMessageOutputStream(bytesMsg));
                    } catch (IOException e) {
                        handleException("Error serializing binary content of element : " +
                            BaseConstants.DEFAULT_BINARY_WRAPPER, e);
                    }
                }
View Full Code Here

            OutputStream out;
            StringWriter sw;
            if (useBytesMessage) {
                BytesMessage bytesMsg = session.createBytesMessage();
                sw = null;
                out = new BytesMessageOutputStream(bytesMsg);
                message = bytesMsg;
            } else {
                sw = new StringWriter();
                try {
                    out = new WriterOutputStream(sw, format.getCharSetEncoding());
                } catch (UnsupportedCharsetException ex) {
                    handleException("Unsupported encoding " + format.getCharSetEncoding(), ex);
                    return null;
                }
            }
           
            try {
                messageFormatter.writeTo(msgContext, format, out, true);
                out.close();
            } catch (IOException e) {
                handleException("IO Error while creating BytesMessage", e);
            }

            if (!useBytesMessage) {
                TextMessage txtMsg = session.createTextMessage();
                txtMsg.setText(sw.toString());
                message = txtMsg;
            }
           
            if (contentTypeProperty != null) {
                message.setStringProperty(contentTypeProperty, contentType);
            }

        } else if (JMSConstants.JMS_BYTE_MESSAGE.equals(jmsPayloadType)) {
            message = session.createBytesMessage();
            BytesMessage bytesMsg = (BytesMessage) message;
            OMElement wrapper = msgContext.getEnvelope().getBody().
                getFirstChildWithName(BaseConstants.DEFAULT_BINARY_WRAPPER);
            OMNode omNode = wrapper.getFirstOMChild();
            if (omNode != null && omNode instanceof OMText) {
                Object dh = ((OMText) omNode).getDataHandler();
                if (dh != null && dh instanceof DataHandler) {
                    try {
                        ((DataHandler) dh).writeTo(new BytesMessageOutputStream(bytesMsg));
                    } catch (IOException e) {
                        handleException("Error serializing binary content of element : " +
                            BaseConstants.DEFAULT_BINARY_WRAPPER, e);
                    }
                }
View Full Code Here

                try {
                    log.info("Message received: ID = " + message.getJMSMessageID());
                    Message reply;
                    if (message instanceof BytesMessage) {
                        reply = replySession.createBytesMessage();
                        IOUtils.copy(new BytesMessageInputStream((BytesMessage)message), new BytesMessageOutputStream((BytesMessage)reply));
                    } else if (message instanceof TextMessage) {
                        reply = replySession.createTextMessage();
                        ((TextMessage)reply).setText(((TextMessage)message).getText());
                    } else {
                        // TODO
View Full Code Here

            OutputStream out;
            StringWriter sw;
            if (useBytesMessage) {
                BytesMessage bytesMsg = session.createBytesMessage();
                sw = null;
                out = new BytesMessageOutputStream(bytesMsg);
                message = bytesMsg;
            } else {
                sw = new StringWriter();
                try {
                    out = new WriterOutputStream(sw, format.getCharSetEncoding());
                } catch (UnsupportedCharsetException ex) {
                    handleException("Unsupported encoding " + format.getCharSetEncoding(), ex);
                    return null;
                }
            }
           
            try {
                messageFormatter.writeTo(msgContext, format, out, true);
                out.close();
            } catch (IOException e) {
                handleException("IO Error while creating BytesMessage", e);
            }

            if (!useBytesMessage) {
                TextMessage txtMsg = session.createTextMessage();
                txtMsg.setText(sw.toString());
                message = txtMsg;
            }
           
            if (contentTypeProperty != null) {
                message.setStringProperty(contentTypeProperty, contentType);
            }

        } else if (JMSConstants.JMS_BYTE_MESSAGE.equals(jmsPayloadType)) {
            message = session.createBytesMessage();
            BytesMessage bytesMsg = (BytesMessage) message;
            OMElement wrapper = msgContext.getEnvelope().getBody().
                getFirstChildWithName(BaseConstants.DEFAULT_BINARY_WRAPPER);
            OMNode omNode = wrapper.getFirstOMChild();
            if (omNode != null && omNode instanceof OMText) {
                Object dh = ((OMText) omNode).getDataHandler();
                if (dh != null && dh instanceof DataHandler) {
                    try {
                        ((DataHandler) dh).writeTo(new BytesMessageOutputStream(bytesMsg));
                    } catch (IOException e) {
                        handleException("Error serializing binary content of element : " +
                            BaseConstants.DEFAULT_BINARY_WRAPPER, e);
                    }
                }
View Full Code Here

            // set ClientOptions to the current outgoing message
            outMsgCtx.setOptions(options);

      // do Target Resolution
      TargetResolver tr = cfgCtx.getAxisConfiguration().getTargetResolverChain();
            if (tr != null) {
                tr.resolveTarget(outMsgCtx);
            }

            // if the transport to use for sending is not specified, try to find it from the URL
      TransportOutDescription transportOut = options.getTransportOut();
      if (transportOut == null) {
View Full Code Here

TOP

Related Classes of org.apache.axis2.transport.jms.iowrappers.BytesMessageOutputStream

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.