What is the sendError() method?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

What is the sendError() method?

Rating:

The sendError() method of the HttpResponse interface sends an error response to the client using the specified status code and message. It has two forms: one that takes the status code as an integer, and the other that takes the status code as an integer and a String message. The syntaxes of the sendError() method is as follows:

  • public abstract void sendError(int code) throws IOException: It sends the error response with the status code and default message.
  • public abstract void sendError(int code, String message) throws IOException: It sends the error response with the status code and user message.
If the response has already been committed, this method throws a runtime IllegalStateException. This method also commits the response. Hence, response should not be written after using this method.


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.