shuber 2005/12/16 16:04:11 CET
Modified files:
core/src/java/org/jahia/bin Jahia.java
Log:
Fix redirect loop.
Revision Changes Path
1.40 +23 -11 jahia/core/src/java/org/jahia/bin/Jahia.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/bin/Jahia.java.diff?r1=1.39&r2=1.40&f=h
Index: Jahia.java
===================================================================
RCS file: /home/cvs/repository/jahia/core/src/java/org/jahia/bin/Jahia.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- Jahia.java 2 Dec 2005 14:10:31 -0000 1.39
+++ Jahia.java 16 Dec 2005 15:04:10 -0000 1.40
@@ -1,4 +1,4 @@
-// $Id: Jahia.java,v 1.39 2005/12/02 14:10:31 shuber Exp $
+// $Id: Jahia.java,v 1.40 2005/12/16 15:04:10 shuber Exp $
//
// ____.
// __/\ ______| |__/\. _______
@@ -436,7 +436,7 @@
// Initialize all the registered services.
try {
ConnectionDispenser.init(Jahia.jSettings);
-
+
JahiaMBeanServer.getInstance().init(getSettings());
if (initServicesRegistry()) {
try {
@@ -895,7 +895,19 @@
JahiaSite site = (JahiaSite)
request.getSession().getAttribute("org.jahia.services.sites.jahiasite");
if (site != null && requestURI.indexOf("/op/edit") > 0) {
try {
-
response.sendRedirect(requestURI.replaceAll("/pid/[0-9]+","/pid/"+site.getHomePageID()));
+ // String redirectURL =
requestURI.replaceAll("/pid/[0-9]+","/pid/"+site.getHomePageID());
+ String redirectURL = requestURI;
+ int pidPos = requestURI.indexOf("/pid/");
+ if (pidPos != -1) {
+ // found PID in URL, let's replace it's value.
+ int nextSlashPos = requestURI.indexOf("/", pidPos +
"/pid/".length());
+ if (nextSlashPos == -1) {
+ redirectURL = requestURI.substring(0, pidPos) +
"/pid/"+site.getHomePageID();
+ } else {
+ redirectURL = requestURI.substring(0, pidPos) +
"/pid/"+site.getHomePageID() + requestURI.substring(nextSlashPos);
+ }
+ }
+ response.sendRedirect(redirectURL);
} catch (IOException e) {
logger.error("error during redirection to homepage",e);
}
@@ -990,7 +1002,7 @@
logger.debug("Cookie domain=[" + curCookie.getDomain() +
"] path=[" + curCookie.getPath() +
"] name=[" + curCookie.getName() +
- "] value=[" + curCookie.getValue() + "]");
+ "] value=[" + curCookie.getValue() + "]");
}
}
} else {
@@ -1279,7 +1291,7 @@
* @return byte[] lock, the lock or null if the lock is not available.
*/
public static synchronized byte[] getLock (final JahiaUser user,
- final HttpSession session)
+ final HttpSession session)
throws JahiaException {
if (!isInitiated()) {
@@ -1590,18 +1602,18 @@
// BEGIN [added by Pascal Aubry for CAS authentication]
/**
- * Tell if Jahia is using Single Sign-On for authentication.
- * @return true if SSO should be used, false otherwise.
+ * Tell if Jahia is using Single Sign-On for authentication.
+ * @return true if SSO should be used, false otherwise.
*/
static public boolean usesSso() {
- return authPipeline.hasValveOfClass(SsoValve.class);
+ return authPipeline.hasValveOfClass(SsoValve.class);
}
/**
- * Return the (first) SSO valve.
- * @return a SsoValve instance, or null if none.
+ * Return the (first) SSO valve.
+ * @return a SsoValve instance, or null if none.
*/
static public SsoValve getSsoValve() {
- return (SsoValve) authPipeline.getFirstValveOfClass(SsoValve.class);
+ return (SsoValve) authPipeline.getFirstValveOfClass(SsoValve.class);
}
// END [added by Pascal Aubry for CAS authentication]