[
https://issues.apache.org/jira/browse/CXF-750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
willem Jiang resolved CXF-750.
------------------------------
Resolution: Fixed
Fix Version/s: 2.0.1
This issues has been resolved in revision 551517
> Support using Session in standalone
> -----------------------------------
>
> Key: CXF-750
> URL: https://issues.apache.org/jira/browse/CXF-750
> Project: CXF
> Issue Type: Bug
> Components: JAX-WS Runtime
> Reporter: Jervis Liu
> Assignee: willem Jiang
> Fix For: 2.0.1
>
>
> Following code snippet should work when cxf is deployed in standalone mode
> (Jetty):
> @Resource
> private WebServiceContext context;
> public final List<String> ping() {
> MessageContext mc = context.getMessageContext();
> HttpSession session =
> ((javax.servlet.http.HttpServletRequest)mc.get(MessageContext.SERVLET_REQUEST))
> .getSession();
> // Get a session property "counter" from context
> if (session == null) {
> throw new WebServiceException("No session in WebServiceContext");
> }
> Integer counter = (Integer)session.getAttribute("counter");
> if (counter == null) {
> counter = new Integer(0);
> System.out.println("Starting the Session");
> }
> counter = new Integer(counter.intValue() + 1);
> session.setAttribute("counter", counter);
> System.out.println("------------" + counter);
> return counter;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.