From ad26a0d39e1345694b50f53550968e1c22004689 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 23 Jan 2012 22:32:45 +0000 Subject: [PATCH] add a system property to configure lab js cache for script loading: true in dev env git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1235041 13f79535-47bb-0310-9956-ffa450edef68 --- .../rest/api/services/CommonServices.java | 6 ++ .../rest/services/DefaultCommonServices.java | 5 ++ .../web/runtime/ArchivaRuntimeInfo.java | 14 +++ .../archiva-web/archiva-webapp-js/pom.xml | 4 + .../src/main/webapp/index.html | 89 ++++++++++--------- .../archiva-webapp-test-js/pom.xml | 1 + 6 files changed, 77 insertions(+), 42 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java index 28077b037..98d30651b 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java @@ -59,4 +59,10 @@ public interface CommonServices */ String getAllI18nResources( @QueryParam( "locale" ) String locale ) throws ArchivaRestServiceException; + + @Path( "devMode" ) + @GET + @Produces( { MediaType.TEXT_PLAIN } ) + @RedbackAuthorization( noRestriction = true ) + Boolean devMode(); } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java index 33737feb5..4404593b3 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java @@ -168,4 +168,9 @@ public class DefaultCommonServices IOUtils.closeQuietly( inputStream ); } } + + public Boolean devMode() + { + return Boolean.getBoolean( "archiva.devMode" ); + } } diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/runtime/ArchivaRuntimeInfo.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/runtime/ArchivaRuntimeInfo.java index 23f013ba0..8f2932c8e 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/runtime/ArchivaRuntimeInfo.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/runtime/ArchivaRuntimeInfo.java @@ -39,6 +39,8 @@ public class ArchivaRuntimeInfo private long timestamp; + private boolean devMode; + @Inject public ArchivaRuntimeInfo( @Named( value = "archivaRuntimeProperties" ) Properties archivaRuntimeProperties ) @@ -46,6 +48,7 @@ public class ArchivaRuntimeInfo this.version = (String) archivaRuntimeProperties.get( "archiva.version" ); this.buildNumber = (String) archivaRuntimeProperties.get( "archiva.buildNumber" ); this.timestamp = NumberUtils.createLong( (String) archivaRuntimeProperties.get( "archiva.timestamp" ) ); + this.devMode = Boolean.getBoolean( "archiva.devMode" ); } public String getVersion() @@ -78,6 +81,16 @@ public class ArchivaRuntimeInfo this.timestamp = timestamp; } + public boolean isDevMode() + { + return devMode; + } + + public void setDevMode( boolean devMode ) + { + this.devMode = devMode; + } + @Override public String toString() { @@ -86,6 +99,7 @@ public class ArchivaRuntimeInfo sb.append( "{version='" ).append( version ).append( '\'' ); sb.append( ", buildNumber='" ).append( buildNumber ).append( '\'' ); sb.append( ", timestamp=" ).append( timestamp ); + sb.append( ", devMode=" ).append( devMode ); sb.append( '}' ); return sb.toString(); } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/pom.xml b/archiva-modules/archiva-web/archiva-webapp-js/pom.xml index 31197f5e8..3c48fbf88 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-js/pom.xml @@ -34,6 +34,7 @@ ${basedir}/src/test/tomcat/tomcat-context.xml 9091 /archiva + true @@ -544,6 +545,7 @@ ${basedir}/target/auto-admin-creation.properties ${project.build.directory} ${project.build.directory}/appserver-base/conf/archiva.xml + ${archiva.devMode} @@ -576,6 +578,7 @@ ${project.build.directory} ${project.build.directory}/appserver-base/conf/archiva.xml + ${archiva.devMode} @@ -606,6 +609,7 @@ ${basedir}/target/auto-admin-creation.properties ${project.build.directory} ${project.build.directory}/appserver-base/conf/archiva.xml + ${archiva.devMode} diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html index 588fb81c0..3f179e425 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html @@ -40,48 +40,53 @@ diff --git a/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml index 0ae4a7538..a606a527a 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test-js/pom.xml @@ -351,6 +351,7 @@ ${project.build.directory}/appserver-base ${project.build.directory}/appserver-base ${project.build.directory} + true src/test/${container.name}/Catalina/localhost/archiva.xml true