Added JsonPage and finished implementation of digest auth page
This commit is contained in:
parent
2c7a9a6eff
commit
26c09452f3
10 changed files with 244 additions and 52 deletions
30
test/zutil/net/http/HttpTestUtil.java
Executable file
30
test/zutil/net/http/HttpTestUtil.java
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
package zutil.net.http;
|
||||
|
||||
import zutil.io.StringOutputStream;
|
||||
import zutil.net.http.page.HttpDigestAuthPageTest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class HttpTestUtil {
|
||||
public static HashMap<String,Object> session = new HashMap();
|
||||
|
||||
/**
|
||||
* Make a simple http request on the given page object
|
||||
*/
|
||||
public static HttpHeader makeRequest(HttpPage page) throws IOException {
|
||||
return makeRequest(page, new HttpHeader());
|
||||
}
|
||||
/**
|
||||
* Make a simple http request on the given page object
|
||||
*/
|
||||
public static HttpHeader makeRequest(HttpPage page, HttpHeader headers) throws IOException {
|
||||
StringOutputStream buff = new StringOutputStream();
|
||||
HttpPrintStream out = new HttpPrintStream(buff);
|
||||
page.respond(
|
||||
out, headers, session, new HashMap(), new HashMap());
|
||||
out.flush();
|
||||
HttpHeaderParser parser = new HttpHeaderParser(buff.toString());
|
||||
return parser.read();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue