code: public void sendError(int code, String message, HttpServletResponse response)
     {
        Assert.notNull(response, "HttpServletResponse argument was null");
        try
        {
           if (message != null)
           {
              response.sendError(code, message);
           }
           else
           {
              response.sendError(code);
           }
        }
        catch (IOException e)
        {
           throw new IllegalStateException("Failed to send error code: " + code, e);
        }
     }
docs: Sends an error response to the client using the specified HTTP status
  code.
  
  @param code the error status code
  @param message the descriptive message
  @param response
  @see HttpServletResponse#sendError(int, String)