users@jax-rs-spec.java.net

[jax-rs-spec users] Is executing a JAX-RS 2.0 Invocation twice supported by the spec?

From: <rndgstn_at_gmail.com>
Date: Sun, 24 Jan 2016 00:20:08 +0000 (UTC)

Hi everyone. I believe there is nothing in the JAX-RS 2.0 spec that
says an instance implementing javax.ws.rs.client.Invocation MUST be
executable multiple times, and I am looking for confirmation or
correction on this belief. I want to be able to execute an HTTP call
via the JAX-RS 2.0 Client APIs and have the ability to invoke the exact
same call a second time when the first call fails in a specific way.

Assuming the above is correct -- I can't execute an Invocation (via an
invoke() or a submit() call) multiple times in a manner that is
guaranteed to work across multiple JAX RS implementations (e.g. it must
work in Jersey, RESTEasy, etc.) -- then the closest I think I can come
is an instance of Invocation.Builder. Unfortunately, though,
Invocation.Builder does not get me all the way there because it does
not support associating a method and optionally an entity body with it.
If I wanted to invoke a request multiple times I would at a minimum
need the Invocation.Builder instance plus the method and optional
entity.

I am looking for a way to define a repeatable request using JAX-RS 2.0
in a manner that is supported by the spec and that would therefore be
compatible across implementations -- something equivalent to an
Invocation (which unlike Invocation.Builder has the method and the
entity body associated with it), but repeatable.

I have ideas on how to get around the limitation (assuming I am correct
and it is one), but I would prefer to not have to do that. Is this in
fact a limitation of the JAX RS 2.0 spec?

Ron

PS I posted this on Stackoverflow.com as well:

http://stackoverflow.com/questions/34966970/is-executing-a-jax-rs-2-0-i
nvocation-twice-supported-by-the-spec-and-if-not-is