Another +1 from me. We should encourage alignment whenever we see
potential. Makes the overall development experience smoother.
- Markus
On 25 June 2012 22:16, Reza Rahman <reza_rahman_at_lycos.com> wrote:
> +1
>
>
> On 6/24/2012 7:02 AM, Antonio Goncalves wrote:
>
> Hi all,
>
> I was reading through JAX-RS 2.0 edr3 specification and had some questions
> about the alignment with other specs. First of all I can see that @Context
> is still used to inject UriInfo, HttpHeaders of even servlet resources. When
> I read the spec (§3.2) I see the word Resource in the definition : "@Context
> Injects an instance of a supported resource". So why not use the @Resource
> annotation ? In the case of JAX-RS @Inject looks more appropriate (@Resource
> deals with JNDI names and so on).
>
> For asynchrony (§8) they need to inject an ExecutionContext. Again, this is
> done with @Context, which is a real shame as ExecutionContext sounds like
> SessionContext (which is injected with a @Resource or @Inject). Asynchrony
> in JAX-RS is done with the @Suspend annotation, it has a timeout and a time
> unit attributes (@Suspend(timeOut = 15, timeUnit = TimeUnit.SECONDS)) while
> we have @Asynchronous in EJB (without any attributes). In the spec there is
> even a sample mixing both :
>
> @Stateless
> @Path("/")
> class EJBResource {
>
> @GET @Suspend @Asynchronous
> public void longRunningOp(@Context ExecutionContext ctx) {
> executeLongRunningOp();
> ctx.resume("Hello async world!");
> }
> }
>
> Servlet also has it's own mechanism to deal with asynchronous requests. In
> the EJB group we talked about "standardizing" @Asynchronous and giving it to
> other specifications. Couldn't it be the case with JAX-RS (and Servlet, but
> I think this topic has heavily been debated during Servlet 3.0) ?
>
> And in a more general question, do we really need to push alignment between
> specs when it's possible ?
>
>
> --
> Antonio Goncalves
> Software architect and Java Champion
>
> Web site | Twitter | Blog | LinkedIn | Paris JUG
>
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2012.0.2171 / Virus Database: 2437/5090 - Release Date: 06/24/12
>
>