Examples of HttpRequest

Otherwise, the HTTP request will go directly to the host:
header "Connection" or "Proxy-Connection"
The HttpRequest sets the appropriate connection header to "Keep-Alive" to keep alive the connection to the host or proxy (respectively). By setting the appropriate connection header, the user can control whether the HttpRequest tries to use Keep-Alives.
header "Host"
The HTTP/1.1 protocol requires that the "Host" header be set to the name of the machine being contacted. By default, this is derived from the URL used to construct the HttpRequest, and is set automatically if the user does not set it.
header "Content-Length"
If the user calls getOutputStream and writes some data to it, the "Content-Length" header will be set to the amount of data that has been written at the time that connect is called.
Once all data has been read from the remote host, the underlying socket may be automatically recycled and used again for subsequent requests to the same remote host. If the user is not planning on reading all the data from the remote host, the user should call close to release the socket. Although it happens under the covers, the user should be aware that if an IOException occurs or once data has been read normally from the remote host, close is called automatically. This is to ensure that the minimal number of sockets are left open at any time.

The input stream that getInputStream provides automatically hides whether the remote host is providing HTTP/1.1 "chunked" encoding or regular streaming data. The user can simply read until reaching the end of the input stream, which signifies that all the available data from this request has been read. If reading from a "chunked" source, the data is automatically de-chunked as it is presented to the user. Currently, no access is provided to the underlying raw input stream. @author Colin Stevens (colin.stevens@sun.com) @version 2.5

  • twitter4j.internal.http.HttpRequest

  • Examples of mongrel2.HttpRequest

        while (this.handler.isActive()) {

          try {

            final HttpRequest req = new HttpRequest();
            this.handler.takeRequest(req);

            final long now = System.currentTimeMillis();
            System.out.printf("%tH:%tM:%tS - %s %s%n", now, now, now, this.senderId, req.getRequestURL());

            final HttpResponse rsp = new HttpResponse();
            rsp.setContent("Hello, world!\n");
            rsp.setStatus(HttpStatus.OK);
            // rsp.setStatus(HttpStatus.BadRequest.code, "Nice Try");
    View Full Code Here

    Examples of net.grinder.plugin.http.HTTPRequest

        private static HTTPRequest request = null;
        private static GTest test = new GTest(1, "Hello");

        @BeforeClass
        public static void beforeProcess() {
          request = new HTTPRequest();
          try {
            test.record(request);
          } catch (NonInstrumentableTypeException e) {
          }
        }
    View Full Code Here

    Examples of net.sf.cindy.example.http.HttpRequest

            buffer.append(new Date(file.lastModified()));
            buffer.append("</td></tr>");
        }

        public void objectReceived(Session session, Object obj) throws Exception {
            HttpRequest request = (HttpRequest) obj;

            boolean keepAlive = "keep-alive".equalsIgnoreCase(request
                    .getParam("Connection"));
            ByteBuffer content = getContent(request.getRequestURI());

            HttpResponse response = new HttpResponse();
            response.setVersion(request.getVersion());
            if (content == null) {
                response.setStatusCode(404);
                response.setReasonPhrase("Not Found");
                response.setParam("Content-Type", "text/plain");
                response.setParam("Content-Length", String
                        .valueOf(NOT_FOUND.length));
                response.setContent(NOT_FOUND);
            } else {
                response.setStatusCode(200);
                response.setReasonPhrase("OK");
                response.setParam("Content-Type", mimeMap.getContentTypeFor(request
                        .getRequestURI()));
                response.setParam("Content-Length", String.valueOf(content
                        .remaining()));
            }
            response.setParam("Server", "Cindy Http Server");
    View Full Code Here

    Examples of net.sf.sahi.request.HttpRequest

            }
        }

        @SuppressWarnings("unchecked")
      public HttpResponse appendFiles(final HttpRequest request) {
            HttpRequest rebuiltRequest = request;
            if (request.isMultipart()) {
                Session session = request.session();
                MultiPartRequest multiPartRequest;
                try {
                    multiPartRequest = new MultiPartRequest(request);
    View Full Code Here

    Examples of oauth.signpost.http.HttpRequest

            assertEquals("GET&http%3A%2F%2Fexample.com%2F&a%3D1", sbs.generate());
        }
       
        @Test
        public void shouldWorkWithBracketsInParameterName() throws Exception {
            HttpRequest request = mock(HttpRequest.class);
            when(request.getMethod()).thenReturn("GET");
            when(request.getRequestUrl()).thenReturn("http://examplebrackets.com");

            HttpParameters params = new HttpParameters();
            params.put("a[]", "1", true);

            SignatureBaseString sbs = new SignatureBaseString(request, params);
    View Full Code Here

    Examples of org.apache.cassandra.net.http.HttpRequest

        public void doVerb(Message message)
        {
            HttpConnection.HttpRequestMessage httpRequestMessage = (HttpConnection.HttpRequestMessage)message.getMessageBody()[0];
            try
            {
                HttpRequest httpRequest = httpRequestMessage.getHttpRequest();
                HttpWriteResponse httpServerResponse = new HttpWriteResponse(httpRequest);
                if(httpRequest.getMethod().toUpperCase().equals("GET"))
                {
                    // handle the get request type
                    doGet(httpRequest, httpServerResponse);
                }
                else if(httpRequest.getMethod().toUpperCase().equals("POST"))
                {
                    // handle the POST request type
                    doPost(httpRequest, httpServerResponse);
                }
    View Full Code Here

    Examples of org.apache.catalina.HttpRequest

            if (!(request instanceof HttpRequest) ||
                !(response instanceof HttpResponse)) {
                context.invokeNext(request, response);
                return;
            }
            HttpRequest hrequest = (HttpRequest) request;
            HttpResponse hresponse = (HttpResponse) response;
            HttpServletRequest hreq =
                (HttpServletRequest) hrequest.getRequest();

            // Log pre-service information
            log("REQUEST URI       =" + hreq.getRequestURI());
            log("          authType=" + hreq.getAuthType());
            log(" characterEncoding=" + hreq.getCharacterEncoding());
    View Full Code Here

    Examples of org.apache.cocoon.environment.http.HttpRequest

            Map objectModel,
            String source,
            Parameters parameters)
            throws Exception {

            HttpRequest request = (HttpRequest)ObjectModelHelper.getRequest(objectModel);

            // Get namespaces
            String namespaces = removeRedundantNamespaces(request.getParameter("namespaces"));
            log.debug(namespaces);

            // Aggregate content
            String encoding = request.getCharacterEncoding();
            String content =
                "<?xml version=\"1.0\" encoding=\""
                    + encoding
                    + "\"?>\n"
                    + addNamespaces(namespaces, request.getParameter("content"));

            // Save file temporarily
            File sitemap = new File(new URL(resolver.resolveURI("").getURI()).getFile());
            File file =
                new File(
    View Full Code Here

    Examples of org.apache.http.HttpRequest

            public int fillBuffer(final ReadableByteChannel channel) throws IOException {
                return this.parser.fillBuffer(channel);
            }

            public HttpRequest parse() throws IOException, HttpException {
                HttpRequest message = this.parser.parse();
                if (message != null && headerlog.isDebugEnabled()) {
                    headerlog.debug(id + " >> " + message.getRequestLine().toString());
                    Header[] headers = message.getAllHeaders();
                    for (int i = 0; i < headers.length; i++) {
                        headerlog.debug(id + " >> " + headers[i].toString());
                    }
                }
                return message;
    View Full Code Here

    Examples of org.apache.maven.plugins.site.SimpleDavServerHandler.HttpRequest

                    String authPass = this.authentications.get( user ).toString();
                    if ( password.equals( authPass ) )
                    {
                        String targetPath = request.getServletPath();

                        HttpRequest rq = new HttpRequest();
                        rq.method = request.getMethod();
                        rq.path = targetPath;

                        @SuppressWarnings( "rawtypes" )
                        Enumeration headerNames = request.getHeaderNames();
    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.