You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Jervis Liu (JIRA)" <ji...@apache.org> on 2007/06/28 04:49:26 UTC

[jira] Created: (CXF-750) Support using Session in standalone

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


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.


[jira] Assigned: (CXF-750) Support using Session in standalone

Posted by "willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

willem Jiang reassigned CXF-750:
--------------------------------

    Assignee: willem Jiang

> 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
>
> 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.


[jira] Resolved: (CXF-750) Support using Session in standalone

Posted by "willem Jiang (JIRA)" <ji...@apache.org>.
     [ 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.