Skip to content

Commit

Permalink
Merge pull request #3274 from AtlasOfLivingAustralia/feature/issue3271
Browse files Browse the repository at this point in the history
Set default user agent string for http requests #3271
  • Loading branch information
temi authored Jul 23, 2024
2 parents dff615b + 2092bf6 commit cf8a58a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions grails-app/init/au/org/ala/fieldcapture/Application.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@ package au.org.ala.fieldcapture

import asset.pipeline.AssetPipelineConfigHolder
import au.org.ala.ecodata.forms.TemplateFileAssetResolver
import au.org.ala.merit.SessionLogger
import grails.boot.GrailsApp
import grails.boot.config.GrailsApplicationPostProcessor
import grails.boot.config.GrailsAutoConfiguration
import grails.converters.JSON
import grails.core.GrailsApplication
import grails.util.BuildSettings
import grails.util.Environment
import grails.util.Metadata
import groovy.util.logging.Slf4j
import net.sf.json.JSONNull
import org.joda.time.LocalDate
import org.joda.time.format.DateTimeFormat
import org.joda.time.format.DateTimeFormatter
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean
import org.springframework.context.annotation.Bean

@Slf4j
Expand Down Expand Up @@ -73,9 +72,11 @@ class Application extends GrailsAutoConfiguration {
return new GrailsApplicationPostProcessor( this, applicationContext, classes() as Class[]) {
@Override
protected void customizeGrailsApplication(GrailsApplication grailsApplication) {
String applicationName = Metadata.current.getApplicationName()
String applicationVersion = Metadata.current.getApplicationVersion()
System.setProperty('http.agent', 'au.org.ala.'+applicationName+'/'+applicationVersion)
System.setProperty(EHCACHE_DIRECTORY_CONFIG_ITEM, grailsApplication.config.getProperty(EHCACHE_DIRECTORY_CONFIG_ITEM, DEFAULT_EHCACHE_DIRECTORY))
}

}
}
}

0 comments on commit cf8a58a

Please sign in to comment.