Page 1 of 1

About Question enthuware.jwpv6.2.1226 :

Posted: Sun Jul 14, 2013 1:50 am
by JoeAllen
if(name == null)
{
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Unable to get name.");
}
out.println(name);

According to the API:

void sendError(int sc) throws java.io.IOException:
"After using this method, the response should be considered to be committed and should not be written to. ",

but "out.println(name);" still writes to the response, which is committed already. Shouldn't it cause an illegalStateException by writting to a committed response?

Re: About Question enthuware.jwpv6.2.1226 :

Posted: Sun Jul 14, 2013 2:14 am
by admin
No, as per Section 5.3, "If data is written to the response after these methods are called, the data is ignored."