Package play.mvc.Http

Examples of play.mvc.Http.RawBuffer


        throw new UnsupportedOperationException();
    }

    @Override
    public ServletInputStream getInputStream() throws IOException {
        RawBuffer raw = request.body().asRaw();

        byte[] buf;

        try {
            buf = raw.asBytes();
        } catch (NullPointerException e) {
            // asBytes() raises NullPointerException if the raw body is larger
            // than the limit defined by BodyParser.of annotation at
            // SvnApp.service() method.
            throw new IOException("Request entity is too large.", e);
        }

        final InputStream in;

        // If the content size is bigger than memoryThreshold, which is defined
        // as Integer.MAX_VALUE in play.core.j.JavaParsers.raw method, the
        // content is stored as a file.
        if (buf != null) {
            in = new ByteArrayInputStream(buf);
        } else {
            File file = raw.asFile();
            if (file == null) {
                // asFile() may return null if the raw body is larger than the limit defined by
                // BodyParser.of annotation at SvnApp.service() method.
                throw new IOException("Request entity is too large.");
            }
View Full Code Here


     * @see <a href="https://www.kernel.org/pub/software/scm/git/docs/git-receive-pack.html">git-receive-pack</a>
     */
    public static PipedInputStream gitRpc(final Project project, String service, Request request, Response response) {
        response.setContentType("application/x-" + service + "-result");

        RawBuffer raw = request.body().asRaw();
        byte[] buf = raw.asBytes();
        InputStream requestStream = null;

        try {
            // If the content size is bigger than memoryThreshold,
            // which is defined as 100 * 1024 in play.api.mvc.BodyParsers trait,
            // the content is stored as a file.
            if (buf != null) {
                requestStream = new ByteArrayInputStream(buf);
            } else {
                requestStream = new FileInputStream(raw.asFile());
            }

            Repository repository;
            PipedInputStream responseStream = new PipedInputStream();

View Full Code Here

TOP

Related Classes of play.mvc.Http.RawBuffer

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.