@Override public List<String> apply(String input) { return headers.getAll(input); } }));
private void resetState() { if (!isDecodingRequest()) { HttpResponse res = (HttpResponse) message; if (res != null && res.getStatus().getCode() == 101) { checkpoint(State.UPGRADED); return; } } checkpoint(State.SKIP_CONTROL_CHARS); }
@Override public ClientResponse<InputStream> handleResponse(HttpResponse response, TrafficCop trafficCop) { returnCode.set(response.getStatus().getCode()); reasonString.set(response.getStatus().getReasonPhrase()); return super.handleResponse(response, trafficCop); } };
@Override protected HttpMessage createMessage(String[] initialLine) throws Exception { return new DefaultHttpRequest( HttpVersion.valueOf(initialLine[2]), HttpMethod.valueOf(initialLine[0]), initialLine[1]); }
protected boolean isSuccess(FullResponseHolder responseHolder) { return responseHolder.getStatus().getCode() / 100 == 2; }
@Override public ChannelPipeline getPipeline() { ChannelPipeline pipeline = new DefaultChannelPipeline(); pipeline.addLast("codec", new HttpClientCodec()); pipeline.addLast("inflater", new HttpContentDecompressor()); return pipeline; } }
/** * Adds a new header with the specified name and value. * If the specified value is not a {@link String}, it is converted into a * {@link String} by {@link Object#toString()}, except for {@link Date} * and {@link Calendar} which are formatted to the date format defined in * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1">RFC2616</a>. */ public static void addHeader(HttpMessage message, String name, Object value) { message.headers().add(name, value); }
public boolean hasGetVersionRequestHeader() { boolean result = false; String headerValue = this.request.getHeader(RestMessageHeaders.X_VOLD_GET_VERSION); if(headerValue != null) { result = true; } return result; }
private Object reset() { HttpMessage message = this.message; ChannelBuffer content = this.content; if (content != null) { message.setContent(content); this.content = null; } resetState(); this.message = null; return message; }
@Override public HttpHeaders add(String name, Object value) { if (validate) { validateName(name); } return super.add(name, value); }
@Override public HttpHeaders set(String name, Object value) { if (validate) { validateName(name); } return super.set(name, value); }
@Override public ClientResponse<AppendableByteArrayInputStream> handleResponse(HttpResponse response, TrafficCop trafficCop) { status = response.getStatus().getCode(); description = response.getStatus().getReasonPhrase(); return ClientResponse.unfinished(super.handleResponse(response, trafficCop).getObj()); }