I'm using 2.0.11 with the Netty and JSON/Jackson extensions. Right now, I'm
just trying to do a simple server resource:
@Get("json")
public Map<String, Boolean> ping() {
return Collections.singletonMap("ping", Boolean.TRUE);
}
via the NettyServerHelper:
Component component = new Component();
NettyServerHelper netty;
Server server;
server = new Server(Protocol.HTTP, port);
netty = new HttpServerHelper(server);
Injector injector = Guice.createInjector(new APIModule(apiClass));
API theAPI = injector.getInstance(apiClass);
component.getServers().add(netty.getHelped());
// Then attach it to the local host
component.getDefaultHost().attach("/api", theAPI);
// Now, let's start the component!
component.start();
}
and hitting it with my browser at http://localhost:8080/api/ping.json
When I do this, I can see that the proper response is created, for the most
part, except the size of the message is not getting set such that the
NettyServerHelper thinks the response should be chunked due to the code in the
HttpRequestHandler at line 205 gets invoked:
if (httpCall.shouldResponseBeChunked(restletResponse)) {
nettyResponse.addHeader(
HeaderConstants.HEADER_TRANSFER_ENCODING,
"chunked");
}
This causes the client to just endlessly wait for the rest of the message.
As a reference point, I have another project using 2.0.6 w/ the
HttpServerHelper (via the Servlet extension) that is also using Jackson/JSON
and it too doesn't set the size of the message, but it does not display this
problem. In other words, it works.
I've seen other posts that reference similar problems, but I think they were
primarily related to GAE.
Thanks,
Grant
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2924705