Set HTTP request method field in RequestTrans.
This commit is contained in:
parent
23b3b8055b
commit
73d103327a
2 changed files with 13 additions and 14 deletions
|
@ -30,6 +30,8 @@ public abstract class AbstractServletClient extends HttpServlet {
|
|||
boolean caching;
|
||||
boolean debug;
|
||||
|
||||
static final byte HTTP_GET = 0;
|
||||
static final byte HTTP_POST = 1;
|
||||
|
||||
public void init (ServletConfig init) throws ServletException {
|
||||
super.init (init);
|
||||
|
@ -64,23 +66,23 @@ public abstract class AbstractServletClient extends HttpServlet {
|
|||
|
||||
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
execute (request, response);
|
||||
execute (request, response, HTTP_GET);
|
||||
}
|
||||
|
||||
public void doPost (HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
execute (request, response);
|
||||
execute (request, response, HTTP_POST);
|
||||
}
|
||||
|
||||
|
||||
protected void execute (HttpServletRequest request, HttpServletResponse response) {
|
||||
protected void execute (HttpServletRequest request, HttpServletResponse response, byte method) {
|
||||
String protocol = request.getProtocol ();
|
||||
Cookie[] cookies = request.getCookies();
|
||||
|
||||
// get app and path from original request path
|
||||
String pathInfo = request.getPathInfo ();
|
||||
String appID = getAppID (pathInfo);
|
||||
RequestTrans reqtrans = new RequestTrans ();
|
||||
RequestTrans reqtrans = new RequestTrans (method);
|
||||
reqtrans.path = getRequestPath (pathInfo);
|
||||
|
||||
try {
|
||||
|
|
|
@ -28,6 +28,8 @@ public class AcmeServletClient extends HttpServlet {
|
|||
private boolean caching;
|
||||
private boolean debug;
|
||||
|
||||
static final byte HTTP_GET = 0;
|
||||
static final byte HTTP_POST = 1;
|
||||
|
||||
public AcmeServletClient (Application app) {
|
||||
this.app = app;
|
||||
|
@ -39,27 +41,22 @@ public class AcmeServletClient extends HttpServlet {
|
|||
// do nothing
|
||||
}
|
||||
|
||||
public void service (HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
execute (request, response);
|
||||
}
|
||||
|
||||
public void doGet (HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
execute (request, response);
|
||||
execute (request, response, HTTP_GET);
|
||||
}
|
||||
|
||||
public void doPost (HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
execute (request, response);
|
||||
execute (request, response, HTTP_POST);
|
||||
}
|
||||
|
||||
|
||||
private void execute (HttpServletRequest request, HttpServletResponse response) {
|
||||
private void execute (HttpServletRequest request, HttpServletResponse response, byte method) {
|
||||
String protocol = request.getProtocol ();
|
||||
Cookie[] cookies = request.getCookies();
|
||||
try {
|
||||
RequestTrans reqtrans = new RequestTrans ();
|
||||
RequestTrans reqtrans = new RequestTrans (method);
|
||||
|
||||
// HACK - sessions not fully supported in Acme.Serve
|
||||
// Thats ok, we dont need the session object, just the id.
|
||||
reqtrans.session = request.getRequestedSessionId();
|
||||
|
|
Loading…
Add table
Reference in a new issue