public class MimeFileRouter extends Object implements HttpRouter
Constructor and Description |
---|
MimeFileRouter(String rootPath)
构造函数
|
Modifier and Type | Method and Description |
---|---|
void |
fillMimeFile(File responseFile,
HttpRequest request,
HttpResponse response)
填充 mime 文件到 response
|
File |
getStaticFile(HttpRequest request)
获取请求对应的静态文件
|
boolean |
isNotModify(File responseFile,
HttpRequest request,
HttpResponse response)
判断是否是304 not modify
|
void |
process(HttpRequest request,
HttpResponse response) |
void |
setNotModifyResponse(HttpResponse response)
将响应报文设置称304
|
public MimeFileRouter(String rootPath)
rootPath
- 根路径public File getStaticFile(HttpRequest request)
request
- request 请求对象public void process(HttpRequest request, HttpResponse response) throws Exception
process
in interface HttpRouter
Exception
public boolean isNotModify(File responseFile, HttpRequest request, HttpResponse response) throws ParseException
responseFile
- 响应文件request
- HTTP 请求对象response
- HTTP 响应对象ParseException
- 解析异常public void fillMimeFile(File responseFile, HttpRequest request, HttpResponse response) throws IOException
responseFile
- 响应文件request
- HTTP 请求对象response
- HTTP 响应对象IOException
- IO操作异常public void setNotModifyResponse(HttpResponse response)
response
- HTTP 响应对象Copyright © 2020 Voovan. All rights reserved.