This commit is contained in:
wentch
2016-01-19 09:23:20 +08:00
parent 3bea4ae232
commit 0d7576ecb1
2 changed files with 14 additions and 10 deletions

View File

@@ -245,7 +245,7 @@ public class HttpRequest extends Request<HttpContext> {
* 获取请求内容指定的编码字符串
*
* @param charset 编码
* @return
* @return 内容
*/
public String getBody(final Charset charset) {
return charset == null ? array.toString() : array.toString(charset);
@@ -254,7 +254,7 @@ public class HttpRequest extends Request<HttpContext> {
/**
* 获取请求内容的UTF-8编码字符串
*
* @return
* @return 内容
*/
public String getBodyUTF8() {
return array.toString(UTF8);
@@ -282,7 +282,7 @@ public class HttpRequest extends Request<HttpContext> {
* 获取文件上传信息列表
*
* @return 文件上传对象集合
* @throws IOException
* @throws IOException IO异常
*/
public final Iterable<MultiPart> multiParts() throws IOException {
return getMultiContext().parts();
@@ -342,7 +342,7 @@ public class HttpRequest extends Request<HttpContext> {
/**
* 更新sessionid
*
* @return
* @return 新的sessionid值
*/
public String changeSessionid() {
this.newsessionid = context.createSessionid();
@@ -575,6 +575,7 @@ public class HttpRequest extends Request<HttpContext> {
/**
* 获取指定的header的json值
*
* @param <T> 泛型
* @param clazz 反序列化的类名
* @param name header名
* @return header值
@@ -587,6 +588,7 @@ public class HttpRequest extends Request<HttpContext> {
/**
* 获取指定的header的json值
*
* @param <T> 泛型
* @param convert JsonConvert对象
* @param clazz 反序列化的类名
* @param name header名
@@ -699,6 +701,7 @@ public class HttpRequest extends Request<HttpContext> {
/**
* 获取指定的参数json值
*
* @param <T> 泛型
* @param clazz 反序列化的类名
* @param name 参数名
* @return 参数值
@@ -711,6 +714,7 @@ public class HttpRequest extends Request<HttpContext> {
/**
* 获取指定的参数json值
*
* @param <T> 泛型
* @param convert JsonConvert对象
* @param clazz 反序列化的类名
* @param name 参数名

View File

@@ -29,8 +29,6 @@ import org.redkale.util.*;
* 详情见: http://www.redkale.org
*
* @author zhangjx
*
* @param <R> HttpRequest的子类型
*/
public class HttpResponse extends Response<HttpContext, HttpRequest> {
@@ -182,7 +180,7 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
/**
* 增加Cookie值
*
* @param cookies
* @param cookies cookie
*/
public void addCookie(HttpCookie... cookies) {
if (this.cookies == null) {
@@ -419,8 +417,9 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
* 将指定文件按响应结果输出
*
* @param file 输出文件
* @throws IOException IO异常
*/
public <A> void finish(File file) throws IOException {
public void finish(File file) throws IOException {
finishFile(file, null);
}
@@ -429,8 +428,9 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
*
* @param file 输出文件
* @param fileBody 文件内容, 没有则输出file
* @throws IOException IO异常
*/
protected <A> void finishFile(final File file, ByteBuffer fileBody) throws IOException {
protected void finishFile(final File file, ByteBuffer fileBody) throws IOException {
if (file == null || !file.isFile() || !file.canRead()) {
finish404();
return;
@@ -475,7 +475,7 @@ public class HttpResponse extends Response<HttpContext, HttpRequest> {
}
}
private <A> void finishFile(ByteBuffer hbuffer, File file, long offset, long length) throws IOException {
private void finishFile(ByteBuffer hbuffer, File file, long offset, long length) throws IOException {
this.channel.write(hbuffer, hbuffer, new TransferFileHandler(AsynchronousFileChannel.open(file.toPath(), options, ((HttpContext) context).getExecutor()), offset, length));
}