=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/App.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/App.java 2013-12-14 13:17:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/App.java 2014-01-07 16:37:30 +0000 @@ -95,22 +95,25 @@ @JsonProperty private String description; + @JsonProperty private AppIcons icons; + @JsonProperty private AppDeveloper developer; @JsonIgnore private String locales; - @JsonIgnore + @JsonProperty private String permissions; + @JsonProperty private AppActivities activities; - @JsonIgnore + @JsonProperty private String folderName; - @JsonIgnore + @JsonProperty private String baseUrl; // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppDeveloper.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppDeveloper.java 2013-08-23 15:56:19 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/appmanager/AppDeveloper.java 2014-01-07 16:37:30 +0000 @@ -27,6 +27,8 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import com.fasterxml.jackson.annotation.JsonProperty; + import java.io.Serializable; /** @@ -43,15 +45,19 @@ /** * Required. */ + @JsonProperty private String url; /** * Optional. */ + @JsonProperty private String name; + @JsonProperty private String company; + @JsonProperty private String email; // ------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AppController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AppController.java 2014-01-07 13:11:40 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/AppController.java 2014-01-07 16:37:30 +0000 @@ -28,7 +28,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -import com.fasterxml.jackson.core.type.TypeReference; import com.google.common.collect.Lists; import org.hisp.dhis.api.controller.exception.NotFoundException; import org.hisp.dhis.api.utils.ContextUtils; @@ -55,9 +54,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * @author Lars Helge Overland @@ -90,11 +87,7 @@ File tempFile = File.createTempFile( "IMPORT_", "_ZIP" ); file.transferTo( tempFile ); - StringBuffer fullUrl = request.getRequestURL(); - String baseUrl = org.hisp.dhis.util.ContextUtils.getBaseUrl( request ); - String rootPath = fullUrl.substring( 0, fullUrl.indexOf( "/", baseUrl.length() ) ); - - appManager.installApp( tempFile, file.getOriginalFilename(), rootPath ); + appManager.installApp( tempFile, file.getOriginalFilename(), getBaseUrl( request ) ); } @RequestMapping( value = RESOURCE_PATH, method = RequestMethod.PUT ) @@ -121,18 +114,25 @@ throw new NotFoundException(); } - Map manifestMap = JacksonUtils.getJsonMapper().readValue( manifest.getInputStream(), new TypeReference>() - { - } ); - - String defaultPage = (String) manifestMap.get( "launch_path" ); + App application = JacksonUtils.getJsonMapper().readValue( manifest.getInputStream(), App.class ); String pageName = findPage( request.getPathInfo(), app ); + // if request was for manifest.webapp, check for * and replace with host + if ( "manifest.webapp".equals( pageName ) ) + { + if ( "*".equals( application.getActivities().getDhis().getHref() ) ) + { + application.getActivities().getDhis().setHref( getBaseUrl( request ) ); + JacksonUtils.getJsonMapper().writeValue( response.getOutputStream(), application ); + return; + } + } + Resource page = findResource( locations, pageName ); if ( page == null ) { - page = findResource( locations, defaultPage ); + page = findResource( locations, application.getLaunchPath() ); if ( page == null ) { @@ -191,4 +191,10 @@ return path; } + + private String getBaseUrl( HttpServletRequest request ) + { + String baseUrl = org.hisp.dhis.util.ContextUtils.getBaseUrl( request ); + return baseUrl.substring( 0, baseUrl.length() - 1 ); + } }