dev@jsr311.java.net

RE: Redirection and creation <was> Re: Container Independence

From: Jerome Louvel <jerome.louvel_at_noelios.com>
Date: Thu, 12 Apr 2007 15:11:38 +0200

Dhanji,

> I dont think this is wise as @WebMethod is a jws annotation
> used to expose EJB methods via WSDL-style webservices.
> Neat as it reads, I believe it is too general--not only
> risking conflicts with other apis but purporting to be too
> much (a la RTF/ASF's objection to the use of "rest").

As REST is the architectural style of the Web, I think this usage is
correct, especially because it doesn't restrict us to HTTP per-se and allow
the mapping of other similar protocols to HTTP semantics.

> A more specific naming scheme would serve better:
>
> @RSMethod
> @RSName("/target/{id}")
>
> > @Resource
> > Context ctx;
>
> 'ctx' would need to be a field on the class or a
> parameter of the method
> for standard injection to work. (we could do some byte
> code injection
> :-) but that is tricky!)
>
> I would be wary of supporting @Resource without having a full
> understanding of various deployment targets.
> In EE containers for instance you will need to search jndi
> for a resource named "ctx" (which may have nothing to do with
> the current Context) and potentially support other things
> like auth semantics (or risk confusing the end-user if you dont).
>
> If we're using it simply to mark an injection point for the
> Context artifact, I'd suggest a custom annotation. Leveraging
> @Resource can open the door to a whole lot of stuff to
> consider (or to ignore as the case may be), which can make
> life tough for an end user.
> The other common annotations (@PostConstruct, @PreDestroy)
> also drag us into the world of application containers. Their
> canonical uses (EJBs, JSF beans) have clearly defined ideas
> of scope and lifecycle. Do we have (and do we want to) this
> as a separate discussion?

I'm not as familiar as you but your concerns seems valid. Usage of a
@WebContext annotation would work too.

> return new PermanentRedirect("/target/{orderId}");
>
> I like this one too. And the use of a static factory makes
> this easy to read: return Redirect.to("/target/...");

How is this more complex?

        ctx.permanentRedirect("/target/{orderId}");

Best regards,
Jerome