|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Issue about UrlRewritterHi, 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 } } public
class BasePO implements HttpPresentation { … private
void writePage(Page page, HttpPresentationComms comms) { … 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
-- You receive this message as a subscriber of the enhydra@... mailing list. To unsubscribe: mailto:enhydra-unsubscribe@... For general help: mailto:sympa@...?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
|||
|
|
RE: Issue about UrlRewritterHi, 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@...] 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
} } public
class BasePO implements HttpPresentation {
…
private void writePage(Page page, HttpPresentationComms comms) { … 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
-- You receive this message as a subscriber of the enhydra@... mailing list. To unsubscribe: mailto:enhydra-unsubscribe@... For general help: mailto:sympa@...?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
| Free embeddable forum powered by Nabble | Forum Help |