> > -----Original Message----- > From: Sylvain Wallez [mailto:[EMAIL PROTECTED] > Sent: maandag 17 november 2003 17:08 > To: [EMAIL PROTECTED] > > [EMAIL PROTECTED] wrote: > > >unico 2003/11/14 10:58:18 > > > > Modified: > src/java/org/apache/cocoon/components/flow/javascript/fom > > FOM_Cocoon.java > > Log: > > add cocoon.sendStatus and cocoon.response.setStatus methods to FOM > > > > > > <snip/> > > > + > > + public void jsFunction_setStatus(int sc) { > > + if (response instanceof HttpResponse) { > > + ((HttpResponse) response).setStatus(sc); > > + } > > + } > > + > > > > > > Why do we need a setStatus() on the response in the flow? > > Setting the status should IMO be available only by sending an > empty response with redirector.sendStatus(), or through the > "status-code" > attribute on <map:read> and <map:serialize>. >
The status-code attribute on map:read and map:serialize aren't variable-resolved. So doing something like: flow.js: function doSomething() { var status = helper.doIt(); sendPage("done/"+status,null); } sitemap.js: <map:match pattern="done/*"> <map:generate src=".." /> <map:serialize status-code="{1}" /> </map:match> Will not work. Instead, now we can do: flow.js function doSomething() { response.setStatus(helper.doIt()); sendPage("done",null); } sitemap.js: <map:match pattern="done"> <map:generate src=".." /> <map:serialize /> </map:match> > Moreover, this introduces a dependency on the http > environment, which isn't good. Yeah, that sucks. Unico