* Renamed HttpVersion.getProtocol() to decode()
* A little bit of code clean up
This commit is contained in:
parent
1ff2b7bbc9
commit
796238d929
@ -41,10 +41,8 @@ import org.jboss.netty.buffer.ChannelBuffer;
|
||||
public class DefaultHttpMessage implements HttpMessage {
|
||||
private final static Comparator<String> caseIgnoringComparator = new CaseIgnoringComparator();
|
||||
|
||||
Map<String, List<String>> headers = new TreeMap<String, List<String>>(caseIgnoringComparator);
|
||||
|
||||
private final HttpVersion version;
|
||||
|
||||
private final Map<String, List<String>> headers = new TreeMap<String, List<String>>(caseIgnoringComparator);
|
||||
private ChannelBuffer content;
|
||||
|
||||
protected DefaultHttpMessage(final HttpVersion version) {
|
||||
|
@ -39,7 +39,7 @@ public class HttpRequestDecoder extends HttpMessageDecoder {
|
||||
String line = readIntoCurrentLine(buffer);
|
||||
checkpoint(ResponseState.READ_HEADER);
|
||||
String[] split = splitInitial(line);
|
||||
message = new DefaultHttpRequest(HttpVersion.getProtocol(split[2]), HttpMethod.valueOf(split[0]), new URI(split[1]));
|
||||
message = new DefaultHttpRequest(HttpVersion.decode(split[2]), HttpMethod.valueOf(split[0]), new URI(split[1]));
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,6 @@ public class HttpResponseDecoder extends HttpMessageDecoder {
|
||||
String line = readIntoCurrentLine(buffer);
|
||||
checkpoint(ResponseState.READ_HEADER);
|
||||
String[] split = splitInitial(line);
|
||||
message = new DefaultHttpResponse(HttpVersion.getProtocol(split[0]), new HttpResponseStatus(Integer.valueOf(split[1]), split[2]));
|
||||
message = new DefaultHttpResponse(HttpVersion.decode(split[0]), new HttpResponseStatus(Integer.valueOf(split[1]), split[2]));
|
||||
}
|
||||
}
|
||||
|
@ -30,22 +30,20 @@ package org.jboss.netty.handler.codec.http;
|
||||
*/
|
||||
public enum HttpVersion {
|
||||
HTTP_1_0("HTTP/1.0"),
|
||||
|
||||
HTTP_1_1("HTTP/1.1"),
|
||||
|
||||
UNKNOWN("UNKNOWN"),;
|
||||
|
||||
private String version;
|
||||
private final String version;
|
||||
|
||||
private HttpVersion(String value) {
|
||||
version = value;
|
||||
private HttpVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static HttpVersion getProtocol(String value) {
|
||||
public static HttpVersion decode(String value) {
|
||||
if (value == null) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
|
@ -34,9 +34,7 @@ import java.util.Map;
|
||||
public class QueryStringDecoder {
|
||||
|
||||
private final String uri;
|
||||
|
||||
private String path;
|
||||
|
||||
private final Map<String, List<String>> params = new HashMap<String, List<String>>();
|
||||
|
||||
public QueryStringDecoder(String uri) {
|
||||
|
@ -32,9 +32,8 @@ import java.util.List;
|
||||
*/
|
||||
public class QueryStringEncoder {
|
||||
|
||||
final String url;
|
||||
|
||||
final List<Param> params = new ArrayList<Param>();
|
||||
private final String url;
|
||||
private final List<Param> params = new ArrayList<Param>();
|
||||
|
||||
public QueryStringEncoder(String url) {
|
||||
this.url = url;
|
||||
|
Loading…
Reference in New Issue
Block a user