Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grails 3.0.11 Forward With Custom Context #9531

Closed
jkwiz opened this issue Dec 31, 2015 · 2 comments
Closed

Grails 3.0.11 Forward With Custom Context #9531

jkwiz opened this issue Dec 31, 2015 · 2 comments
Assignees
Milestone

Comments

@jkwiz
Copy link

jkwiz commented Dec 31, 2015

Forward appears to result in a 404 when setting 'server.contextPath' in application.yml. Reproducable in a new project by creating two controllers where one forwards to another. It works if you remove the contextPath.

gradle.properties:

grailsVersion=3.0.11
gradleWrapperVersion=2.3

application.yml:

server:
    port: 9001
    contextPath: /grails

FirstController.groovy

package forward
class FirstController {
    def index() {
        forward(controller: 'second', action: 'index')
    }
}

SecondController.groovy

package forward
class SecondController {
    def index() {
        render view: 'index'
    }
}
@orubel
Copy link

orubel commented Dec 31, 2015

is this related ( #9455 )?? Don't think it should be though because it should take into consideration contextPath.

Still if it is, referencing here for devs.

@jkwiz
Copy link
Author

jkwiz commented Jan 1, 2016

Thanks - I saw that one but it seemed a bit different. I did some more digging and It looks like the request URI has the context path appended twice. The context path is appended a second time by the servlet, so perhaps it should not be included here:

RequestForwarder.groovy:108

def fowardURI = lookupLinkGenerator().link(params)
0 = {ConcurrentHashMap$MapEntry@13315} "org.grails.WEB_REQUEST" -> "ServletWebRequest: uri=/grails/grails/second/index;client=0:0:0:0:0:0:0:1"
1 = {ConcurrentHashMap$MapEntry@13316} "grailsWebRequestFilter.FILTERED" -> "true"
2 = {ConcurrentHashMap$MapEntry@13317} "org.springframework.web.context.request.async.WebAsyncManager.WEB_ASYNC_MANAGER" -> 
3 = {ConcurrentHashMap$MapEntry@13318} "org.grails.CONTROLLER" -> "forward.FirstController@2fb39ee4"
4 = {ConcurrentHashMap$MapEntry@13319} "hiddenHttpMethodFilter.FILTERED" -> "true"
5 = {ConcurrentHashMap$MapEntry@13320} "org.springframework.web.servlet.DispatcherServlet.CONTEXT" -> "org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@38499e48: startup date [Thu Dec 31 18:16:41 EST 2015]; root of context hierarchy"
6 = {ConcurrentHashMap$MapEntry@13321} "characterEncodingFilter.FILTERED" -> "true"
7 = {ConcurrentHashMap$MapEntry@13322} "org.grails.CONTROLLER_NAME_ATTRIBUTE" -> "grails"
8 = {ConcurrentHashMap$MapEntry@13323} "org.springframework.web.servlet.DispatcherServlet.LOCALE_RESOLVER" -> 
9 = {ConcurrentHashMap$MapEntry@13324} "org.grails.RESPONSE_FORMATS" -> 
10 = {ConcurrentHashMap$MapEntry@13325} "org.springframework.web.servlet.DispatcherServlet.OUTPUT_FLASH_MAP" -> " size = 0"
11 = {ConcurrentHashMap$MapEntry@13326} "org.springframework.boot.actuate.autoconfigure.MetricsFilter.StopWatch" -> "StopWatch '': running time (millis) = 0"
12 = {ConcurrentHashMap$MapEntry@13327} "org.grails.GRAILS_CONTROLLER_CLASS" -> "Artefact > First"
13 = {ConcurrentHashMap$MapEntry@13328} "org.springframework.web.servlet.DispatcherServlet.FLASH_MAP_MANAGER" -> 
14 = {ConcurrentHashMap$MapEntry@13329} "org.grails.ACTION_NAME_ATTRIBUTE" -> "second"
15 = {ConcurrentHashMap$MapEntry@13330} "metricFilter.FILTERED" -> "true"
16 = {ConcurrentHashMap$MapEntry@13331} "org.springframework.web.servlet.DispatcherServlet.THEME_SOURCE" -> "org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@38499e48: startup date [Thu Dec 31 18:16:41 EST 2015]; root of context hierarchy"
17 = {ConcurrentHashMap$MapEntry@13332} "org.grails.FORWARD_CALLED" -> "true"
18 = {ConcurrentHashMap$MapEntry@13333} "webRequestLoggingFilter.FILTERED" -> "true"
19 = {ConcurrentHashMap$MapEntry@13334} "org.grails.FLASH_SCOPE" -> " size = 0"
20 = {ConcurrentHashMap$MapEntry@13335} "applicationContextIdFilter.FILTERED" -> "true"
21 = {ConcurrentHashMap$MapEntry@13336} "org.springframework.web.servlet.DispatcherServlet.THEME_RESOLVER" -> 
22 = {ConcurrentHashMap$MapEntry@13337} "ALLOWED_METHODS_HANDLED" -> "index"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants