Examples of MessageBody


Examples of flex.messaging.io.amf.MessageBody

        {
            me = new MessageException("Error occurred parsing AMFX: " + t.getMessage());
        }

        me.setCode("Client.Message.Encoding");
        MessageBody body = new MessageBody();
        body.setData(me);
        m.addBody(body);
    }
View Full Code Here

Examples of flex.messaging.io.amf.MessageBody

    public void start_body(Attributes attributes)
    {
        if (currentBody != null || currentHeader != null)
            throw new MessageException("Unexpected body tag.");

        currentBody = new MessageBody();

        String targetURI = attributes.getValue("targetURI");
        currentBody.setTargetURI(targetURI);

        String responseURI = attributes.getValue("responseURI");
View Full Code Here

Examples of flex.messaging.io.amf.MessageBody

    public byte[] serializeMessage(String contenido) {
  try {
      ActionMessage requestMessage = new ActionMessage();
     
      ByteArrayOutputStream outBuffer = new ByteArrayOutputStream();
      MessageBody amfMessage = new MessageBody(targetURI, responseURI, new com.thoughtworks.xstream.XStream().fromXML(contenido));
      requestMessage.addBody(amfMessage);
      MessageSerializer amfMessageSerializer = new AmfMessageSerializer();
      amfMessageSerializer.initialize(dsContext, outBuffer, trace);
      amfMessageSerializer.writeMessage(requestMessage);
      return outBuffer.toByteArray();
View Full Code Here

Examples of org.wymiwyg.wrhapi.MessageBody

    uri.setQuery("name="+queryParam);
    request.setRequestURI(uri);
    String[] headervalues = new String[1];
    headervalues[0]="text/plain";
    request.setHeader(HeaderName.CONTENT_TYPE, headervalues);
    MessageBody messageBody = new MessageBody2Read() {

      @Override
      public ReadableByteChannel read() throws IOException {
        return Channels.newChannel(new ByteArrayInputStream(bodyString.getBytes()));
      }
View Full Code Here

Examples of org.wymiwyg.wrhapi.MessageBody

  @Override
  public boolean matches(Object object) {
    if (object == null) {
      return bytes == null;
    }
    MessageBody body = (MessageBody) object;
    try {
      InputStream in = Channels.newInputStream(body.read());
      for (byte b : bytes) {
        int inByte = in.read();
        if (inByte != b) {
          return false;
        }
View Full Code Here

Examples of org.wymiwyg.wrhapi.MessageBody

        new HidingWriter(), new MyResource());
    Request requestMock = EasyMock.createNiceMock(Request.class);
    final Response responseMock = EasyMock.createNiceMock(Response.class);
   
    makeThreadSafe(responseMock, true);
    final MessageBody body = new MessageBody2Read() {

      @Override
      public ReadableByteChannel read() throws IOException {
        return Channels.newChannel(new ByteArrayInputStream(hiddenEntity.getBytes()));
      }
View Full Code Here

Examples of org.wymiwyg.wrhapi.MessageBody

    // Serialize testObj
    final ByteArrayOutputStream bous = new ByteArrayOutputStream();
    ObjectOutput out = new ObjectOutputStream(bous);
    out.writeObject(testObj);
    out.close();
    MessageBody body = new MessageBody2Read() {

      @Override
      public ReadableByteChannel read() throws IOException {
        return Channels.newChannel(new ByteArrayInputStream(bous.toByteArray()));
      }
View Full Code Here

Examples of org.wymiwyg.wrhapi.MessageBody

    //headervalues[2] = "application/xml;q=0.9";
    headervalues[0] = "*/*";
   
    request.setHeader(HeaderName.CONTENT_TYPE, headervalues);

    MessageBody messageBody = new MessageBody2Read() {

      @Override
      public ReadableByteChannel read() throws IOException {
        return Channels.newChannel(new ByteArrayInputStream(xmlString.getBytes()));
      }
View Full Code Here

Examples of org.wymiwyg.wrhapi.MessageBody

          JaxRsHandler.localRequest.remove();
        } catch (Exception ex) {
          try {
            BodyStoringResponse responseFake = new BodyStoringResponse(response);
            JaxRsHandler.handleException(ex, request, responseFake);
            final MessageBody body = responseFake.getBody();
            if (body != null) {
              try {
                //doing priviledged as this might invoke doAs to
                //write the body as subject
                AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {

                  @Override
                  public Subject run() throws IOException {
                    body.writeTo(out);
                    return null;
                  }
                });
              } catch (PrivilegedActionException privEx) {
                Throwable cause = privEx.getCause();
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.