diff --git a/src/org/redkale/net/http/HttpBaseServlet.java b/src/org/redkale/net/http/HttpBaseServlet.java index cfff21c13..f6a4e47f0 100644 --- a/src/org/redkale/net/http/HttpBaseServlet.java +++ b/src/org/redkale/net/http/HttpBaseServlet.java @@ -273,11 +273,11 @@ public abstract class HttpBaseServlet extends HttpServlet { final WebMapping mapping = method.getAnnotation(WebMapping.class); final WebAction action = method.getAnnotation(WebAction.class); 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; //忽略不被继承的方法 - final int actionid = action == null ? action.actionid() : mapping.actionid(); - final String name = action == null ? action.url().trim() : mapping.url().trim(); - final String[] methods = action == null ? action.methods() : mapping.methods(); + final int actionid = mapping == null ? action.actionid() : mapping.actionid(); + final String name = mapping == null ? action.url().trim() : mapping.url().trim(); + final String[] methods = mapping == null ? action.methods() : mapping.methods(); if (nameset.containsKey(name)) { if (nameset.get(name) != clz) continue; throw new RuntimeException(this.getClass().getSimpleName() + " has two same " + WebMapping.class.getSimpleName() + "(" + name + ")"); diff --git a/src/org/redkale/net/http/HttpResponse.java b/src/org/redkale/net/http/HttpResponse.java index be444075c..7ba7b715c 100644 --- a/src/org/redkale/net/http/HttpResponse.java +++ b/src/org/redkale/net/http/HttpResponse.java @@ -535,7 +535,7 @@ public class HttpResponse extends Response { if (filename != null && !filename.isEmpty() && file != null) { 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"; String range = request.getHeader("Range"); if (range != null && (!range.startsWith("bytes=") || range.indexOf(',') >= 0)) range = null;