Package org.wymiwyg.wrhapi

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


  @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

        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

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

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

          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

Related Classes of org.wymiwyg.wrhapi.MessageBody

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.