[stringtemplate-interest] url rewriting and session management
Harry
harry.karadimas at hmn.aphp.fr
Tue Sep 11 01:17:23 PDT 2007
> I did not fully understand this point
> "As this renderer must be attributed "on the fly", I have to
> duplicate the stringtemplate instance first"
The idea is that requests are processed in parallel in a web server
(I use Tomcat, but others are the same I guess), so if I take a
template instance globally I might set the response attribute of
another page into st by mistake. Locking would be another solution,
but I found that duplicating the template using .getInstance() is
a viable solution.
I think however that when running objects like templates that are
"expensive" to parse (although in st it's quite fast ;-) those
objects should be reusable concurrently; the variable part(s) should
reside outside the template, so we should be able to put some
variable parts in the call to the rendering, rather than making
them part of the template, something like
.writeUsing(context), this would be more efficient than cloning
to reuse template concurrently.
What do you think ?
Best regards,
Harry Karadimas
______________________________________________________________________
Dr Harry Karadimas Medecin Ingenieur
resp. Recherche et Developpement, Administration Wintel
Departement d'Information Hospitalier (DIH)
C.H.U. Albert Chenevier - Henri Mondor
51, av. du Marechal de Lattre de Tassigny 94010 CRETEIL
tel : (00 33 1) 49 81 21 79 fax : (00 33 1) 49 81 27 08
secr.: (00 33 1) 49 81 23 82 m.el.:harry.karadimas at hmn.aphp.fr
> -----Message d'origine-----
> De : John Snyders
> Envoyé : mardi 11 septembre 2007 05:16
> À : Harry
> Objet : Re: [stringtemplate-interest] url rewriting and
> session management
>
> I think you have the right solution.
>
> I did not fully understand this point
> "As this renderer must be attributed "on the fly", I have to
> duplicate the stringtemplate instance first"
>
> The new format option could also be used but URL rewriting is
> a case where it must always be done and is not something that
> the view template should have control over. So using a
> renderer is the right thing to do.
>
> -John
>
>
> ---- Original message ----
> >Date: Mon, 10 Sep 2007 11:22:07 +0200
> >From: Harry <harry.karadimas at hmn.aphp.fr>
> >Subject: [stringtemplate-interest] url rewriting and session
> management
> >To: stringtemplate-interest at antlr.org
> >
> >Hi,
> >I have a question about URL rewriting and session management in st.
> >When a user turns off cookie management (some of our users
> do that), the
> >servlet containers
> >switch to "url rewrite" mode to maintain session across web
> page submissions.
> >(see for more information the method encodeURL here :
> >http://java.sun.com/products/servlet/2.3/javadoc/javax/servle
> t/http/HttpServlet
> >Response.html#encodeURL(java.lang.String))
> >The official servlet doc says that
> >"For robust session tracking, all URLs emitted by a servlet
> should be run
> >through this method"
> >which as far as I can see is not always the case in st if we
> insert a simple
> >attribute with a link.
> >My method is a bit cumbersome, but it works :
> >
> >* I have a renderer for java.lang.String, that escapes HTML
> special chars ('<',
> >'>', '&')
> >* Links are of a special type (e.g. "HtmlLink")
> >* I register a specialized renderer with the stringtemplate
> instance, this
> >renderer uses the response object to call "encodeURL" to
> render correctly
> >objects of type "HtmlLink"
> >* As this renderer must be attributed "on the fly", I have
> to duplicate the
> >stringtemplate instance first
> >
> >Did you have the same concerns ? Is there a more elegant way
> to do it ?
> >
> >Best regards,
> >
> > Harry
> Karadimas
> >_____________________________________________________________
> _________
> >Dr Harry Karadimas Medecin Ingenieur
> >resp. Recherche et Developpement, Administration Wintel
> >Departement d'Information Hospitalier (DIH)
> >C.H.U. Albert Chenevier - Henri Mondor
> >51, av. du Marechal de Lattre de Tassigny
> 94010 CRETEIL
> >tel : (00 33 1) 49 81 21 79 fax : (00 33 1)
> 49 81 27 08
> >secr.: (00 33 1) 49 81 23 82
> m.el.:harry.karadimas at hmn.aphp.fr
> >
> >
> >_______________________________________________
> >stringtemplate-interest mailing list
> >stringtemplate-interest at antlr.org
> >http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>
>
More information about the stringtemplate-interest
mailing list