This commit is contained in:
Redkale
2017-03-09 15:44:43 +08:00
parent 2577684897
commit 47189901e5
2 changed files with 5 additions and 5 deletions

View File

@@ -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 + ")");

View File

@@ -535,7 +535,7 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
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;