Created
June 24, 2013 11:02
-
-
Save roundrop/5849305 to your computer and use it in GitHub Desktop.
org.apache.struts.action.ExceptionHandler の拡張。
これをglobal-exceptionsのhandlerに使用することで、pathにSAStrutsが認識するパスをそのまま記述することが可能となる。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.servlet.ServletException; | |
import javax.servlet.http.HttpServletRequest; | |
import javax.servlet.http.HttpServletResponse; | |
import org.apache.struts.action.ActionForm; | |
import org.apache.struts.action.ActionForward; | |
import org.apache.struts.action.ActionMapping; | |
import org.apache.struts.action.ExceptionHandler; | |
import org.apache.struts.config.ExceptionConfig; | |
import org.seasar.struts.config.S2ActionMapping; | |
public class S2ExceptionHandler extends ExceptionHandler { | |
@Override | |
public ActionForward execute(Exception exception, ExceptionConfig config, | |
ActionMapping mapping, ActionForm formInstance, | |
HttpServletRequest request, HttpServletResponse response) | |
throws ServletException { | |
return (config.getPath() != null | |
? ((S2ActionMapping) mapping).createForward(config.getPath()) | |
: mapping.getInputForward()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment