i was over protective for that point. I just didn't want to really throw away stuff But if there really is only one status code we could keep it in an int.
johan On 3/9/07, Jean-Baptiste Quenot <[EMAIL PROTECTED]> wrote:
* [EMAIL PROTECTED]: > Author: jcompagner > Date: Fri Mar 9 13:16:20 2007 > New Revision: 516552 > > URL: http://svn.apache.org/viewvc?view=rev&rev=516552 > Log: > also buffer setStatus so that it doesn't get send with the redirect but really only when te redirect is rendered > > Modified: > incubator/wicket/branches/wicket-1.x /wicket/src/main/java/wicket/protocol/http/BufferedHttpServletResponse.java > > Modified: incubator/wicket/branches/wicket-1.x /wicket/src/main/java/wicket/protocol/http/BufferedHttpServletResponse.java > URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/BufferedHttpServletResponse.java?view=diff&rev=516552&r1=516551&r2=516552 > ============================================================================== > --- incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/BufferedHttpServletResponse.java (original) > +++ incubator/wicket/branches/wicket-1.x/wicket/src/main/java/wicket/protocol/http/BufferedHttpServletResponse.java Fri Mar 9 13:16:20 2007 > @@ -54,6 +54,9 @@ > /** cookies list */ > private List cookies; > > + /** status list */ > + private List status; > + > /** headers map */ > private Map headers; > > @@ -282,7 +285,11 @@ > */ > public void setStatus(int sc) > { > - realResponse.setStatus(sc); > + if (status == null) > + { > + status = new ArrayList(2); > + } > + status.add(new Integer(sc)); > } > > /** > @@ -292,8 +299,7 @@ > */ > public void setStatus(int sc, String sm) > { > - isOpen(); > - realResponse.setStatus(sc, sm); > + throw new UnsupportedOperationException("not supported in tbe bufferd http response, use setStatus"); > } > > /** > @@ -506,6 +512,14 @@ > */ > public void writeTo(HttpServletResponse servletResponse) throws IOException > { > + if (status != null) > + { > + Iterator it = status.iterator(); > + while (it.hasNext()) > + { > + servletResponse.setStatus( ((Integer)it.next()).intValue()); > + } > + } > if (headers != null) > { > Iterator it = headers.entrySet().iterator(); > > Hi Johan, Is it really useful to put a List of status codes, whereas you call servletResponse.setStatus() for every status code? I would only keep one status code in the class. The last status that has been set wins. -- Jean-Baptiste Quenot aka John Banana Qwerty http://caraldi.com/jbq/
