|
From: Sean D. <sea...@gm...> - 2014-04-01 22:29:20
|
So, on this...
On Tue, Mar 18, 2014 at 4:12 PM, Sean Dawson <sea...@gm...>wrote:
>
> On (3 - async), I'm not able to share much of the code related to this and
> I haven't come up with a way to reproduce it using something similar.
> Essentially though, if all I do is change the RestEasy version in my maven
> dependencies from 2.3.3 to 3.0.6, on timeout (5 seconds) I now get a 503 -
> service unavailable, instead of previously a 200 ok (this is from firefox
> directly to jetty server). If an event comes in to dispatch during the 5
> secs, things do work as expected in 3.0.6. We are running under servlet
> 3.0.
>
>
It looks like the (3.0.7 source code) tests and everything are well aware
that a 503 is returned. It certainly wasn't before so I'm not sure
when/why it changed (probably to follow the spec I suspect). Anyway, we
were using...
@Suspend(5000) AsynchronousResponse response
and if there was nothing to return, the response wouldn't get set (and
eventually timeout returning a 200/ok). But if there was something, then
we'd build it along the lines of... (simplified example type here though)...
response.setResponse(Response.ok(new GenericEntity<String>(data, new
ParameterizedType()
{
@Override
public Type getRawType()
{
return String.class;
}
@Override
public Type getOwnerType()
{
return null;
}
@Override
public Type[] getActualTypeArguments()
{
return new Type[]
{
String.class
};
}
})).build());
Now I'm doing...
@Suspended AsyncResponse response
response.setTimeout(10, TimeUnit.SECONDS);
response.setTimeoutHandler(timeoutHandler);
and...
response.resume(data);
Which seems to mostly work - ie. my timeoutHandler does a resume with empty
data, the timeout is observed, we get a 200/ok, and it returns as soon as
we do have data - the problem is the data is not making it to the client -
it ends up being null even though the server resumes with valid data. This
is with gwt, RestyGwt, etc. If I just have the server and go directly
against it from the Firefox RestEasy client, then either I get errors for
not having a MessageBodyWriter for text/html, or if everything is set to
application/json it just never returns on the resume (either on timeout or
on data - ie. client just hangs), or after trying some variations I get a
500 Server Error with no more information in the client or the (development
environment) server (no exceptions, etc).
Any ideas/pointers?
|