Spring MVC ExceptionHandler and the controller context -


this should common problem solution haven't managed find anywhere.

i defining global exception handler using @controlleradvice, define new modelandview , redirect error page. works great except fact want add link go original page of course vary depending on error originated.

what want store kind of context information controller generated error, instance if it's mycontroller can access value via mycontroller.exception_redirect_url , generate appropriate link.

i find lack of context information in exception handler rather limiting.

make custom exception class , pass context in exeption.

class myexception extends exception {   private mycontroller c;   myexception( string msg, mycontroller c ) {...}   ... } 

i feel there's better way, revolving around request context object. want.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -