Mail Archive Home | enhydra List | August 2004 Index
| <-- Date Index --> | <-- Thread Index --> |
V Po, 30. 08. 2004 v 21:27, Petr Stehlik píše: > V Po, 30. 08. 2004 v 18:20, Sinisa Milosevic píše: > > Enhydra Server maintenance release 5.1-15 has been published and can > > be downloaded from the ObjectWeb Forge at: > > http://forge.objectweb.org/project/showfiles.php?group_id=21 > > I've seen both my issues mentioned in the ChangeLog as fixed so let me > thank you a lot for your great support and development of Enhydra. Guys, you listed my fix in the ChangeLog but in fact it is not in the source code. That is weird. I am attaching it to this mail again. Please make sure to apply it. It does not change the default behaviour, it just makes the defaultUrl implementation clear. Thanks. Petr P.S. I just hope the rest of ChangeLog is real ;-)
--- /tmp/enhydra-5.1/modules/EnhydraAppManager/src/com/lutris/appserver/server/StandardApplication.java 2004-04-14 17:55:32.000000000 +0200
+++ modules/EnhydraAppManager/src/com/lutris/appserver/server/StandardApplication.java 2004-06-18 17:20:53.000000000 +0200
@@ -41,6 +41,7 @@
import org.enhydra.xml.xmlc.deferredparsing.XMLCDeferredParsingFactory;
import com.lutris.appserver.server.httpPresentation.ClientPageRedirectException;
+import com.lutris.appserver.server.httpPresentation.ServerPageRedirectException;
import com.lutris.appserver.server.httpPresentation.HttpPresentationComms;
import com.lutris.appserver.server.httpPresentation.HttpPresentationException;
import com.lutris.appserver.server.httpPresentation.HttpPresentationManager;
@@ -654,7 +655,6 @@
/**
* Remap / ---> "defaultUrl" if defined.
*/
- /*
if (defaultUrl != null) {
String ap = comms.request.getApplicationPath();
if (!ap.endsWith("/"))
@@ -663,50 +663,53 @@
if (!page.endsWith("/"))
page += "/";
if (page.equals(ap)) {
- String target="";
+ String target;
if (defaultUrl.startsWith("/")) {
target = defaultUrl.substring(1);
} else {
target = defaultUrl;
}
- // get query string and add it to target
- String query = comms.request.getQueryString();
- if (query != null) {
- target += "?" + query;
- }
- throw new ServerPageRedirectException(target);
- }
- }
-*/
- /**
- * Remap / ---> "defaultUrl" if defined.
- */
- if (defaultUrl != null) {
- String ap = comms.request.getApplicationPath();
- if (!ap.endsWith("/"))
- ap += "/";
- String page = comms.request.getPresentationObjectPath();
- if (!page.endsWith("/"))
- page += "/";
- if (page.equals(ap)) {
- // Don't want two slashes in a row.
- String target = comms.request.getHttpServletRequest().getContextPath();
- if (target.equals("/")) {
- target = "";
- }
- target = "";
-
- if (defaultUrl.startsWith("/")) {
- target += ap + defaultUrl.substring(1);
- } else {
- target += ap + defaultUrl;
- }
- // get query string and add it to target
- String query = comms.request.getQueryString();
- if (query != null) {
- target += "?" + query;
+ /*
+ * For redirecting to the defaultUrl we may use either
+ * Client- or Server- PageRedirectException.
+ * Each has its pros and cons:
+ *
+ * ClientPageRedirectException can redirect into a folder
+ * (when defaultUrl contains a path, not just page name)
+ * but it does not preserve information send in a POST
+ * request (output of a <form method="post" action="/">)
+ * Also ClientPageRedirect takes longer because it has
+ * to instruct client browser to go and load another page.
+ *
+ * ServerPageRedirectException does preserve the POST
+ * parameters but cannot redirect you to a subfolder
+ * safely because client's browser still points to
+ * the "/" URL. If you used relative URLs in the subfolder
+ * page and tried to go to a sibbling page it would fail
+ * (DiscRack demo is an example of an application that
+ * wouldn't work with the ServerPageRedirect).
+ *
+ * Neither solution is clearly superior so we stick with
+ * the ClientPageRedirectException mainly for backward
+ * compatibility. Be warned and don't try to send POST
+ * requests to your "/". Or edit the source line below
+ * and change the if (true) to (false). After rebuilding
+ * Enhydra you'll get the ServerPageRedirect.
+ *
+ * Comments or questions to Enhydra mailing list.
+ * Petr Stehlik on 2004/06/18.
+ */
+ if (true) {
+ // get query string and add it to target
+ String query = comms.request.getQueryString();
+ if (query != null) {
+ target += "?" + query;
+ }
+ throw new ClientPageRedirectException(target);
}
- throw new ClientPageRedirectException(target);
+ else {
+ throw new ServerPageRedirectException(target);
+ }
}
}
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.