About Question enthuware.jwpv6.2.1226 :

Moderator: admin

Post Reply
JoeAllen
Posts: 13
Joined: Thu Jul 11, 2013 11:22 pm
Contact:

About Question enthuware.jwpv6.2.1226 :

Post 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?

admin
Site Admin
Posts: 10385
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.1226 :

Post by admin »

No, as per Section 5.3, "If data is written to the response after these methods are called, the data is ignored."

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests