Examples of BytesMessageOutputStream


Examples of com.caucho.jms.util.BytesMessageOutputStream

    InputStream is = request.getInputStream();

    try {
      BytesMessage message = _jmsSession.createBytesMessage();

      BytesMessageOutputStream out = new BytesMessageOutputStream(message);
      WriteStream ws = VfsStream.openWrite(out);

      ws.writeStream(is);

      ws.flush();
      out.flush();

      _producer.send(message);
    } catch (JMSException e) {
      throw new ServletException(e);
    }
View Full Code Here

Examples of com.caucho.jms.util.BytesMessageOutputStream

  private void sendRequest(String methodName, Object []args)
    throws JMSException, IOException
  {
    BytesMessage message = _jmsSession.createBytesMessage();

    BytesMessageOutputStream os = new BytesMessageOutputStream(message);

    AbstractHessianOutput out = _factory.getHessianOutput(os);

    out.call(methodName, args);
    out.flush();
View Full Code Here

Examples of com.caucho.jms.util.BytesMessageOutputStream

  private void sendRequest(String methodName, Object []args)
    throws JMSException, IOException
  {
    BytesMessage message = _jmsSession.createBytesMessage();

    BytesMessageOutputStream os = new BytesMessageOutputStream(message);

    AbstractHessianOutput out = _factory.getHessianOutput(os);

    out.call(methodName, args);
    out.flush();
View Full Code Here

Examples of com.caucho.jms.util.BytesMessageOutputStream

    InputStream is = request.getInputStream();

    try {
      BytesMessage message = _jmsSession.createBytesMessage();

      BytesMessageOutputStream out = new BytesMessageOutputStream(message);
      WriteStream ws = VfsStream.openWrite(out);

      ws.writeStream(is);

      ws.flush();
      out.flush();

      _producer.send(message);
    } catch (JMSException e) {
      throw new ServletException(e);
    }
View Full Code Here

Examples of com.caucho.jms.util.BytesMessageOutputStream

  private void sendRequest(String methodName, Object []args)
    throws JMSException, IOException
  {
    BytesMessage message = _jmsSession.createBytesMessage();

    BytesMessageOutputStream os = new BytesMessageOutputStream(message);

    AbstractHessianOutput out = _factory.getHessianOutput(os);

    out.call(methodName, args);
    out.flush();
View Full Code Here

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

            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

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

            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

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

                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

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

            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
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.