Package org.mortbay.http

Examples of org.mortbay.http.HttpRequest


   
    public OutputStreamMessageContext rebase(MessageContext context,
                                             EndpointReferenceType decoupledResponseEndpoint)
        throws IOException {
        OutputStreamMessageContext outputContext = null;
        HttpRequest request =
            (HttpRequest)context.get(HTTPServerInputStreamContext.HTTP_REQUEST);
        HttpResponse response =
            (HttpResponse)context.get(HTTPServerInputStreamContext.HTTP_RESPONSE);
        if (response != null) {
            outputContext = new HTTPServerRebasedOutputStreamContext(context, request, response);
View Full Code Here


        }
       
    }
   
    protected void copyRequestHeaders(MessageContext ctx, Map<String, List<String>> headers) {
        HttpRequest req = (HttpRequest)ctx.get(HTTPServerInputStreamContext.HTTP_REQUEST);
        for (Enumeration e = req.getFieldNames(); e.hasMoreElements();) {
            String fname = (String)e.nextElement();
            List<String> values;
            if (headers.containsKey(fname)) {
                values = headers.get(fname);
            } else {
                values = new ArrayList<String>();
                headers.put(fname, values);
            }
            for (Enumeration e2 = req.getFieldValues(fname); e2.hasMoreElements();) {
                String val = (String)e2.nextElement();
                values.add(val);
            }
        }       
    }
View Full Code Here

    }

    protected void setPolicies(MessageContext ctx, Map<String, List<String>> headers) {
        super.setPolicies(ctx, headers);
        if (policy.isSetReceiveTimeout()) {
            HttpRequest req = (HttpRequest)ctx.get(HTTPServerInputStreamContext.HTTP_REQUEST);
            Object connection = req.getHttpConnection().getConnection();
            if (connection instanceof Socket) {
                Socket sock = (Socket)connection;
                try {
                    sock.setSoTimeout((int)policy.getReceiveTimeout());
                } catch (SocketException ex) {
View Full Code Here

        Date end = sdf.parse("2009-04-15T09:22:41.102-0700");

        final Map<String, String> requestHeaders = new TreeMap<String, String>();
        requestHeaders.put("foo", "bar");
        requestHeaders.put("baz", "blah");
        HttpRequest req = new HttpRequest() {
            @Override
            public Enumeration getFieldNames() {
                return Collections.enumeration(requestHeaders.keySet());
            }
View Full Code Here

                ProxyHandler.class.getDeclaredMethod(
            "sendNotFound", HttpResponse.class));
   
    String pathInContext = "/invalid";
    String pathParams = "";
    HttpRequest httpRequest = new HttpRequest();
    HttpResponse httpResponse = new HttpResponse();
    httpResponse.setAttribute("NotFound", "True");
   
    proxyHandlerMock.sendNotFound(httpResponse);
    expectLastCall().once();
View Full Code Here

        StaticContentHandler.setSlowResources(slowResourcesInitially);
    }

    public void testShouldMakePageNotCachedWhenHandle() throws Exception {
        HttpResponse response = new HttpResponse();
        handler.handle("", "", new HttpRequest(), response);
        assertEquals("Thu, 01 Jan 1970 00:00:00 GMT", response.getField("Expires"));
    }
View Full Code Here

    }

    public void testHandleSetsResponseAttributeInCaseOfMissingResource() throws Exception {
      String pathInContext = "/invalid";
      String pathParams = "";
      HttpRequest httpRequest = new HttpRequest();
      HttpResponse httpResponse = new HttpResponse();
      handler.handle(pathInContext, pathParams, httpRequest, httpResponse);
      assertEquals("True", httpResponse.getAttribute("NotFound"));
    }
View Full Code Here

                StaticContentHandler.class.getDeclaredMethod("getResource", String.class),
                StaticContentHandler.class.getDeclaredMethod("callSuperHandle", String.class, String.class, HttpRequest.class, HttpResponse.class));

      String pathInContext = "/driver/?cmd=getNewBrowserSession&1=*chrome&2=http://www.google.com";
      String pathParams = "";
      HttpRequest httpRequest = new HttpRequest();
      HttpResponse httpResponse = new HttpResponse();
     
      expect(mock.getResource(pathInContext)).andReturn(Resource.newResource("found_resource"));
      mock.callSuperHandle(pathInContext, pathParams, httpRequest, httpResponse);
      expectLastCall().once();
View Full Code Here

        new Method[] { ProxyHandler.class.getDeclaredMethod(
            "sendNotFound", HttpResponse.class) });
   
    String pathInContext = "/invalid";
    String pathParams = "";
    HttpRequest httpRequest = new HttpRequest();
    HttpResponse httpResponse = new HttpResponse();
    httpResponse.setAttribute("NotFound", "True");
   
    proxyHandlerMock.sendNotFound(httpResponse);
    expectLastCall().once();
View Full Code Here

        StaticContentHandler.setSlowResources(slowResourcesInitially);
    }

    public void testShouldMakePageNotCachedWhenHandle() throws Exception {
        HttpResponse response = new HttpResponse();
        handler.handle("", "", new HttpRequest(), response);
        assertEquals("Thu, 01 Jan 1970 00:00:00 GMT", response.getField("Expires"));
    }
View Full Code Here

TOP

Related Classes of org.mortbay.http.HttpRequest

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.