This commit is contained in:
@@ -259,6 +259,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
* 获取请求内容指定的编码字符串
|
* 获取请求内容指定的编码字符串
|
||||||
*
|
*
|
||||||
* @param charset 编码
|
* @param charset 编码
|
||||||
|
*
|
||||||
* @return 内容
|
* @return 内容
|
||||||
*/
|
*/
|
||||||
public String getBody(final Charset charset) {
|
public String getBody(final Charset charset) {
|
||||||
@@ -342,6 +343,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
* 获取sessionid
|
* 获取sessionid
|
||||||
*
|
*
|
||||||
* @param create 无sessionid是否自动创建
|
* @param create 无sessionid是否自动创建
|
||||||
|
*
|
||||||
* @return sessionid
|
* @return sessionid
|
||||||
*/
|
*/
|
||||||
public String getSessionid(boolean create) {
|
public String getSessionid(boolean create) {
|
||||||
@@ -384,6 +386,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
* 获取Cookie值
|
* 获取Cookie值
|
||||||
*
|
*
|
||||||
* @param name cookie名
|
* @param name cookie名
|
||||||
|
*
|
||||||
* @return cookie值
|
* @return cookie值
|
||||||
*/
|
*/
|
||||||
public String getCookie(String name) {
|
public String getCookie(String name) {
|
||||||
@@ -395,6 +398,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name cookie名
|
* @param name cookie名
|
||||||
* @param dfvalue 默认cookie值
|
* @param dfvalue 默认cookie值
|
||||||
|
*
|
||||||
* @return cookie值
|
* @return cookie值
|
||||||
*/
|
*/
|
||||||
public String getCookie(String name, String dfvalue) {
|
public String getCookie(String name, String dfvalue) {
|
||||||
@@ -498,6 +502,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
* 从prefix之后截取getRequestURI再对"/"进行分隔
|
* 从prefix之后截取getRequestURI再对"/"进行分隔
|
||||||
* <p>
|
* <p>
|
||||||
* @param prefix 前缀
|
* @param prefix 前缀
|
||||||
|
*
|
||||||
* @return String[]
|
* @return String[]
|
||||||
*/
|
*/
|
||||||
public String[] getRequstURIPaths(String prefix) {
|
public String[] getRequstURIPaths(String prefix) {
|
||||||
@@ -512,6 +517,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param prefix prefix段前缀
|
* @param prefix prefix段前缀
|
||||||
* @param defvalue 默认值
|
* @param defvalue 默认值
|
||||||
|
*
|
||||||
* @return prefix截断后的值
|
* @return prefix截断后的值
|
||||||
*/
|
*/
|
||||||
public String getRequstURIPath(String prefix, String defvalue) {
|
public String getRequstURIPath(String prefix, String defvalue) {
|
||||||
@@ -530,6 +536,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param prefix prefix段前缀
|
* @param prefix prefix段前缀
|
||||||
* @param defvalue 默认short值
|
* @param defvalue 默认short值
|
||||||
|
*
|
||||||
* @return short值
|
* @return short值
|
||||||
*/
|
*/
|
||||||
public short getRequstURIPath(String prefix, short defvalue) {
|
public short getRequstURIPath(String prefix, short defvalue) {
|
||||||
@@ -545,6 +552,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param prefix prefix段前缀
|
* @param prefix prefix段前缀
|
||||||
* @param defvalue 默认int值
|
* @param defvalue 默认int值
|
||||||
|
*
|
||||||
* @return int值
|
* @return int值
|
||||||
*/
|
*/
|
||||||
public int getRequstURIPath(String prefix, int defvalue) {
|
public int getRequstURIPath(String prefix, int defvalue) {
|
||||||
@@ -552,6 +560,21 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
return val == null ? defvalue : Integer.parseInt(val);
|
return val == null ? defvalue : Integer.parseInt(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取请求URL分段中含prefix段的float值 <br>
|
||||||
|
* 例如请求URL /pipes/record/query/point:40.0 <br>
|
||||||
|
* 获取time参数: float point = request.getRequstURIPath("point:", 0.0f);
|
||||||
|
*
|
||||||
|
* @param prefix prefix段前缀
|
||||||
|
* @param defvalue 默认float值
|
||||||
|
*
|
||||||
|
* @return float值
|
||||||
|
*/
|
||||||
|
public float getRequstURIPath(String prefix, float defvalue) {
|
||||||
|
String val = getRequstURIPath(prefix, null);
|
||||||
|
return val == null ? defvalue : Float.parseFloat(val);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取请求URL分段中含prefix段的long值 <br>
|
* 获取请求URL分段中含prefix段的long值 <br>
|
||||||
* 例如请求URL /pipes/record/query/time:1453104341363/id:40 <br>
|
* 例如请求URL /pipes/record/query/time:1453104341363/id:40 <br>
|
||||||
@@ -559,6 +582,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param prefix prefix段前缀
|
* @param prefix prefix段前缀
|
||||||
* @param defvalue 默认long值
|
* @param defvalue 默认long值
|
||||||
|
*
|
||||||
* @return long值
|
* @return long值
|
||||||
*/
|
*/
|
||||||
public long getRequstURIPath(String prefix, long defvalue) {
|
public long getRequstURIPath(String prefix, long defvalue) {
|
||||||
@@ -566,6 +590,21 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
return val == null ? defvalue : Long.parseLong(val);
|
return val == null ? defvalue : Long.parseLong(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取请求URL分段中含prefix段的double值 <br>
|
||||||
|
* 例如请求URL /pipes/record/query/point:40.0 <br>
|
||||||
|
* 获取time参数: double point = request.getRequstURIPath("point:", 0.0);
|
||||||
|
*
|
||||||
|
* @param prefix prefix段前缀
|
||||||
|
* @param defvalue 默认double值
|
||||||
|
*
|
||||||
|
* @return double值
|
||||||
|
*/
|
||||||
|
public double getRequstURIPath(String prefix, double defvalue) {
|
||||||
|
String val = getRequstURIPath(prefix, null);
|
||||||
|
return val == null ? defvalue : Double.parseDouble(val);
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* 获取所有的header名
|
* 获取所有的header名
|
||||||
@@ -580,6 +619,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
* 获取指定的header值
|
* 获取指定的header值
|
||||||
*
|
*
|
||||||
* @param name header名
|
* @param name header名
|
||||||
|
*
|
||||||
* @return header值
|
* @return header值
|
||||||
*/
|
*/
|
||||||
public String getHeader(String name) {
|
public String getHeader(String name) {
|
||||||
@@ -591,6 +631,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name header名
|
* @param name header名
|
||||||
* @param defaultValue 默认值
|
* @param defaultValue 默认值
|
||||||
|
*
|
||||||
* @return header值
|
* @return header值
|
||||||
*/
|
*/
|
||||||
public String getHeader(String name, String defaultValue) {
|
public String getHeader(String name, String defaultValue) {
|
||||||
@@ -603,6 +644,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
* @param <T> 泛型
|
* @param <T> 泛型
|
||||||
* @param clazz 反序列化的类名
|
* @param clazz 反序列化的类名
|
||||||
* @param name header名
|
* @param name header名
|
||||||
|
*
|
||||||
* @return header值
|
* @return header值
|
||||||
*/
|
*/
|
||||||
public <T> T getJsonHeader(Class<T> clazz, String name) {
|
public <T> T getJsonHeader(Class<T> clazz, String name) {
|
||||||
@@ -617,6 +659,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
* @param convert JsonConvert对象
|
* @param convert JsonConvert对象
|
||||||
* @param clazz 反序列化的类名
|
* @param clazz 反序列化的类名
|
||||||
* @param name header名
|
* @param name header名
|
||||||
|
*
|
||||||
* @return header值
|
* @return header值
|
||||||
*/
|
*/
|
||||||
public <T> T getJsonHeader(JsonConvert convert, Class<T> clazz, String name) {
|
public <T> T getJsonHeader(JsonConvert convert, Class<T> clazz, String name) {
|
||||||
@@ -629,6 +672,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name header名
|
* @param name header名
|
||||||
* @param defaultValue 默认boolean值
|
* @param defaultValue 默认boolean值
|
||||||
|
*
|
||||||
* @return header值
|
* @return header值
|
||||||
*/
|
*/
|
||||||
public boolean getBooleanHeader(String name, boolean defaultValue) {
|
public boolean getBooleanHeader(String name, boolean defaultValue) {
|
||||||
@@ -640,6 +684,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name header名
|
* @param name header名
|
||||||
* @param defaultValue 默认short值
|
* @param defaultValue 默认short值
|
||||||
|
*
|
||||||
* @return header值
|
* @return header值
|
||||||
*/
|
*/
|
||||||
public short getShortHeader(String name, short defaultValue) {
|
public short getShortHeader(String name, short defaultValue) {
|
||||||
@@ -651,6 +696,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name header名
|
* @param name header名
|
||||||
* @param defaultValue 默认short值
|
* @param defaultValue 默认short值
|
||||||
|
*
|
||||||
* @return header值
|
* @return header值
|
||||||
*/
|
*/
|
||||||
public short getShortHeader(String name, int defaultValue) {
|
public short getShortHeader(String name, int defaultValue) {
|
||||||
@@ -662,6 +708,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name header名
|
* @param name header名
|
||||||
* @param defaultValue 默认int值
|
* @param defaultValue 默认int值
|
||||||
|
*
|
||||||
* @return header值
|
* @return header值
|
||||||
*/
|
*/
|
||||||
public int getIntHeader(String name, int defaultValue) {
|
public int getIntHeader(String name, int defaultValue) {
|
||||||
@@ -673,6 +720,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name header名
|
* @param name header名
|
||||||
* @param defaultValue 默认long值
|
* @param defaultValue 默认long值
|
||||||
|
*
|
||||||
* @return header值
|
* @return header值
|
||||||
*/
|
*/
|
||||||
public long getLongHeader(String name, long defaultValue) {
|
public long getLongHeader(String name, long defaultValue) {
|
||||||
@@ -684,6 +732,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name header名
|
* @param name header名
|
||||||
* @param defaultValue 默认float值
|
* @param defaultValue 默认float值
|
||||||
|
*
|
||||||
* @return header值
|
* @return header值
|
||||||
*/
|
*/
|
||||||
public float getFloatHeader(String name, float defaultValue) {
|
public float getFloatHeader(String name, float defaultValue) {
|
||||||
@@ -695,6 +744,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name header名
|
* @param name header名
|
||||||
* @param defaultValue 默认double值
|
* @param defaultValue 默认double值
|
||||||
|
*
|
||||||
* @return header值
|
* @return header值
|
||||||
*/
|
*/
|
||||||
public double getDoubleHeader(String name, double defaultValue) {
|
public double getDoubleHeader(String name, double defaultValue) {
|
||||||
@@ -716,6 +766,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
* 获取指定的参数值
|
* 获取指定的参数值
|
||||||
*
|
*
|
||||||
* @param name 参数名
|
* @param name 参数名
|
||||||
|
*
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
public String getParameter(String name) {
|
public String getParameter(String name) {
|
||||||
@@ -728,6 +779,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name 参数名
|
* @param name 参数名
|
||||||
* @param defaultValue 默认值
|
* @param defaultValue 默认值
|
||||||
|
*
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
public String getParameter(String name, String defaultValue) {
|
public String getParameter(String name, String defaultValue) {
|
||||||
@@ -741,6 +793,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
* @param <T> 泛型
|
* @param <T> 泛型
|
||||||
* @param clazz 反序列化的类名
|
* @param clazz 反序列化的类名
|
||||||
* @param name 参数名
|
* @param name 参数名
|
||||||
|
*
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
public <T> T getJsonParameter(Class<T> clazz, String name) {
|
public <T> T getJsonParameter(Class<T> clazz, String name) {
|
||||||
@@ -755,6 +808,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
* @param convert JsonConvert对象
|
* @param convert JsonConvert对象
|
||||||
* @param clazz 反序列化的类名
|
* @param clazz 反序列化的类名
|
||||||
* @param name 参数名
|
* @param name 参数名
|
||||||
|
*
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
public <T> T getJsonParameter(JsonConvert convert, Class<T> clazz, String name) {
|
public <T> T getJsonParameter(JsonConvert convert, Class<T> clazz, String name) {
|
||||||
@@ -767,6 +821,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name 参数名
|
* @param name 参数名
|
||||||
* @param defaultValue 默认boolean值
|
* @param defaultValue 默认boolean值
|
||||||
|
*
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
public boolean getBooleanParameter(String name, boolean defaultValue) {
|
public boolean getBooleanParameter(String name, boolean defaultValue) {
|
||||||
@@ -779,6 +834,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name 参数名
|
* @param name 参数名
|
||||||
* @param defaultValue 默认short值
|
* @param defaultValue 默认short值
|
||||||
|
*
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
public short getShortParameter(String name, short defaultValue) {
|
public short getShortParameter(String name, short defaultValue) {
|
||||||
@@ -791,6 +847,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name 参数名
|
* @param name 参数名
|
||||||
* @param defaultValue 默认short值
|
* @param defaultValue 默认short值
|
||||||
|
*
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
public short getShortParameter(String name, int defaultValue) {
|
public short getShortParameter(String name, int defaultValue) {
|
||||||
@@ -803,6 +860,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name 参数名
|
* @param name 参数名
|
||||||
* @param defaultValue 默认int值
|
* @param defaultValue 默认int值
|
||||||
|
*
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
public int getIntParameter(String name, int defaultValue) {
|
public int getIntParameter(String name, int defaultValue) {
|
||||||
@@ -815,6 +873,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name 参数名
|
* @param name 参数名
|
||||||
* @param defaultValue 默认long值
|
* @param defaultValue 默认long值
|
||||||
|
*
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
public long getLongParameter(String name, long defaultValue) {
|
public long getLongParameter(String name, long defaultValue) {
|
||||||
@@ -827,6 +886,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name 参数名
|
* @param name 参数名
|
||||||
* @param defaultValue 默认float值
|
* @param defaultValue 默认float值
|
||||||
|
*
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
public float getFloatParameter(String name, float defaultValue) {
|
public float getFloatParameter(String name, float defaultValue) {
|
||||||
@@ -839,6 +899,7 @@ public class HttpRequest extends Request<HttpContext> {
|
|||||||
*
|
*
|
||||||
* @param name 参数名
|
* @param name 参数名
|
||||||
* @param defaultValue 默认double值
|
* @param defaultValue 默认double值
|
||||||
|
*
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
public double getDoubleParameter(String name, double defaultValue) {
|
public double getDoubleParameter(String name, double defaultValue) {
|
||||||
|
|||||||
Reference in New Issue
Block a user