Issue #124 - Don't produce text/html if the request doesn't accept it
+ Using cleaner HttpFields access to 'Accept' header Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
a7be6bc8ea
commit
0f0eb569e9
|
@ -29,6 +29,7 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.jetty.http.HttpField;
|
||||
import org.eclipse.jetty.http.HttpFields;
|
||||
import org.eclipse.jetty.http.HttpHeader;
|
||||
import org.eclipse.jetty.http.HttpMethod;
|
||||
|
@ -112,8 +113,8 @@ public class ErrorHandler extends AbstractHandler
|
|||
baseRequest.setHandled(true);
|
||||
|
||||
// Issue #124 - Don't produce text/html if the request doesn't accept it
|
||||
String reqAccept = request.getHeader("Accept");
|
||||
if (reqAccept == null || reqAccept.contains("text/html") || reqAccept.contains("*/*"))
|
||||
HttpField accept = baseRequest.getHttpFields().getField(HttpHeader.ACCEPT);
|
||||
if (accept == null || accept.contains("text/html") || accept.contains("*/*"))
|
||||
{
|
||||
response.setContentType(MimeTypes.Type.TEXT_HTML_8859_1.asString());
|
||||
if (_cacheControl != null)
|
||||
|
|
Loading…
Reference in New Issue