Hi,
On 03/07/14 13:54, David Karlsen wrote:
OK, that is a strange requirement :) (method annotated with @Context and
matching by having a single argument, and of type MessageContext would be
better IMHO).
I'm not sure it that strange a requirement. While it is likely a
coincidence, you do not have a setJaxwsContext method either :-).
setMessageContext(MessageContext ct)
reads a bit better IMHO but I agree it should be relaxed, wee also used
to have this restriction:
@PathParam("id")
public void setId(String id) {}
where a path parameter name had to match a property name, which I
thought was reasonable, but we relaxed it.
Same would need to be done for Context...
Nevertheless, I changed the name, but it's still not injected (!). is a
problem that this is a normal bean, and not the JAX-RS service class (e.g.
which beans get inspected for injection, all - or just service beans?) Do
you have a postprocessor or something to point be to?
It is injected into valid JAX-RS resource classes, in your case you do
not have JAX-RS annotations at all, apart from @Context which is not
sufficient
Cheers, Sergey
2014-07-03 14:28 GMT+02:00 Sergey Beryozkin <[email protected]>:
The method name has to be "setMessageContext" :-)
I will probably need to relax it the same way it was done for request
parameters but for now the type name should be the setter property name
Sergey
On 03/07/14 13:16, David Karlsen wrote:
Woups, pressed enter to fast, as stated in original mail:
@Context
public void setJaxrsContext( MessageContext jaxrsContext )
{
this.jaxrsContext = jaxrsContext;
}
2014-07-03 14:15 GMT+02:00 David Karlsen <[email protected]>:
But I already have as stated in the mail:
2014-07-03 13:57 GMT+02:00 Sergey Beryozkin <[email protected]>:
On 03/07/14 12:49, David Karlsen wrote:
Sorry, I was a bit quick (or have done some other changes in the mean
time
to break it).
I have this:
@Component
public class ContextHolder
{
private final Logger logger = LoggerFactory.getLogger(
getClass() );
private WebServiceContext webServiceContext;
private MessageContext jaxrsContext;
@Inject
public void setWebServiceContext( WebServiceContext
webServiceContext )
{
this.webServiceContext = webServiceContext;
}
@Context
public void setJaxrsContext( MessageContext jaxrsContext )
{
this.jaxrsContext = jaxrsContext;
}
but jaxrsContext is null!
Do I need to wire up a bean as well?
You need to have 'setMessageContext'.
Cheers, Sergey
2014-07-02 12:07 GMT+02:00 Sergey Beryozkin <[email protected]>:
On 01/07/14 16:33, David Karlsen wrote:
Great - that worked just fine!
Maybe the wiki should be updated?
Sure, I should've done it earlier, Colm reported it too.
I updated the migration page and that wiki page
Cheers, Sergey
2014-07-01 16:27 GMT+02:00 Sergey Beryozkin <[email protected]>:
Hi
On 01/07/14 14:35, David Karlsen wrote:
Looking at
http://cxf.apache.org/docs/jax-rs-and-jax-ws.html "Dealing with
context", a
MessageContext is @Resource injected into the example.
I guess this is a
http://cxf.apache.org/javadoc/latest-3.0.x/org/apache/cxf/
jaxrs/ext/MessageContext.html
with it's imp:
http://cxf.apache.org/javadoc/latest-3.0.x/org/apache/cxf/
jaxrs/ext/MessageContextImpl.html
.
However i don't see a default constructor for it (it requires a
Message),
and such I don't understand how it gets injected in the example -
am
I
missing out of something?
I need to create a utility which get's access to the CXF internal
contexts,
to get access to ResourceInfo, http headers and so on.
Starting from 3.0.0 it needs a @Context annotation. Supporting
@Resource
annotations is limited to 2.7.x only. If it is a singleton then a
thread
safe proxy is injected at startup and then MessageContextImpl
instances
are
inserted into it at runtime
Thanks, Sergey
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com
--
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com