costin 02/04/08 15:56:22 Modified: coyote/src/java/org/apache/coyote Request.java Response.java Log: Allow Request to send callbacks - for lazy-evaluated attributes, and hopefully to request more data. Pass the Response/Request as the second param to Action - this allows stateless implementation of the hooks ( all this will be much cleaner when/if we move to generic Ctx ). Revision Changes Path 1.12 +14 -0 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java Index: Request.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Request.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Request.java 8 Apr 2002 22:03:08 -0000 1.11 +++ Request.java 8 Apr 2002 22:56:22 -0000 1.12 @@ -183,6 +183,7 @@ private Hashtable attributes=new Hashtable(); private Response response; + private ActionHook hook; // ------------------------------------------------------------- Properties @@ -354,8 +355,21 @@ public void setResponse( Response response ) { this.response=response; + response.setRequest( this ); } + public void action(ActionCode actionCode, Object param) { + if( hook==null && response!=null ) + hook=response.getHook(); + + if (hook != null) { + if( param==null ) + hook.action(actionCode, this); + else + hook.action(actionCode, param); + } + } + // -------------------- Cookies -------------------- 1.9 +16 -4 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java Index: Response.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Response.java 15 Mar 2002 19:07:35 -0000 1.8 +++ Response.java 8 Apr 2002 22:56:22 -0000 1.9 @@ -155,9 +155,17 @@ */ protected String errorURI = null; + protected Request req; // ------------------------------------------------------------- Properties + public Request getRequest() { + return req; + } + + public void setRequest( Request req ) { + this.req=req; + } public OutputBuffer getOutputBuffer() { return outputBuffer; @@ -202,7 +210,10 @@ public void action(ActionCode actionCode, Object param) { if (hook != null) { - hook.action(actionCode, param); + if( param==null ) + hook.action(actionCode, this); + else + hook.action(actionCode, param); } } @@ -317,17 +328,17 @@ throw new IllegalStateException(); } - action(ActionCode.ACTION_RESET, null); + action(ActionCode.ACTION_RESET, this); } public void finish() throws IOException { - action(ActionCode.ACTION_CLOSE, null); + action(ActionCode.ACTION_CLOSE, this); } public void acknowledge() throws IOException { - action(ActionCode.ACTION_ACK, null); + action(ActionCode.ACTION_ACK, this); } @@ -392,6 +403,7 @@ * interceptors to fix headers. */ public void sendHeaders() throws IOException { + // XXX This code doesn't send any notification :-) commited = true; }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>