public class WebUtil extends BasicObject
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
CONTENTTYPE_APPLICATION_EXCEL |
static String |
CONTENTTYPE_APPLICATION_JSON |
static String |
CONTENTTYPE_APPLICATION_STREAM
文件
|
static String |
CONTENTTYPE_TEXT |
static String |
CONTENTTYPE_TEXTHTML |
static String |
CONTENTTYPE_TEXTJSON |
static String |
CONTENTTYPE_TEXTXML |
defaultCache, log, slog| 构造器和说明 |
|---|
WebUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
getBasePath(javax.servlet.http.HttpServletRequest request) |
static boolean |
getBoolean(javax.servlet.http.HttpServletRequest request,
String name,
boolean dval) |
static double |
getDouble(javax.servlet.http.HttpServletRequest request,
String name,
double dval) |
static float |
getFloat(javax.servlet.http.HttpServletRequest request,
String name,
float dval) |
static int |
getInt(javax.servlet.http.HttpServletRequest request,
String name,
int dval) |
static String |
getIpAddr(javax.servlet.http.HttpServletRequest request)
获取IP
|
static long |
getLong(javax.servlet.http.HttpServletRequest request,
String name,
long dval) |
static String |
getRealIpAddr(javax.servlet.http.HttpServletRequest request)
获取真实IP
|
static String |
getString(javax.servlet.http.HttpServletRequest request,
String name,
String dval) |
static Double |
getTimeToDouble(Date t) |
static Object[] |
removeNUll(Object... args)
去除null
|
static void |
sendBytes(javax.servlet.http.HttpServletResponse resp,
byte[] data,
SysSjglFile fileObj)
将字节数组以文件下载的形式输出
|
static void |
sendDirectToClient(javax.servlet.http.HttpServletResponse resp,
String s,
String contentType,
String charset) |
static void |
sendFile(javax.servlet.http.HttpServletResponse resp,
File file,
SysSjglFile fileObj)
从磁盘上下载所需的文件信息
|
static void |
sendFile(javax.servlet.http.HttpServletResponse resp,
String data,
SysSjglFile fileObj)
将字符串以文件形式下载
|
static void |
sendJson(javax.servlet.http.HttpServletResponse response,
Object o)
对象序列化为json
|
static void |
sendJson(javax.servlet.http.HttpServletResponse response,
String s)
json字符串
|
static void |
sendText(javax.servlet.http.HttpServletResponse response,
String s) |
static void |
setFileDownloadHead(javax.servlet.http.HttpServletResponse resp,
SysSjglFile fileObj)
设置文件下载头
|
db, db, failed, failed, isBlank, requireNonNull, sqlManager, sqlManager, success, success, swtj, valByDefpublic static final String CONTENTTYPE_APPLICATION_STREAM
public static void sendText(javax.servlet.http.HttpServletResponse response,
String s)
public static void sendJson(javax.servlet.http.HttpServletResponse response,
String s)
response - s - public static void sendJson(javax.servlet.http.HttpServletResponse response,
Object o)
response - o - public static void sendDirectToClient(javax.servlet.http.HttpServletResponse resp,
String s,
String contentType,
String charset)
public static void sendBytes(javax.servlet.http.HttpServletResponse resp,
byte[] data,
SysSjglFile fileObj)
resp - data - 字节数组fileObj - 文件对象public static void setFileDownloadHead(javax.servlet.http.HttpServletResponse resp,
SysSjglFile fileObj)
throws UnsupportedEncodingException
resp - fileObj - UnsupportedEncodingExceptionpublic static void sendFile(javax.servlet.http.HttpServletResponse resp,
String data,
SysSjglFile fileObj)
resp - 响应信息data - 字符串fileObj - 文件对象public static void sendFile(javax.servlet.http.HttpServletResponse resp,
File file,
SysSjglFile fileObj)
resp - 响应信息file - 文件的信息fileObj - 文件对象public static String getString(javax.servlet.http.HttpServletRequest request, String name, String dval)
request - name - 参数名dval - 默认赋值public static boolean getBoolean(javax.servlet.http.HttpServletRequest request,
String name,
boolean dval)
public static int getInt(javax.servlet.http.HttpServletRequest request,
String name,
int dval)
public static long getLong(javax.servlet.http.HttpServletRequest request,
String name,
long dval)
public static double getDouble(javax.servlet.http.HttpServletRequest request,
String name,
double dval)
public static float getFloat(javax.servlet.http.HttpServletRequest request,
String name,
float dval)
public static String getBasePath(javax.servlet.http.HttpServletRequest request)
public static String getIpAddr(javax.servlet.http.HttpServletRequest request)
request - public static String getRealIpAddr(javax.servlet.http.HttpServletRequest request)
request - public static Object[] removeNUll(Object... args)
args - 多个参数 例如: String s1,String s2........等Copyright © 2024. All rights reserved.