Re: url rewriting with XMLC

Richard Kunze <[email protected]> Wed, 26 Nov 2003 11:52:56 +0100
Newsgroups gmane.comp.java.enhydra.xmlc
Organization Tivano Software GmbH
Message-ID <[email protected]>
On Tuesday 25 November 2003 23:30, Matthew Hixson wrote:
> Is it possible to put the jsessionid value into every <a> tag using XMLC?

Of course it is.

> Could one use XPath to somehow find all of the <a> tags and edit the href
> attribute?

No need - XMLC already has builtin support for this. 

Default behaviour is to automatically rewrite URLs when needed (i.e. when the 
HTTP session indicates that the client has cookies turned off), but you can 
change this by setting the <context-param> named "xmlcSessionURLEncoding" in 
web.xml to the values "always" (always rewrite URLs) or "never" (does the 
obvious thing as well :-) See the javadocs for 
org.enhydra.xml.xmlc.servlet.XMLCContext for details.

By default, URLs are rewritten by calling HttpServletResponse.encodeURL(). 
This should do the right thing in a servlet environment, but if you have 
special needs, you can set a special URL rewrite handler by calling 
OutputOptions.setURLRewriter() prior to writing the page.

Hope this helps,

Richard
-- 
Richard Kunze 

[ t]ivano Software, Bahnhofstr. 18, 63263 Neu-Isenburg
Tel.: +49 6102 80 99 07 - 0, Fax.: +49 6102 80 99 07 - 1
http://www.tivano.de
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQA/xIYI86Aqb3OZfF4RApsqAJkBrwVcV52kO9zZQrnHQT81VnthbwCgmzwd
nqkipX1RnRC/mAWg1bK6gg4=
=MN/E
-----END PGP SIGNATURE-----