Examples of ByteChunk


Examples of org.apache.tomcat.util.buf.ByteChunk

        ctxt.addServletMapping("/test",
                "NoContentLengthConnectionCloseFlushingServlet");

        tomcat.start();

        ByteChunk responseBody = new ByteChunk();
        Map<String,List<String>> responseHeaders = new HashMap<>();
        int rc = getUrl("http://localhost:" + getPort() + "/test", responseBody,
                responseHeaders);

        assertEquals(HttpServletResponse.SC_OK, rc);

        assertTrue(responseHeaders.containsKey("Connection"));
        List<String> connections = responseHeaders.get("Connection");
        assertEquals(1, connections.size());
        assertEquals("close", connections.get(0));

        assertFalse(responseHeaders.containsKey("Transfer-Encoding"));

        assertEquals("OK", responseBody.toString());
    }
View Full Code Here

Examples of org.apache.tomcat.util.buf.ByteChunk

                new LargeHeaderServlet(flush));
        ctxt.addServletMapping("/test", "LargeHeaderServlet");

        tomcat.start();

        ByteChunk responseBody = new ByteChunk();
        Map<String,List<String>> responseHeaders = new HashMap<>();
        int rc = getUrl("http://localhost:" + getPort() + "/test", responseBody,
                responseHeaders);

        assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, rc);
        if (responseBody.getLength() > 0) {
            // It will be >0 if the standard error page handlign has been
            // triggered
            assertFalse(responseBody.toString().contains("FAIL"));
        }
    }
View Full Code Here

Examples of org.glassfish.grizzly.http.util.ByteChunk

                    String.format("The requested resource (%s) is not available.", req.getDecodedRequestURI()), "404");
        } else {
            errorBody = HttpUtils.getErrorPage(Version.getVersion(),
                    "Internal Error", "500");
        }
        ByteChunk chunk = new ByteChunk();
        chunk.setBytes(errorBody, 0, errorBody.length);
        res.setContentLength(errorBody.length);
        res.setContentType("text/html");
        if (!version.isEmpty()) {
            res.addHeader("Server", version);
        }
        res.flush();
        res.getOutputBuffer().write(chunk.getBuffer());
    }
View Full Code Here

Examples of org.jboss.system.server.profileservice.repository.clustered.sync.ByteChunk

      synchronized (is)
      {
         b = new byte[MAX_CHUNK_BUFFER_SIZE];
         read = is.read(b);
      }
      ByteChunk byteChunk = new ByteChunk(b, read);
     
      // Write the bytes to our temp file as well
      if (byteChunk.getByteCount() > -1)
      {
         writeBytes(byteChunk);
      }
     
      return byteChunk;
View Full Code Here

Examples of org.jboss.system.server.profileservice.repository.clustered.sync.ByteChunk

            rethrowAsException(t);
         }
        
         if (rsp instanceof ByteChunk)
         {
            ByteChunk chunk = (ByteChunk) rsp;
            lastRead = chunk.getByteCount();
            if (lastRead > -1)
            {
               action.writeBytes(chunk);
            }
         }  
View Full Code Here

Examples of org.jboss.system.server.profileservice.repository.clustered.sync.ByteChunk

      int lastRead = 0;
      while (lastRead > -1)
      {
         try
         {
            ByteChunk chunk = action.getNextBytes();
        
            Object[] args = new Object[]{ id, action.getRepositoryContentModification().getItem(), chunk};
            // JBAS-7102 -- send chunks async; if there is a problem applying we'll
            // fail in the prepare phase
            this.partition.callAsynchMethodOnCluster(getServiceHAName(), "pushBytes", args, PUSH_BYTES_TYPES, true);
            lastRead = chunk.getByteCount();
         }
         catch (Exception e)
         {
            action.cancel();
            throw e;
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.