in your exceptionController (when a 500 happened) you should be able to access the original URL via
request['javax.servlet.error.request_uri']
additionally you can get the requested URL in every controller via
request[RequestDispatcher.FORWARD_REQUEST_URI]
for accessing the request body after it has been consumed, you could use a solution as suggested in
Accessing the raw body of a PUT or POST request but bear in mind that this of course has to keep the body in memory.
to get the originally called controller and action name inside your exceptionController, the only solution I know right now would be either:
class ExceptionController {
def grailsUrlMappingsHolder
internalServerError() {
// request['javax.servlet.error.request_uri'] sometimes returns null?
def url = request['javax.servlet.error.request_uri'] ?: request[RequestDispatcher.FORWARD_REQUEST_URI]
def originalCall = url ? grailsUrlMappingsHolder.match(request['javax.servlet.error.request_uri'])?.paramss : [:]
def controller = original?.controller
def action = original?.action
...
}
}
alternatively, by saving the first controller call in a filter like that:
class SaveFirstCallFilter {
def filters = {
all(controller:'*', action:'*') {
before = {
// don't want to overwrite when forwarding or including other actions
if (!request['SAVED_CONTROLLER']) {
request['SAVED_CONTROLLER'] = controllerName
request['SAVED_CONTROLLER'] = actionName
}
}
}
}
}