[stringtemplate-interest] Multimethods

Terence Parr parrt at cs.usfca.edu
Thu Nov 13 10:31:35 PST 2008


On Nov 12, 2008, at 6:24 AM, Harry Karadimas wrote:

> Yes, except for one little nasty requirement of Java Servlets :  
> session
> encoding
> as a path parameter. If a user turns cookies off (which happens in our
> hospital, rather by mistake, but our mission - critical sites must
> continue to function), the Servlet container must append an url
> path parameter (which is different from a request parameter) named
> jsession_id. The requirement for java servlets is that every URL
> must be coded using response.encodeURL(String url).

Ah.  Perhaps then you simply need to pass in the session object to the  
template and then the link template can encode that in the URL.

> (see
> http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpServlet
> Response.html#encodeURL(java.lang.String)
> )
>
> That, unfortunately, is computation.

And definitely related to the controller not the view.

> And by design it gets very difficult
> to do in st. And coding every link in the controller makes things  
> really
> too tedious for the programmers, and too restrictive for the view  
> authors.

If you pass in session as an attribute than any template enclosed in  
your page can see that attribute through dynamic scoping. your  
template could be

blog_post(m,d,y) ::= "/y/m/d&sessionid=<session.ID>"

or whatever the field of the session is. would that work?

Ter


More information about the stringtemplate-interest mailing list