JAX-WS Context not injected for RESTful service implementations
---------------------------------------------------------------

                 Key: CXF-558
                 URL: https://issues.apache.org/jira/browse/CXF-558
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
         Environment: Not env specific
            Reporter: Dave Stanley
             Fix For: 2.0-RC


The context is not injected for RESTful services. You can see this by modifying 
the the JUnit testcase below: 

<cxf>/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/CustomerService.java

Added the @Resource annotation as shown below ..

import javax.annotation.Resource;
...

import javax.xml.ws.WebServiceContext;

...

// END SNIPPET: service
@WebService(targetNamespace = "http://cxf.apache.org/jra";)
public class CustomerService {
    long currentId = 1;
    Map<Long, Customer> customers = new HashMap<Long, Customer>();

    @Resource
    private WebServiceContext context;
 
    @Post
    @HttpResource(location = "/customers")
    @WebMethod
    public void addCustomer(@WebParam(name = "customer") Customer c) {
        long id = ++currentId;
        c.setId(id);
        customers.put(id, c);
        
        // Context is null .. 
        MessageContext mc = context.getMessageContext();
   }      



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to