Hello,
I would like use @Resource annotation in my web service to store service
state (basically for auth). The @Resource works fine, the WebServiceContext
is correctly injected, but I can't get http session from message context. A
code snippet:

        HttpServletRequest request = (HttpServletRequest) context
            .getMessageContext().get(MessageContext.SERVLET_REQUEST);
        return request.getSession();

I've got NullPointerException because servlet_request are not available in
message context. I read on cxf user list that I have to configure jetty
session support
(http://markmail.org/search/?q=cxf+SERVLET_REQUEST#query:cxf%20SERVLET_REQUEST+page:1+mid:x6ci2imys6o7yto4+state:results).

My next steep was extending cxfbc configuration:
    <cxfbc:consumer wsdl="classpath:defbank/defbank.wsdl"
useJBIWrapper="false"
        targetService="defbank:DefapiService"
        targetInterface="defbank:DefapiServiceType"
        busCfg="classpath:jetty.xml">
    </cxfbc:consumer>

This definition is correct. No exception thrown when it starts.

Jetty configuration:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
    xmlns:jetty="http://cxf.apache.org/transports/http-jetty/configuration";
    xmlns:cxf="http://cxf.apache.org/core";
    xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://cxf.apache.org/core
        http://cxf.apache.org/schemas/core.xsd
        http://cxf.apache.org/transports/http-jetty/configuration
        http://cxf.apache.org/schemas/configuration/http-jetty.xsd
    ">

    <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml"
/>

    <cxf:bus name="cxf-bus">
        <cxf:features>
            <cxf:logging />
        </cxf:features>
    </cxf:bus>

    <jetty:engine-factory bus="cxf-bus">
        <httpj:threadingParameters minThreads="5" maxThreads="15" />
        <jetty:engine port="8092">
            <jetty:sessionSupport>true</jetty:sessionSupport>
        </jetty:engine>

    </jetty:engine-factory>

</beans>

I've still no session support and MessageContext contains only application
scope. I attached debugger with breakpoints in jetty configuration classes,
but it does not called. Does cxfbc can ignore http configuration used in
that way?

Regards,
Luke

-----
Lukasz Dywicki,
Integration Developer
http://blog.dywicki.pl/
-- 
View this message in context: 
http://www.nabble.com/CXF-BC-with-custom-jetty-configuration-tp20126234p20126234.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to