Package org.apache.mina.common

Examples of org.apache.mina.common.ByteBuffer.asInputStream()


        ServletUtils.copy(req.getInputStream(), reqBuffer
            .asOutputStream());
        reqBuffer.flip();
        get
            .setRequestEntity(new InputStreamRequestEntity(
                reqBuffer.asInputStream(), reqContentLength,
                "application/x-amf"));
        // get.setPath(path);
        get.addRequestHeader("Tunnel-request", path);

        client.executeMethod(get);
View Full Code Here


              .intValue();
          ByteBuffer respBuffer = ByteBuffer.allocate(responseLength);
          ServletUtils.copy(get.getResponseBodyAsStream(), respBuffer
              .asOutputStream());
          respBuffer.flip();
          ServletUtils.copy(respBuffer.asInputStream(), resp
              .getOutputStream());
          resp.flushBuffer();
        } else {
          resp.sendError(get.getStatusCode());
        }
View Full Code Here

        object.serialize(out);
        buf.flip();

        FileOutputStream output = new FileOutputStream(resFile
            .getFile().getAbsolutePath());
        ServletUtils.copy(buf.asInputStream(), output);
        output.close();
      } finally {
        buf.release();
        buf = null;
      }
View Full Code Here

    log.debug("Sending response");
    ByteBuffer respBuffer = codecFactory.getSimpleEncoder().encode(null,
        packet);
    final ServletOutputStream out = resp.getOutputStream();
    resp.setContentLength(respBuffer.limit());
    ServletUtils.copy(respBuffer.asInputStream(), out);
    out.flush();
    out.close();
    respBuffer.release();
    respBuffer = null;
  }
View Full Code Here

          final ServletOutputStream out = resp.getOutputStream();
          ByteBuffer buf = (ByteBuffer) message;
          resp.setStatus(HttpServletResponse.SC_OK);
          resp.setContentType(req.getContentType());
          resp.setContentLength(buf.limit());
          ServletUtils.copy(buf.asInputStream(), out);
          out.flush();
          out.close();
        } catch (IOException e) {
          log.error("Error sending response", e);
        }
View Full Code Here

  public Object invokeMethod(String method, Object[] params) {
    PostMethod post = new PostMethod(this.url + appendToUrl);
    ByteBuffer resultBuffer = null;
    ByteBuffer data = encodeInvoke(method, params);
    post.setRequestEntity(new InputStreamRequestEntity(
        data.asInputStream(), data.limit(), CONTENT_TYPE));
    try {
      int resultCode = client.executeMethod(post);
      if (resultCode / 100 != 2) {
        throw new RuntimeException(
            "Didn't receive success from remoting server.");
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.