How to control chunks in jetty? -


i'm writing http webservice may take quite long produce results. use embedded jetty 8.1.5 , jax-rs (apache cxf)

i decided go kind of control protocol: when new request comes, start long-running job in separate thread , periodically write httpoutputstream lines current status ("control_message: 42% done")

the problem jetty uses chunk encoding here, status messages buffered , useless can buffered in single chunk, providing no progress client.

i can't use content-length property don't know end result length. httpoutputstream.flush() doesn't work jetty uses internal buffers.

as see it, need way tell jetty "please finish current chunk , flush it", don't know how.

actually i'm not sure problem chunking. if right writing progress same stream result go?

this can done or without chunking calling flushbuffers on response.

however, depends on connection , browser if makes client. transparent proxy may aggregate content , not flush until response complete or own buffer full. browser might not act on content until response complete or buffer full.

in implementations of comet use technique, have send 512 byes of white space after pushed message.

you'd better off using server sent events, websocket or long polling send progress client..... better yet - use cometd.org, select best transport client available.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -