dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20488
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9363: path fixes to mobile (wip)
------------------------------------------------------------
revno: 9363
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-12-19 12:05:00 +0100
message:
path fixes to mobile (wip)
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java
dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java
dhis-2/dhis-web/dhis-web-mobile/src/main/resources/dhis-mobile-manifest.appcache
dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm
--
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-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java 2012-11-04 13:30:04 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/ContextUtils.java 2012-12-19 11:05:00 +0000
@@ -71,7 +71,7 @@
public static final String HEADER_CONTENT_DISPOSITION = "Content-Disposition";
public static final String HEADER_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
public static final String HEADER_LOCATION = "Location";
-
+
@Autowired
private SystemSettingManager systemSettingManager;
@@ -88,9 +88,9 @@
{
configureResponse( response, contentType, cacheStrategy, null, false );
}
-
+
public void configureResponse( HttpServletResponse response, String contentType, CacheStrategy cacheStrategy,
- String filename, boolean attachment )
+ String filename, boolean attachment )
{
if ( contentType != null )
{
@@ -118,9 +118,9 @@
{
Calendar cal = Calendar.getInstance();
cal.add( Calendar.HOUR_OF_DAY, 1 );
-
+
response.setHeader( HEADER_CACHE_CONTROL, "public, max-age=3600" );
- response.setHeader( HEADER_EXPIRES, DateUtils.getHttpDateString( cal.getTime() ) );
+ response.setHeader( HEADER_EXPIRES, DateUtils.getHttpDateString( cal.getTime() ) );
}
else if ( cacheStrategy.equals( CacheStrategy.CACHE_6AM_TOMORROW ) )
{
@@ -148,17 +148,17 @@
{
setResponse( response, HttpServletResponse.SC_OK, message );
}
-
+
public static void createdResponse( HttpServletResponse response, String message, String location )
{
if ( location != null )
{
response.addHeader( HEADER_LOCATION, location );
}
-
+
setResponse( response, HttpServletResponse.SC_CREATED, message );
}
-
+
public static void notFoundResponse( HttpServletResponse response, String message )
{
setResponse( response, HttpServletResponse.SC_NOT_FOUND, message );
@@ -173,7 +173,7 @@
{
setResponse( response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message );
}
-
+
private static void setResponse( HttpServletResponse response, int statusCode, String message )
{
response.setStatus( statusCode );
@@ -184,7 +184,7 @@
PrintWriter writer = response.getWriter();
writer.println( message );
writer.flush();
- }
+ }
catch ( IOException ex )
{
// Ignore
@@ -235,7 +235,7 @@
try
{
port = Integer.parseInt( xForwardedPort );
- }
+ }
catch ( NumberFormatException e )
{
port = request.getServerPort();
@@ -250,11 +250,12 @@
return builder.toString();
}
-
+
public static String getRootPath( HttpServletRequest request )
{
StringBuilder builder = new StringBuilder( getContextPath( request ) );
builder.append( request.getServletPath() );
+
return builder.toString();
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java 2012-12-04 23:23:28 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/java/org/hisp/dhis/web/mobile/controller/MobileController.java 2012-12-19 11:05:00 +0000
@@ -46,84 +46,85 @@
@Controller
public class MobileController
{
- @RequestMapping( value = "/mobile" )
+ @RequestMapping(value = "/mobile")
public String base()
{
return "redirect:/mobile/index";
}
- @RequestMapping( value = "/" )
+ @RequestMapping(value = "/")
public String baseWithSlash()
{
return "redirect:/mobile/index";
}
- @RequestMapping( value = "/index" )
+ @RequestMapping(value = "/index")
public String index( Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
+ // model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
+ model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
model.addAttribute( "page", "index.vm" );
return "base";
}
- @RequestMapping( value = "/messages" )
+ @RequestMapping(value = "/messages")
public String messages( Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
+ model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
model.addAttribute( "page", "messages.vm" );
return "base";
}
- @RequestMapping( value = "/messages/new-message" )
+ @RequestMapping(value = "/messages/new-message")
public String newMessage( Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
+ model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
model.addAttribute( "page", "new-message.vm" );
return "base";
}
- @RequestMapping( value = "/messages/{uid}" )
- public String message( @PathVariable( "uid" ) String uid, Model model, HttpServletRequest request )
+ @RequestMapping(value = "/messages/{uid}")
+ public String message( @PathVariable("uid") String uid, Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
+ model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
model.addAttribute( "page", "message.vm" );
model.addAttribute( "messageId", uid );
return "base";
}
- @RequestMapping( value = "/interpretations" )
+ @RequestMapping(value = "/interpretations")
public String interpretations( Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
+ model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
model.addAttribute( "page", "interpretations.vm" );
return "base";
}
- @RequestMapping( value = "/user-account" )
+ @RequestMapping(value = "/user-account")
public String settings( Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
+ model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
model.addAttribute( "page", "user-account.vm" );
return "base";
}
- @RequestMapping( value = "/data-entry" )
+ @RequestMapping(value = "/data-entry")
public String dataEntry( Model model, HttpServletRequest request )
{
- model.addAttribute( "baseUrl", ContextUtils.getRootPath( request ) );
+ model.addAttribute( "baseUrl", request.getContextPath() + request.getServletPath() );
model.addAttribute( "page", "data-entry.vm" );
return "base";
}
- @RequestMapping( value = "/app-cache" )
+ @RequestMapping(value = "/app-cache")
public void appCache( HttpServletResponse response ) throws IOException
{
response.setContentType( "text/cache-manifest" );
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/resources/dhis-mobile-manifest.appcache'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/resources/dhis-mobile-manifest.appcache 2012-11-26 18:11:17 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/resources/dhis-mobile-manifest.appcache 2012-12-19 11:05:00 +0000
@@ -1,5 +1,5 @@
CACHE MANIFEST
-# Version: 2.11-SNAPSHOT V5
+# Version: 2.11-SNAPSHOT V6
CACHE:
../mobile/index
=== modified file 'dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm'
--- dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm 2012-12-04 23:23:28 +0000
+++ dhis-2/dhis-web/dhis-web-mobile/src/main/webapp/WEB-INF/dhis-web-mobile-velocity/base.vm 2012-12-19 11:05:00 +0000
@@ -1,6 +1,6 @@
<!DOCTYPE html>
-<html manifest="$baseUrl/app-cache">
-<!-- <html> -->
+<!-- <html manifest="$baseUrl/app-cache"> -->
+<html>
<head>
<title>DHIS 2</title>
@@ -9,7 +9,7 @@
<link rel="stylesheet" href="$baseUrl/../dhis-web-mobile-resources/css/jquery.mobile.min.css?v=1.2.0" />
- <script src="$baseUrl/../dhis-web-commons/javascripts/jQuery/jquery.min.js?v=1.7.1"></script>
+ <script src="$baseUrl/../dhis-web-commons/javascripts/jQuery/jquery.min.js?v=1.8.2"></script>
<script src="$baseUrl/../dhis-web-commons/javascripts/dhis2/dhis2.util.js"></script>
<script src="$baseUrl/../dhis-web-commons/javascripts/dhis2/dhis2.array.js"></script>
<script src="$baseUrl/../dhis-web-mobile-resources/js/underscore.min.js?v=1.3.3"></script>