This commit is contained in:
@@ -273,11 +273,11 @@ public abstract class HttpBaseServlet extends HttpServlet {
|
|||||||
final WebMapping mapping = method.getAnnotation(WebMapping.class);
|
final WebMapping mapping = method.getAnnotation(WebMapping.class);
|
||||||
final WebAction action = method.getAnnotation(WebAction.class);
|
final WebAction action = method.getAnnotation(WebAction.class);
|
||||||
if (mapping == null && action == null) continue;
|
if (mapping == null && action == null) continue;
|
||||||
final boolean inherited = action == null ? action.inherited() : mapping.inherited();
|
final boolean inherited = mapping == null ? action.inherited() : mapping.inherited();
|
||||||
if (!inherited && selfClz != clz) continue; //忽略不被继承的方法
|
if (!inherited && selfClz != clz) continue; //忽略不被继承的方法
|
||||||
final int actionid = action == null ? action.actionid() : mapping.actionid();
|
final int actionid = mapping == null ? action.actionid() : mapping.actionid();
|
||||||
final String name = action == null ? action.url().trim() : mapping.url().trim();
|
final String name = mapping == null ? action.url().trim() : mapping.url().trim();
|
||||||
final String[] methods = action == null ? action.methods() : mapping.methods();
|
final String[] methods = mapping == null ? action.methods() : mapping.methods();
|
||||||
if (nameset.containsKey(name)) {
|
if (nameset.containsKey(name)) {
|
||||||
if (nameset.get(name) != clz) continue;
|
if (nameset.get(name) != clz) continue;
|
||||||
throw new RuntimeException(this.getClass().getSimpleName() + " has two same " + WebMapping.class.getSimpleName() + "(" + name + ")");
|
throw new RuntimeException(this.getClass().getSimpleName() + " has two same " + WebMapping.class.getSimpleName() + "(" + name + ")");
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
|
|||||||
if (filename != null && !filename.isEmpty() && file != null) {
|
if (filename != null && !filename.isEmpty() && file != null) {
|
||||||
addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
|
addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(filename, "UTF-8"));
|
||||||
}
|
}
|
||||||
if (this.contentType == null) this.contentType = MimeType.getByFilename(filename == null || filename.isEmpty() ? file.getName() : filename);
|
this.contentType = MimeType.getByFilename(filename == null || filename.isEmpty() ? file.getName() : filename);
|
||||||
if (this.contentType == null) this.contentType = "application/octet-stream";
|
if (this.contentType == null) this.contentType = "application/octet-stream";
|
||||||
String range = request.getHeader("Range");
|
String range = request.getHeader("Range");
|
||||||
if (range != null && (!range.startsWith("bytes=") || range.indexOf(',') >= 0)) range = null;
|
if (range != null && (!range.startsWith("bytes=") || range.indexOf(',') >= 0)) range = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user