dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15403
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5578: (mobile) possible fix for external redirect warnings on older nokia
------------------------------------------------------------
revno: 5578
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-12-23 12:57:22 +0100
message:
(mobile) possible fix for external redirect warnings on older nokia
modified:
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/MappedRedirectStrategy.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/MappedRedirectStrategy.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/MappedRedirectStrategy.java 2011-12-23 09:51:09 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/security/MappedRedirectStrategy.java 2011-12-23 11:57:22 +0000
@@ -27,6 +27,8 @@
package org.hisp.dhis.security;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.springframework.mobile.device.Device;
import org.springframework.mobile.device.DeviceResolver;
import org.springframework.security.web.DefaultRedirectStrategy;
@@ -43,6 +45,8 @@
public class MappedRedirectStrategy
extends DefaultRedirectStrategy
{
+ private static final Log log = LogFactory.getLog( MappedRedirectStrategy.class );
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -91,26 +95,11 @@
//
// url = request.getHeader( "referer" ).replaceFirst( "/dhis-web-commons/security/login.action",
// "/mobile/index.action" );
- url = getRootPath( request ) + "/mobile/index.action";
+ url = request.getContextPath() + "/mobile/index.action";
}
+ log.warn( "Redirecting to " + url );
+
super.sendRedirect( request, response, url );
}
-
- public static String getRootPath( HttpServletRequest request )
- {
- StringBuilder builder = new StringBuilder();
- builder.append( request.getScheme() );
-
- builder.append( "://" ).append( request.getServerName() );
-
- if ( request.getServerPort() != 80 && request.getServerPort() != 443 )
- {
- builder.append( ":" ).append( request.getServerPort() );
- }
-
- builder.append( request.getContextPath() );
-
- return builder.toString();
- }
}