mirror of https://github.com/apache/archiva.git
add a service disabled in production env to log missing i18n
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1238042 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
db106d08d7
commit
74af64e0ba
|
@ -36,6 +36,7 @@
|
|||
<tomcatRunPath>/archiva</tomcatRunPath>
|
||||
<archiva.devMode>true</archiva.devMode>
|
||||
<archiva.javascriptLog>true</archiva.javascriptLog>
|
||||
<archiva.logMissingI18n>true</archiva.logMissingI18n>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -544,6 +545,7 @@
|
|||
<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>
|
||||
<archiva.logMissingI18n>${archiva.logMissingI18n}</archiva.logMissingI18n>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
|
@ -578,6 +580,7 @@
|
|||
<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>
|
||||
<archiva.logMissingI18n>${archiva.logMissingI18n}</archiva.logMissingI18n>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
|
@ -610,6 +613,7 @@
|
|||
<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>
|
||||
<archiva.logMissingI18n>${archiva.logMissingI18n}</archiva.logMissingI18n>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
|
|
|
@ -20,6 +20,8 @@ package org.apache.archiva.webapp.ui.services.api;
|
|||
|
||||
import org.apache.archiva.web.runtime.ArchivaRuntimeInfo;
|
||||
import org.apache.archiva.webapp.ui.services.model.ApplicationRuntimeInfo;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
@ -32,6 +34,8 @@ public class DefaultRuntimeInfoService
|
|||
implements RuntimeInfoService
|
||||
{
|
||||
|
||||
private Logger i18nLogger = LoggerFactory.getLogger( "archivaMissingi18n.logger" );
|
||||
|
||||
private ArchivaRuntimeInfo archivaRuntimeInfo;
|
||||
|
||||
@Inject
|
||||
|
@ -49,4 +53,10 @@ public class DefaultRuntimeInfoService
|
|||
applicationRuntimeInfo.setVersion( this.archivaRuntimeInfo.getVersion() );
|
||||
return applicationRuntimeInfo;
|
||||
}
|
||||
|
||||
public Boolean logMissingI18n( String key )
|
||||
{
|
||||
i18nLogger.info( "missing i18n key : '{}'", key );
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.codehaus.plexus.redback.authorization.RedbackAuthorization;
|
|||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
/**
|
||||
|
@ -38,4 +39,11 @@ public interface RuntimeInfoService
|
|||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
||||
@RedbackAuthorization( noRestriction = true )
|
||||
ApplicationRuntimeInfo getApplicationRuntimeInfo();
|
||||
|
||||
|
||||
@Path( "logMissingI18n" )
|
||||
@GET
|
||||
@Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
|
||||
@RedbackAuthorization( noRestriction = true )
|
||||
Boolean logMissingI18n( @QueryParam( "key" ) String key );
|
||||
}
|
||||
|
|
|
@ -40,6 +40,8 @@ public class ApplicationRuntimeInfo
|
|||
|
||||
private String copyrightRange;
|
||||
|
||||
private boolean logMissingI18n;
|
||||
|
||||
|
||||
public ApplicationRuntimeInfo()
|
||||
{
|
||||
|
@ -47,6 +49,8 @@ public class ApplicationRuntimeInfo
|
|||
|
||||
this.javascriptLog = Boolean.getBoolean( "archiva.javascriptLog" );
|
||||
|
||||
this.logMissingI18n = Boolean.getBoolean( "archiva.logMissingI18n" );
|
||||
|
||||
this.copyrightRange = "2005 - " + Calendar.getInstance().get( Calendar.YEAR );
|
||||
}
|
||||
|
||||
|
@ -110,6 +114,16 @@ public class ApplicationRuntimeInfo
|
|||
this.copyrightRange = copyrightRange;
|
||||
}
|
||||
|
||||
public boolean isLogMissingI18n()
|
||||
{
|
||||
return logMissingI18n;
|
||||
}
|
||||
|
||||
public void setLogMissingI18n( boolean logMissingI18n )
|
||||
{
|
||||
this.logMissingI18n = logMissingI18n;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
@ -121,6 +135,7 @@ public class ApplicationRuntimeInfo
|
|||
sb.append( ", buildNumber='" ).append( buildNumber ).append( '\'' );
|
||||
sb.append( ", timestamp=" ).append( timestamp );
|
||||
sb.append( ", copyrightRange='" ).append( copyrightRange ).append( '\'' );
|
||||
sb.append( ", logMissingI18n=" ).append( logMissingI18n );
|
||||
sb.append( '}' );
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ $.i18n.properties = function(settings) {
|
|||
language: '',
|
||||
path: '',
|
||||
mode: 'vars',
|
||||
cache: false,
|
||||
cache: false,
|
||||
encoding: 'UTF-8',
|
||||
callback: null
|
||||
};
|
||||
|
@ -88,8 +88,12 @@ $.i18n.properties = function(settings) {
|
|||
*/
|
||||
$.i18n.prop = function(key /* Add parameters as function arguments as necessary */) {
|
||||
var value = $.i18n.map[key];
|
||||
if (value == null)
|
||||
if (value == null) {
|
||||
if (window.archivaRuntimeInfo.logMissingI18n){
|
||||
$.get('restServices/archivaUiServices/runtimeInfoService/logMissingI18n?key='+encodeURIComponent(key));
|
||||
}
|
||||
return '[' + key + ']';
|
||||
}
|
||||
|
||||
// if(arguments.length < 2) // No arguments.
|
||||
// //if(key == 'spv.lbl.modified') {alert(value);}
|
||||
|
|
Loading…
Reference in New Issue