use writeOptionHeaders with ServletResponse parameter only

pull/1/head
reger 11 years ago
parent b26787dc2d
commit 94293176a3

@ -403,7 +403,7 @@ public class Jetty8YaCyDefaultServlet extends YaCyDefaultServlet implements Reso
// See if a direct methods can be used? // See if a direct methods can be used?
if (content != null && !written && out instanceof HttpOutput) { if (content != null && !written && out instanceof HttpOutput) {
if (response instanceof Response) { if (response instanceof Response) {
writeOptionHeaders(((Response) response).getHttpFields()); writeOptionHeaders(response);
((AbstractHttpConnection.Output) out).sendContent(content); ((AbstractHttpConnection.Output) out).sendContent(content);
} else { } else {
Buffer buffer = direct ? content.getDirectBuffer() : content.getIndirectBuffer(); Buffer buffer = direct ? content.getDirectBuffer() : content.getIndirectBuffer();

@ -70,7 +70,6 @@ import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.eclipse.jetty.http.HttpContent; import org.eclipse.jetty.http.HttpContent;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.Resource;
@ -98,10 +97,6 @@ import org.eclipse.jetty.util.resource.Resource;
* *
* welcomeFile name of the welcome file (default is "index.html", "welcome.html") * welcomeFile name of the welcome file (default is "index.html", "welcome.html")
* *
* gzip If set to true, then static content will be served as
* gzip content encoded if a matching resource is
* found ending with ".gz"
*
* resourceBase Set to replace the context resource base * resourceBase Set to replace the context resource base
* *
* resourceCache If set, this is a context attribute name, which the servlet * resourceCache If set, this is a context attribute name, which the servlet
@ -127,7 +122,6 @@ public abstract class YaCyDefaultServlet extends HttpServlet {
protected boolean _dirAllowed = true; protected boolean _dirAllowed = true;
protected boolean _pathInfoOnly = false; protected boolean _pathInfoOnly = false;
protected boolean _etags = false; protected boolean _etags = false;
// protected boolean _gzip = true;
protected Resource _resourceBase; protected Resource _resourceBase;
protected MimeTypes _mimeTypes; protected MimeTypes _mimeTypes;
protected String[] _welcomes; protected String[] _welcomes;
@ -176,7 +170,6 @@ public abstract class YaCyDefaultServlet extends HttpServlet {
} }
_etags = getInitBoolean("etags", _etags); _etags = getInitBoolean("etags", _etags);
// _gzip=getInitBoolean("gzip",_gzip);
if (ConcurrentLog.isFine("FILEHANDLER")) { if (ConcurrentLog.isFine("FILEHANDLER")) {
ConcurrentLog.fine("FILEHANDLER","YaCyDefaultServlet: resource base = " + _resourceBase); ConcurrentLog.fine("FILEHANDLER","YaCyDefaultServlet: resource base = " + _resourceBase);
@ -301,8 +294,7 @@ public abstract class YaCyDefaultServlet extends HttpServlet {
String dir = resource.getListHTML(base, pathInContext.length() > 1); String dir = resource.getListHTML(base, pathInContext.length() > 1);
if (dir == null) { if (dir == null) {
response.sendError(HttpServletResponse.SC_FORBIDDEN, response.sendError(HttpServletResponse.SC_FORBIDDEN, "No directory");
"No directory");
return; return;
} }
@ -347,13 +339,6 @@ public abstract class YaCyDefaultServlet extends HttpServlet {
} }
} }
/* ------------------------------------------------------------ */
protected void writeOptionHeaders(HttpFields fields) {
if (_acceptRanges) {
fields.put(HeaderFramework.ACCEPT_RANGES, "bytes");
}
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
protected void writeOptionHeaders(HttpServletResponse response) { protected void writeOptionHeaders(HttpServletResponse response) {
if (_acceptRanges) { if (_acceptRanges) {

Loading…
Cancel
Save