Skip to content

Commit 614acf3

Browse files
committed
Horrible hack to workaround Tomcat bug. Fixes #9024
1 parent 48d1303 commit 614acf3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

grails-core/src/main/groovy/grails/config/Settings.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ interface Settings {
184184
*/
185185
String DEFAULT_WEB_SERVLET_PATH = '/*'
186186

187+
/**
188+
* The default servlet path
189+
*/
190+
String DEFAULT_TOMCAT_SERVLET_PATH = '/'
191+
187192
/**
188193
* The default encoding
189194
*/

grails-plugin-controllers/src/main/groovy/org/grails/plugins/web/controllers/ControllersGrailsPlugin.groovy

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ class ControllersGrailsPlugin extends Plugin {
7777
String filtersEncoding = config.getProperty(Settings.FILTER_ENCODING, 'utf-8')
7878
boolean filtersForceEncoding = config.getProperty(Settings.FILTER_FORCE_ENCODING, Boolean, false)
7979
boolean dbConsoleEnabled = config.getProperty(Settings.DBCONSOLE_ENABLED, Boolean, Environment.current == Environment.DEVELOPMENT)
80-
String grailsServletPath = config.getProperty(Settings.WEB_SERVLET_PATH, Settings.DEFAULT_WEB_SERVLET_PATH)
80+
81+
boolean isTomcat = ClassUtils.isPresent("org.apache.catalina.startup.Tomcat", application.classLoader)
82+
String grailsServletPath = config.getProperty(Settings.WEB_SERVLET_PATH, isTomcat ? Settings.DEFAULT_TOMCAT_SERVLET_PATH : Settings.DEFAULT_WEB_SERVLET_PATH)
8183
int resourcesCachePeriod = config.getProperty(Settings.RESOURCES_CACHE_PERIOD, Integer, 0)
8284
boolean resourcesEnabled = config.getProperty(Settings.RESOURCES_ENABLED, Boolean, true)
8385
String resourcesPattern = config.getProperty(Settings.RESOURCES_PATTERN, String, Settings.DEFAULT_RESOURCE_PATTERN)

0 commit comments

Comments
 (0)