This commit is contained in:
Redkale
2016-07-24 12:05:01 +08:00
parent 1aeae47a89
commit 5ae6afa20e
2 changed files with 13 additions and 19 deletions

View File

@@ -286,10 +286,10 @@ public class HttpRequest extends Request<HttpContext> {
@Override
public String toString() {
parseBody();
return this.getClass().getSimpleName() + "{method:" + this.method + ", requestURI:" + this.requestURI
+ ", remoteAddr:" + this.getRemoteAddr() + ", cookies:" + this.cookiestr + ", contentType:" + this.contentType
+ ", connection:" + this.connection + ", protocol:" + this.protocol + ", contentLength:" + this.contentLength
+ ", host:" + this.host + ", bodylength:" + this.array.size() + ", params:" + this.params + ", header:" + this.header + "}";
return this.getClass().getSimpleName() + "{\r\n method: " + this.method + ", \r\n requestURI: " + this.requestURI
+ ", \r\n remoteAddr: " + this.getRemoteAddr() + ", \r\n cookies: " + this.cookiestr + ", \r\n contentType: " + this.contentType
+ ", \r\n connection: " + this.connection + ", \r\n protocol: " + this.protocol + ", \r\n contentLength: " + this.contentLength
+ ", \r\n host: " + this.host + ", \r\n bodylength: " + this.array.size() + ", \r\n params: " + this.params.toString(4) + ", \r\n header: " + this.header.toString(4) + "\r\n}";
}
/**

View File

@@ -12,7 +12,9 @@ import java.util.function.BiPredicate;
/**
* 该类提供类似JSONObject的数据结构主要用于读取xml配置文件和http-header存储
*
* <p> 详情见: http://redkale.org
* <p>
* 详情见: http://redkale.org
*
* @author zhangjx
*/
@SuppressWarnings("unchecked")
@@ -21,25 +23,17 @@ public abstract class AnyValue {
/**
* 可读写的AnyValue默认实现类
*
* <p> 详情见: http://redkale.org
* <p>
* 详情见: http://redkale.org
*
* @author zhangjx
*/
@SuppressWarnings("unchecked")
public static final class DefaultAnyValue extends AnyValue {
public static final BiPredicate<String, String> EQUALS = new BiPredicate<String, String>() { //为了兼容Android
@Override
public boolean test(String name1, String name2) {
return name1.equals(name2);
}
};
public static final BiPredicate<String, String> EQUALS = (name1, name2) -> name1.equals(name2);
public static final BiPredicate<String, String> EQUALSIGNORE = new BiPredicate<String, String>() { //为了兼容Android
@Override
public boolean test(String name1, String name2) {
return name1.equalsIgnoreCase(name2);
}
};
public static final BiPredicate<String, String> EQUALSIGNORE = (name1, name2) -> name1.equalsIgnoreCase(name2);
private final BiPredicate<String, String> predicate;
@@ -331,7 +325,7 @@ public abstract class AnyValue {
return new DefaultAnyValue();
}
protected String toString(int len) {
public String toString(int len) {
if (len < 0) len = 0;
char[] chars = new char[len];
Arrays.fill(chars, ' ');