Saturday, 31 August 2013

Error handling (400) in app engine with Spring 3

Error handling (400) in app engine with Spring 3

I want to handle in my app engine application the error 400.

I could handle the 404 error using the following code:
@RequestMapping("/**")
public void unmappedRequest(HttpServletRequest request) {
request.getRequestURI();
String uri = request.getRequestURI();
throw new UnknownResourceException("There is no resource for path "
+ uri);
}
and then i manage the 404 error.
However, for the 400 error (bad request), I tried something like this:
in web.xml
<error-page>
<error-code>400</error-code>
<location>/error/400</location>
</error-page>
and then in my controller
@RequestMapping("/error/400")
public void badRequest(HttpServletRequest request) {
request.getRequestURI();
String uri = request.getRequestURI();
throw new UnknownResourceException("bad request for path " + uri);
}
But it doesn't work, so I'm getting the default error screen from app
engine when I make a bad request.
Any suggestions?

1 comment:

  1. The world of attorneys can seem overwhelming to people who are unfamiliar with it. You can learn what you have a reliable lawyer for your needs. Keep reading to learn more about what to expect from a good lawyer.
    http://www.selecttoursinc.com |

    http://www.sherbornbusiness.com |

    http://www.streamingforbusiness.com |

    http://www.travelingarmenian.com |

    http://www.travel-prescott.com |

    ReplyDelete