java - How to handle exceptions thrown by default interceptors in struts2? -


for example:

org.apache.commons.fileupload.fileuploadbase$sizelimitexceededexception:  request rejected because size (337867) exceeds configured  maximum (200) 

you can use exception mapping feature of struts2 map exception specific result.

in struts.xlm file put <exception-mapping> definition inside <global-exception-mappings> , create result, defined name, global or in specific action(s).

<global-exception-mappings>   <exception-mapping exception="java.lang.nullpointerexception" result="npe"/> </global-exception-mappings> 

note interceptor stack must include exception interceptor. recommended exception interceptor first interceptor on stack, ensuring has full access catch exception, caused other interceptors.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -