« Return to Thread: Issue about UrlRewritter
Hi,
Thank you for the contribution! We’ll
include it in next TAF (EAF) release.
NOTE: we’ve already updated
public CVS repository.
Sorry for any possible inconvenience
we’ve caused!
Slobodan Vujasinovic
---------------------------------
PROZONE d.o.o.
21000 Novi Sad
Dunavska 13
tel: +381-21-4720-200
fax: +381-21-451-216
mobile: +381-63-1073-978
email:
slobodan.vujasinovic@...
web: www.prozone.co.yu
---------------------------------
From: Luís Oliveira
[mailto:loliveira@...]
Sent: Thursday, 27 December, 2007 14:11
To: enhydra@...
Cc: 'Luis Leite'; José Gonçalves
Subject: [enhydra] Issue about UrlRewritter
Hi,
In my Enhydra Apps, I used to create a class MyUrlRewriter
that implements the Interface org.enhydra.xml.io. URLRewriter.
In this class, I override the method rewriteURL according to the needs of each
application. Then, before calling method comms.response.writeDOM (to write the
pages to the socket), I used to call the method options.setURLRewriter in which
the parameter is my own URL Rewriter.
Resuming:
public
class MyUrlRewriter implements org.enhydra.xml.io. URLRewriter
{
…
public String rewriteURL(String originalUrl) {
//app specific logic for URLs
//call the Enhydra Rewritter to the url already
changed above
_enhydraURLRewriter.rewriteURL(urlRewritten);
}
}
public
class BasePO implements HttpPresentation
{
…
private void writePage(Page page, HttpPresentationComms comms) {
…
XMLObject document = page.getDocument();
OutputOptions options
= this.getComms().response.createOutputOptions(document);
MyUrlWriter
urlRewriter = new MyUrlWriter(…);
options.setURLRewriter(urlRewriter); //choosing my own URL
Rewritter instead of Enhydra URL Rewritter
…
}
}
Besides, in web.xml file, the key
SessionManager/EncodeUrlState has value “Auto” (to let Enhydra
encode session in URL when needed).
The problem is that in the 7.2 version of Enhydra, the
method writeDOM of class com.lutris.appserver.server.httpPresentation.servlet.
ServletHttpPresentationResponse was changed to:
public void
writeDOM(OutputOptions outputOptions, Node document) throws
HttpPresentationException
{
try
{
// Copy options so as to not modify when changing encoding.
OutputOptions options = new OutputOptions(outputOptions);
setupEncoding(document, options);
if (options.getMIMEType() != null && options.getMIMEType().equals("text/html"))
options.addFreeformOption(org.enhydra.util.DOMFormatter.FORMATTER_NAME, new
ExtHTMLFormatter(document, options, true));
else
options.addFreeformOption(org.enhydra.util.DOMFormatter.FORMATTER_NAME,
new ExtXMLFormatter(document, options, true));
//
Enable encoding of session id in URL, if needed.
boolean encodeSessionKey = shouldEncodeSessionKey();
if (encodeSessionKey)
{
options.setURLRewriter(new URLRewriter()
{
public String rewriteURL(String urlAttrValue)
…
The problem is that if Enhydra needs to encode session, the
class ServletHttpPresentationResponse creates a new instance of UrlRewritter,
discarding the URL Rewritter I had set.
I suggest to create a new instance of UrlRewitter only if we
need to encode session and there’s no one. So, I suggest to change the
line
if (encodeSessionKey)
to this one:
if (encodeSessionKey && options.getURLRewriter() ==
null)
Do you agree with this solution? There’s anyone better
?
Best Regards
Luis Oliveira
|
LUIS OLIVEIRA |
SOFTWARE ENGINEER
|
|
|
|
_______________________________________________________________ | THE MAGIC OF MOBILITY CONFIDENTIALITY NOTICE:
This message, as well as existing attached files, is confidential and
intended exclusively for the individual(s) named as addressees. If you are
not the intended recipient, you are kindly requested not to make any use
whatsoever of its contents and to proceed to the destruction of the message,
thereby notifying the sender. |
« Return to Thread: Issue about UrlRewritter
| Free embeddable forum powered by Nabble | Forum Help |