Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
String requests=
   "GET /context/servlet/info?query=foo HTTP/1.1\r\n"+
   "Host: tester\r\n"+
   "\r\n"+         
   "GET /context/hello HTTP/1.1\r\n"+
   "Host: tester\r\n"+
   "\r\n";
            
String responses = tester.getResponses(requests);
        
String expected=
   "HTTP/1.1 200 OK\r\n"+
   "Content-Type: text/html; charset=iso-8859-1\r\n"+
   "Content-Length: 21\r\n"+
   "\r\n"+
   "<h1>Test Servlet</h1>" +
         
   "HTTP/1.1 200 OK\r\n"+
   "Content-Type: text/html; charset=iso-8859-1\r\n"+
   "Content-Length: 22\r\n"+
   "\r\n"+
   "<h1>Hello Servlet</h1>";
            
    assertEquals(expected,responses);

Generated Requests and Parsed Responses

Dealing with raw HTTP can be a bit verbose and difficult to test non protocol aspects. The HttpTester class allows for simple generation of requests and parsing of response (it can also parse requests and generate responses).

Code Block
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery