Thanks for the pointer, looks like Grizzley may work :)
http://old.nabble.com/How-to-disable-chunked-encoding--td28585248.html
On Fri, Sep 17, 2010 at 10:37 AM, Paul Sandoz <Paul.Sandoz_at_oracle.com>wrote:
>
> On Sep 16, 2010, at 7:14 AM, Geoff Flarity wrote:
>
> Thanks Paul, I will give this a shot.
>
> Alternatively, is there another simple HTTP Server that might replace the
> sun LW HTTP Server a bit a more configurable?
>
>
> Grizzly or Jetty. But i do not know if either of these have such a
> configuration or not.
>
> You can try asking on the grizzly user list
> mailto:users_at_grizzly.dev.java.net <users_at_grizzly.dev.java.net>
>
> Paul.
>
> Cheers,
> Geoff
>
>
> On Wed, Sep 15, 2010 at 7:55 PM, Paul Sandoz <Paul.Sandoz_at_oracle.com>wrote:
>
>> Hi Geoff,
>>
>> AFAIK there is no switch with the LW HTTP server to turn on and off
>> chunked encoding.
>>
>> The only thing i can think of is to try and use a response filter that
>> buffers:
>>
>> public class BufferResponseFilter implements ContainerResponseFilter {
>>
>> private final class Adapter implements ContainerResponseWriter {
>> private final ContainerResponseWriter crw;
>>
>> private ContainerResponse response;
>>
>> private ByteArrayOutputStream baos;
>>
>> Adapter(ContainerResponseWriter crw) {
>> this.crw = crw;
>> }
>>
>> public OutputStream writeStatusAndHeaders(long contentLength,
>> ContainerResponse response) throws IOException {
>> this.response = response;
>> return this.baos = new ByteArrayOutputStream();
>> }
>> }
>>
>> public void finish() throws IOException {
>> OutputStream out = crw.writeStatusAndHeaders(baos.size(),
>> response);
>> out.write(baos.toByteArray());
>> crw.finish();
>> }
>> }
>>
>> public ContainerResponse filter(ContainerRequest request,
>> ContainerResponse response) {
>> response.setContainerResponseWriter(
>> new Adapter(response.getContainerResponseWriter()));
>> return response;
>> }
>> }
>>
>> ClassNamesResourceConfig r = new ClassNamesResourceConfig(HttpJsonRpc.
>> class);
>> r.getContainerResponseFilters().add(BufferResponseFilter.class);
>> ...
>>
>> Paul.
>>
>> On Sep 14, 2010, at 6:27 PM, Geoff Flarity wrote:
>>
>> Hi,
>>
>> I've been using Jersey to create simple JSONRPC control logic in various
>> daemons I've implemented. For the most part it's been great. However I've
>> run into a bit of a snag as one of the client libraries (python) doesn't
>> handle the chunked encoding properly. Since there's really no need for the
>> chunked encoding with this application I'd like to simply disable it.
>>
>> Try as I might I can't find a way to do so. Here's the server code, the
>> JsonRpc class is just a simple dispatcher using annotations.
>>
>>
>> ClassNamesResourceConfig r = new ClassNamesResourceConfig
>> (HttpJsonRpc.class);
>>
>> try {
>>
>> server = HttpServerFactory.create("http://0.0.0.0:"+port+"/",
>> r);
>>
>> server.start();
>>
>> } catch (java.io.IOException e) {
>>
>> logger.severe("error starting http json rpc server on port "
>> +port);
>>
>> throw new Error("error starting http json rpc server on port
>> "+port, e);
>>
>> }
>>
>> Is it possible to disable this? If so I'd appreciate any pointers in the
>> right direction.
>>
>>
>> Thanks,
>>
>> Geoff
>>
>>
>>
>
>