public class FileRender extends Render
| 限定符和类型 | 字段和说明 |
|---|---|
protected static String |
baseDownloadPath |
protected static String |
DEFAULT_CONTENT_TYPE |
protected String |
downloadFileName |
protected File |
file |
protected static boolean |
normalRenderOnly |
protected static javax.servlet.ServletContext |
servletContext |
| 构造器和说明 |
|---|
FileRender(File file) |
FileRender(File file,
String downloadFileName) |
FileRender(String fileName) |
FileRender(String fileName,
String downloadFileName) |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
encodeFileName(javax.servlet.http.HttpServletRequest request,
String fileName)
依据浏览器判断编码规则
|
protected String |
encodeFileName(String fileName) |
protected void |
normalRender() |
protected void |
processRange(Long[] range)
Examples of byte-ranges-specifier values (assuming an entity-body of length 10000):
The first 500 bytes (byte offsets 0-499, inclusive): bytes=0-499
The second 500 bytes (byte offsets 500-999, inclusive): bytes=500-999
The final 500 bytes (byte offsets 9500-9999, inclusive): bytes=-500
Or bytes=9500-
|
protected void |
rangeRender() |
void |
render()
Render to client
|
static void |
setNormalRenderOnly(boolean normalRenderOnly)
设置为 true 时,客户端只能单线程下载,用于减轻服务器压力
默认值为 false
|
getDevMode, getEncoding, getView, setContext, setContext, setViewprotected static String baseDownloadPath
protected static javax.servlet.ServletContext servletContext
protected static boolean normalRenderOnly
protected File file
protected String downloadFileName
public static void setNormalRenderOnly(boolean normalRenderOnly)
public String encodeFileName(javax.servlet.http.HttpServletRequest request, String fileName)
protected void normalRender()
protected void rangeRender()
protected void processRange(Long[] range)
Copyright © 2022. All rights reserved.