Jetty 8.1中的Grails请求对象null

Jetty 8.1中的Grails请求对象null,grails,groovy,jetty,httprequest,Grails,Groovy,Jetty,Httprequest,以下代码在Grails2.0.4和EclipseST3.2上按预期工作,使用Eclipse的嵌入式TCServer2.7作为web容器 class TestController { def service() { println request.request.getRequestURL() //render response here... } 对于http://svr1:8080/testapp/test/node1,上面的代码打印完整的请求URL

以下代码在Grails2.0.4和EclipseST3.2上按预期工作,使用Eclipse的嵌入式TCServer2.7作为web容器

class TestController {

    def service() {
      println request.request.getRequestURL()
      //render response here...
    }
对于
http://svr1:8080/testapp/test/node1
,上面的代码打印完整的请求URL,
http://svr1:8080/testapp/test/node1

我们创建了一个WAR并将其部署到Jetty 8.1.10,但发现
request.request
返回null,因此上述代码使用null指针失败。我们尝试使用
request.getRequestURL()
,但它返回一个包含grails分派语法的URL,因此它与我们需要的原始客户端请求URL不匹配


作为一种解决方法,我们使用
request.getServerName()
request.getServerPort()
、和
request.getContextPath()
手动构建了大部分URL,给出了
http://svr1:8080/testapp
,但仍然省略了uri部分,
/test/node1
。我们假设这个问题可能是由于Jetty的ServletAPI实现造成的,但如果是这样的话,肯定会有其他人在我们之前发现这个问题

找到了一个似乎可以在tcServer和Jetty上使用的解决方案。我们手动构造基本URL,然后使用此实用程序获取剩余部分