]> source.dussan.org Git - archiva.git/commitdiff
javascript logging optionnal too
authorOlivier Lamy <olamy@apache.org>
Tue, 24 Jan 2012 18:23:38 +0000 (18:23 +0000)
committerOlivier Lamy <olamy@apache.org>
Tue, 24 Jan 2012 18:23:38 +0000 (18:23 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1235395 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/CommonServices.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultCommonServices.java
archiva-modules/archiva-web/archiva-webapp-js/pom.xml
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/index.html
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js

index 98d30651b2714dea3e9dc4c8e034408695732526..f2869be8610cfb85f60c703d4c5deee143b610ce 100644 (file)
@@ -18,6 +18,7 @@ package org.apache.archiva.rest.api.services;
  * under the License.
  */
 
+import org.apache.archiva.rest.api.model.ArchivaRuntimeInfo;
 import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
 
 import javax.ws.rs.GET;
@@ -60,9 +61,9 @@ public interface CommonServices
     String getAllI18nResources( @QueryParam( "locale" ) String locale )
         throws ArchivaRestServiceException;
 
-    @Path( "devMode" )
+    @Path( "archivaRuntimeInfo" )
     @GET
-    @Produces( { MediaType.TEXT_PLAIN } )
+    @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
     @RedbackAuthorization( noRestriction = true )
-    Boolean devMode();
+    ArchivaRuntimeInfo archivaRuntimeInfo();
 }
index 4404593b3de99eabff2c9de17adc98dd5ad01f80..c16440643f40ff0be2a3e5d47b257dfc4d78a880 100644 (file)
@@ -18,6 +18,7 @@ package org.apache.archiva.rest.services;
  * under the License.
  */
 
+import org.apache.archiva.rest.api.model.ArchivaRuntimeInfo;
 import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
 import org.apache.archiva.rest.api.services.CommonServices;
 import org.apache.commons.io.IOUtils;
@@ -169,8 +170,8 @@ public class DefaultCommonServices
         }
     }
 
-    public Boolean devMode()
+    public ArchivaRuntimeInfo archivaRuntimeInfo()
     {
-        return Boolean.getBoolean( "archiva.devMode" );
+        return new ArchivaRuntimeInfo();
     }
 }
index 3c48fbf88d174c5011806879f009b4fb50ec605f..a4a5840c816a7eed0079aa983bda8efebf0026b2 100644 (file)
@@ -35,6 +35,7 @@
     <tomcatRunPort>9091</tomcatRunPort>
     <tomcatRunPath>/archiva</tomcatRunPath>
     <archiva.devMode>true</archiva.devMode>
+    <archiva.javascriptLog>true</archiva.javascriptLog>
   </properties>
 
   <dependencies>
             <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
             <archiva.user.configFileName>${project.build.directory}/appserver-base/conf/archiva.xml</archiva.user.configFileName>
             <archiva.devMode>${archiva.devMode}</archiva.devMode>
+            <archiva.javascriptLog>${archiva.javascriptLog}</archiva.javascriptLog>
           </systemProperties>
         </configuration>
         <dependencies>
             <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
             <archiva.user.configFileName>${project.build.directory}/appserver-base/conf/archiva.xml</archiva.user.configFileName>
             <archiva.devMode>${archiva.devMode}</archiva.devMode>
+            <archiva.javascriptLog>${archiva.javascriptLog}</archiva.javascriptLog>
           </systemProperties>
         </configuration>
         <dependencies>
             <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
             <archiva.user.configFileName>${project.build.directory}/appserver-base/conf/archiva.xml</archiva.user.configFileName>
             <archiva.devMode>${archiva.devMode}</archiva.devMode>
+            <archiva.javascriptLog>${archiva.javascriptLog}</archiva.javascriptLog>
           </systemProperties>
         </configuration>
         <dependencies>
index 14d602c7e112f20fcbb9c11566959eeb371e16bc..d0168dfeac9a39ba4ab5c3b552e5a73dc73efe08 100644 (file)
 <script type="text/javascript">
 $.ajax(
   {
-    url: "restServices/archivaServices/commonServices/devMode",
+    url: "restServices/archivaServices/commonServices/archivaRuntimeInfo",
+    dataType: 'json',
     success:function(data){
-        window.archivaDevMode=data=='true';
+        window.archivaDevMode=data.archivaRuntimeInfo.devMode;
+        window.archivaJavascriptLog=data.archivaRuntimeInfo.javascriptLog;
         require.config({
             baseUrl: "js/"
           });
index dced221f641eae59528f72cf46b390c63550622a..f56914c624b85757fed77f5810c3308bc710dc32 100644 (file)
@@ -26,9 +26,9 @@ $(function() {
 
   $.log("devMode:"+window.archivaDevMode);
 
-  // no cache for ajax queries
+  // no cache for ajax queries as we get datas from servers so preventing caching !!
   jQuery.ajaxSetup( {
-    cache: !window.archivaDevMode
+    cache: false//!window.archivaDevMode
   } );
 
 
index 15f15a295eeb10bd7b6f6ff56dead7cd544bc2df..7be5da42692e46622265a0310ff2ca73c8ec1fb0 100644 (file)
@@ -21,6 +21,9 @@
  * log message in the console
  */
 $.log = (function(message) {
+  if ( !window.archivaJavascriptLog ){
+    return;
+  }
   if (typeof window.console != 'undefined' && typeof window.console.log != 'undefined') {
     console.log(message);
   } else {