common request handling in our xsp?

"Gregor J. Rothfuss" <[email protected]> Mon, 31 Mar 2003 15:12:32 +0200
Newsgroups gmane.comp.cms.wyona.devel
Message-ID <[email protected]>
i noticed we do have an awful lot of code like the following in our
xsp:

String referer=request.getHeader("Referer");
Session session=request.getSession(true);
String status=request.getParameter("status");
//if(session.getAttribute("org.lenya.cms.cocoon.acting.ParentChildCreatorAct
ion.parent_uri") == null){
if(status == null){
session.setAttribute("org.lenya.cms.cocoon.acting.ParentChildCreatorAction.p
arent_uri",referer);
<xsp:content><referer><xsp:expr>referer</xsp:expr></referer></xsp:content>
}
else{
<xsp:content><referer><xsp:expr>session.getAttribute("org.lenya.cms.cocoon.a
cting.ParentChildCreatorAction.parent_uri")</xsp:expr></referer></xsp:conten
t>
if(status.equals("failed")){
<xsp:content><exception/></xsp:content>
}
}
Identity id=null;
String context=request.getContextPath();
String request_uri=request.getRequestURI();
String sitemap_uri=request.getSitemapURI();
String
prefix=request_uri.substring(0,request_uri.length()-sitemap_uri.length()-1);

it composes about 80% of all our xsp. bascially it is copied & pasted
code, with all its problems.

can't we derive all this from a common class / xsp, make the variables
available under standard names, and only have the differences in the
various xsp?

unifying this code would go a long way towards the much discussed
page envelope (sorry, discussion was offlist..)

-gregor