raffian
raffian

Reputation: 32086

In Grails, how can I get the request URI including request parameters?

If my incoming URL is this....

http://data-api:8080/policies/400?output=json

...what method on the request object in Grails will give me this...

/policies/400?output=json

I know request.forwardURI gives everything up to ?, but does not include the parameters

Upvotes: 4

Views: 7450

Answers (3)

LinChingHui
LinChingHui

Reputation: 21

I found the difference of request.requestURI between in Jetty and in WebLogic 10.2.

So, I use helper class :

def helper = new org.springframework.web.util.UrlPathHelper()
def reqURI = helper.getOriginatingRequestUri(request)
def qryStr = helper.getOriginatingQueryString(request)

Upvotes: 2

Philippe
Philippe

Reputation: 6828

request.requestURI + '?' + request.queryString 

Upvotes: 14

rdmueller
rdmueller

Reputation: 11062

it's maybe not the best solution, but I use the following:

request.forwardURI+'?'+request.'javax.servlet.forward.query_string'

Upvotes: 1

Related Questions