• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Replicating HTTP errors

 
Ramin Esfandiari
Greenhorn
Posts: 16
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have set up my custom error pages in Tomcat 7 (running from eclipse). For testing that they work I can simply misspell a url and get my custom page 404 error, however I am not sure how I can replicate the following errors.

400, 401, 403, 500 and 503.

Any advice would be greatly appreciated.

Thanks


 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4499
267
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming you have access to the codebase, response.sendError(-) is all what you need.
 
Ramin Esfandiari
Greenhorn
Posts: 16
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

Apologies, but I am a bit confused. I am interested in the response I get from my server. I need something that I can use in the browser to say cause a page 500 error so I can see how my custom error 500 page looks. Can I do this with response.sendError(-)?

Thanks
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4499
267
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't simply use your browser to trigger a server error (especially in 5xx series), unless you make your web app do that. Since you seem to have access to your codebase, you can make a test servlet that calls response.sendError(500); in its doGet(-) method, which will trigger a 500 error when that servlet is 'called' from your browser. You can see how your custom error pages look like with that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic