dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40653
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20652: Static content. Taking context path into account.
------------------------------------------------------------
revno: 20652
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-10-12 19:55:30 +0200
message:
Static content. Taking context path into account.
modified:
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/StaticContentController.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.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/webapi/controller/StaticContentController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/StaticContentController.java 2015-10-12 17:30:45 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/StaticContentController.java 2015-10-12 17:55:30 +0000
@@ -33,6 +33,7 @@
import java.io.InputStream;
import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
@@ -90,10 +91,9 @@
*/
@RequestMapping( value = "/{key}", method = RequestMethod.GET )
public void getStaticContent(
- @PathVariable( "key" ) String key, HttpServletResponse response )
+ @PathVariable( "key" ) String key, HttpServletRequest request, HttpServletResponse response )
throws WebMessageException
{
-
if ( !KEY_WHITELIST_MAP.containsKey( key ) )
{
throw new WebMessageException( WebMessageUtils.notFound( "Key does not exist." ) );
@@ -105,7 +105,7 @@
{
try
{
- response.sendRedirect( getDefaultLogoUrl( key ) );
+ response.sendRedirect( getDefaultLogoUrl( request, key ) );
}
catch ( IOException e )
{
@@ -203,18 +203,18 @@
* @param key the key associated with the logo or null if the key does not exist.
* @return the relative url of the logo.
*/
- private String getDefaultLogoUrl( String key )
+ private String getDefaultLogoUrl( HttpServletRequest request, String key )
{
- String relativeUrlToImage = null;
+ String relativeUrlToImage = request.getContextPath();
if ( key.equals( LOGO_BANNER ) )
{
- relativeUrlToImage = "/dhis-web-commons/css/" + styleManager.getCurrentStyleDirectory() + "/logo_banner.png";
+ relativeUrlToImage += "/dhis-web-commons/css/" + styleManager.getCurrentStyleDirectory() + "/logo_banner.png";
}
if ( key.equals( LOGO_FRONT ) )
{
- relativeUrlToImage = "/dhis-web-commons/security/logo_front.png";
+ relativeUrlToImage += "/dhis-web-commons/security/logo_front.png";
}
return relativeUrlToImage;
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm 2015-10-12 15:13:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm 2015-10-12 17:55:30 +0000
@@ -33,7 +33,7 @@
<div id="loginField">
<div id="loginArea">
<div id="bannerArea">
- <a href="http://www.dhis2.org"><img src="/api/staticContent/logo_front" style="border:none"></a>
+ <a href="http://www.dhis2.org"><img src="../../api/staticContent/logo_front" style="border:none"></a>
</div>
<form id="loginForm" action="../../dhis-web-commons-security/login.action" method="post">
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2015-10-12 15:13:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2015-10-12 17:55:30 +0000
@@ -104,7 +104,7 @@
</script>
</head>
- #set( $logoBanner = "/api/staticContent/logo_banner" )
+ #set( $logoBanner = "../api/staticContent/logo_banner" )
<body>
#parse( "macros.vm" )