Package org.wymiwyg.wrhapi.util

Examples of org.wymiwyg.wrhapi.util.MessageBody2Write


        if (stylesheet == null) {
          super.setHeader(HeaderName.CONTENT_TYPE, "application/rdf+xml");
        } else {
          super.setHeader(HeaderName.CONTENT_TYPE, "application/xml");
        }
        super.setBody(new MessageBody2Write() {
          //<?xml-stylesheet type="text/xsl" href="/stylesheets/topic"?>
          public void writeTo(WritableByteChannel out) throws IOException {
            Model model = JenaUtil.getModelFromGraph(graph);
            //TODO deliver other formats
            OutputStream outS = Channels.newOutputStream(out);
View Full Code Here


    //this redundancy makes me prefer not to use mocks
    Set<HeaderName> headerNames = new HashSet<HeaderName>();
    headerNames.add(HeaderName.CONTENT_TYPE);
    expect(requestMock.getHeaderNames()).andReturn(headerNames).anyTimes();
    final String message = "The message in the body";
    expect(requestMock.getMessageBody()).andReturn(new MessageBody2Write() {

      @Override
      public void writeTo(WritableByteChannel out) throws IOException {
        out.write(ByteBuffer.wrap(message.getBytes()));
      }
View Full Code Here

    RequestURIImpl uri = new RequestURIImpl();
    uri.setPath("/test-resource/setForm");
    String[] values = new String[1];
    values[0] = "application/x-www-form-urlencoded";
    request.setHeader(HeaderName.CONTENT_TYPE, values);
    request.setMessageBody(new MessageBody2Write() {

              @Override
              public void writeTo(WritableByteChannel cout)
                  throws IOException {
                
View Full Code Here

    // this redundancy makes me prefer not to use mocks
    Set<HeaderName> headerNames = new HashSet<HeaderName>();
    headerNames.add(HeaderName.CONTENT_TYPE);
    expect(requestMock.getHeaderNames()).andReturn(headerNames).anyTimes();
    final String message = "The message in the body";
    expect(requestMock.getMessageBody()).andReturn(new MessageBody2Write() {

      @Override
      public void writeTo(WritableByteChannel out) throws IOException {
        out.write(ByteBuffer.wrap(message.getBytes()));
      }
View Full Code Here

    RequestURIImpl uri = new RequestURIImpl();
    uri.setPath("/test-resource/setForm");
    String[] values = new String[1];
    values[0] = "application/x-www-form-urlencoded";
    request.setHeader(HeaderName.CONTENT_TYPE, values);
    request.setMessageBody(new MessageBody2Write() {

              @Override
              public void writeTo(WritableByteChannel cout)
                  throws IOException {
                
View Full Code Here

    }

    final MessageBodyWriter<Object> finalWriter = writer;
    final Object finalEntity = entity;
    final MediaType finalMediaType = mediaType;
    response.setBody(new MessageBody2Write() {

      AccessControlContext context = AccessController.getContext();
      Subject subject = AccessController.doPrivileged(new PrivilegedAction<Subject>() {
        @Override
        public Subject run() {
View Full Code Here

    // this redundancy makes me prefer not to use mocks
    Set<HeaderName> headerNames = new HashSet<HeaderName>();
    headerNames.add(HeaderName.CONTENT_TYPE);
    expect(requestMock.getHeaderNames()).andReturn(headerNames).anyTimes();
    final String message = "The message in the body";
    expect(requestMock.getMessageBody()).andReturn(new MessageBody2Write() {

      @Override
      public void writeTo(WritableByteChannel out) throws IOException {
        out.write(ByteBuffer.wrap(message.getBytes()));
      }
View Full Code Here

TOP

Related Classes of org.wymiwyg.wrhapi.util.MessageBody2Write

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.