* Forgot to check in the http example code which was affected by the recent refactoring on Cookies
* Removed a FIXME in LocalTransportRegister - it's just an example.
This commit is contained in:
parent
5e64bb66e8
commit
a8d51cfad8
@ -35,7 +35,7 @@ import org.jboss.netty.handler.codec.http.HttpHeaders;
|
||||
import org.jboss.netty.handler.codec.http.HttpMethod;
|
||||
import org.jboss.netty.handler.codec.http.HttpRequest;
|
||||
import org.jboss.netty.handler.codec.http.HttpVersion;
|
||||
import org.jboss.netty.handler.codec.http.HttpCookieEncoder;
|
||||
import org.jboss.netty.handler.codec.http.CookieEncoder;
|
||||
|
||||
/**
|
||||
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||
@ -91,7 +91,7 @@ public class HttpClient {
|
||||
HttpRequest request = new DefaultHttpRequest(
|
||||
HttpVersion.HTTP_1_0, HttpMethod.GET, uri.toASCIIString());
|
||||
request.addHeader(HttpHeaders.Names.HOST, host);
|
||||
HttpCookieEncoder httpCookieEncoder = new HttpCookieEncoder();
|
||||
CookieEncoder httpCookieEncoder = new CookieEncoder();
|
||||
httpCookieEncoder.addCookie("my-cookie", "foo");
|
||||
httpCookieEncoder.addCookie("another-cookie", "bar");
|
||||
request.addHeader(HttpHeaders.Names.COOKIE, httpCookieEncoder.encode());
|
||||
|
@ -35,9 +35,9 @@ import org.jboss.netty.channel.MessageEvent;
|
||||
import org.jboss.netty.channel.SimpleChannelHandler;
|
||||
import org.jboss.netty.handler.codec.http.DefaultHttpResponse;
|
||||
import org.jboss.netty.handler.codec.http.HttpChunk;
|
||||
import org.jboss.netty.handler.codec.http.HttpCookie;
|
||||
import org.jboss.netty.handler.codec.http.HttpCookieDecoder;
|
||||
import org.jboss.netty.handler.codec.http.HttpCookieEncoder;
|
||||
import org.jboss.netty.handler.codec.http.Cookie;
|
||||
import org.jboss.netty.handler.codec.http.CookieDecoder;
|
||||
import org.jboss.netty.handler.codec.http.CookieEncoder;
|
||||
import org.jboss.netty.handler.codec.http.HttpHeaders;
|
||||
import org.jboss.netty.handler.codec.http.HttpRequest;
|
||||
import org.jboss.netty.handler.codec.http.HttpResponse;
|
||||
@ -131,12 +131,12 @@ public class HttpRequestHandler extends SimpleChannelHandler {
|
||||
response.setHeader(HttpHeaders.Names.CONTENT_TYPE, "text/plain; charset=UTF-8");
|
||||
response.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buf.readableBytes()));
|
||||
|
||||
HttpCookieDecoder cookieDecoder = new HttpCookieDecoder();
|
||||
Map<String, HttpCookie> cookies = cookieDecoder.decode(request.getHeader(HttpHeaders.Names.COOKIE));
|
||||
CookieDecoder cookieDecoder = new CookieDecoder();
|
||||
Map<String, Cookie> cookies = cookieDecoder.decode(request.getHeader(HttpHeaders.Names.COOKIE));
|
||||
if(!cookies.isEmpty()) {
|
||||
// Reset the cookies if necessary.
|
||||
HttpCookieEncoder cookieEncoder = new HttpCookieEncoder();
|
||||
for (HttpCookie cookie : cookies.values()) {
|
||||
CookieEncoder cookieEncoder = new CookieEncoder();
|
||||
for (Cookie cookie : cookies.values()) {
|
||||
cookieEncoder.addCookie(cookie);
|
||||
}
|
||||
response.addHeader(HttpHeaders.Names.SET_COOKIE, cookieEncoder.encode());
|
||||
|
@ -37,8 +37,6 @@ import org.jboss.netty.example.echo.EchoHandler;
|
||||
* @author The Netty Project (netty-dev@lists.jboss.org)
|
||||
* @author Andy Taylor (andy.taylor@jboss.org)
|
||||
* @version $Rev$, $Date$
|
||||
*
|
||||
* FIXME: Better name
|
||||
*/
|
||||
public class LocalTransportRegister {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user