Package org.apache.axis2.context

Examples of org.apache.axis2.context.SessionContext


    private void fillContextsFromSessionContext(MessageContext msgContext) throws AxisFault {
        AxisService service = msgContext.getAxisService();
        if (service == null) {
            throw new AxisFault(Messages.getMessage("unabletofindservice"));
        }
        SessionContext sessionContext = msgContext.getSessionContext();
        if (sessionContext == null) {
            TransportListener listener = msgContext.getTransportIn().getReceiver();
            sessionContext = listener.getSessionContext(msgContext);
            if (sessionContext == null) {
                createAndFillContexts(service, msgContext, sessionContext);
                return;
            }
        }
        String serviceGroupName = msgContext.getAxisServiceGroup().getServiceGroupName();
        ServiceGroupContext serviceGroupContext =
                sessionContext.getServiceGroupContext(serviceGroupName);
        if (serviceGroupContext != null) {
            //setting service group context
            msgContext.setServiceGroupContext(serviceGroupContext);
            // setting Service context
            msgContext.setServiceContext(serviceGroupContext.getServiceContext(service));
        } else {
            createAndFillContexts(service, msgContext, sessionContext);
        }
        ServiceContext serviceContext = sessionContext.getServiceContext(service);
        //found the serviceContext from session context , so adding that into msgContext
        if (serviceContext != null) {
            msgContext.setServiceContext(serviceContext);
            serviceContext.setProperty(HTTPConstants.COOKIE_STRING, sessionContext.getCookieID());
        }
    }
View Full Code Here


        }

        public SessionContext getSessionContext(MessageContext messageContext) {
            HttpServletRequest req = (HttpServletRequest) messageContext.getProperty(
                    HTTPConstants.MC_HTTP_SERVLETREQUEST);
            SessionContext sessionContext =
                    (SessionContext) req.getSession(true).getAttribute(
                            Constants.SESSION_CONTEXT_PROPERTY);
            String sessionId = req.getSession().getId();
            if (sessionContext == null) {
                sessionContext = new SessionContext(null);
                sessionContext.setCookieID(sessionId);
                req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,
                                              sessionContext);
            }
            messageContext.setSessionContext(sessionContext);
            messageContext.setProperty(AxisServlet.SESSION_ID, sessionId);
View Full Code Here

    private void cleanupServiceGroupContexts() {
        long currentTime = System.currentTimeMillis();
        for (Iterator it = this.sessionmap.keySet().iterator(); it.hasNext();) {
            String cookieID = (String) it.next();
            SessionContext sessionContext = (SessionContext) this.sessionmap.get(cookieID);
            if ((currentTime - sessionContext.getLastTouchedTime()) >
                    sessionContext.sessionContextTimeoutInterval) {
                it.remove();
                Iterator serviceGroupContext = sessionContext.getServiceGroupContext();
                if (serviceGroupContext != null) {
                    while (serviceGroupContext.hasNext()) {
                        ServiceGroupContext groupContext =
                                (ServiceGroupContext) serviceGroupContext.next();
                        cleanupServiceContexts(groupContext);
View Full Code Here

     * @return SessionContext
     */
    public SessionContext getSessionContext(MessageContext messageContext) {
        HttpServletRequest req = (HttpServletRequest) messageContext.getProperty(
                HTTPConstants.MC_HTTP_SERVLETREQUEST);
        SessionContext sessionContext =
                (SessionContext) req.getSession(true).getAttribute(
                        Constants.SESSION_CONTEXT_PROPERTY);
        String sessionId = req.getSession().getId();
        if (sessionContext == null) {
            sessionContext = new SessionContext(null);
            sessionContext.setCookieID(sessionId);
            req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,
                    sessionContext);
        }
        messageContext.setSessionContext(sessionContext);
        messageContext.setProperty(SESSION_ID, sessionId);
View Full Code Here

        super();
        this.sessionmap = new HashMap();
    }

    public synchronized SessionContext getSessionContext(String sessionKey) {
        SessionContext sessionContext = null;
        if (sessionKey != null && sessionKey.length() != 0) {
            sessionContext = (SessionContext) this.sessionmap.get(sessionKey);
        }
        if (sessionContext == null) {
            sessionKey = UUIDGenerator.getUUID();
            sessionContext = new SessionContext(null);
            sessionContext.setCookieID(sessionKey);
            this.sessionmap.put(sessionKey, sessionContext);
        }
        sessionContext.touch();
        cleanupServiceGroupContexts();
        return sessionContext;
    }
View Full Code Here

    private void fillContextsFromSessionContext(MessageContext msgContext) throws AxisFault {
        AxisService service = msgContext.getAxisService();
        if (service == null) {
            throw new AxisFault(Messages.getMessage("unabletofindservice"));
        }
        SessionContext sessionContext = msgContext.getSessionContext();
        if (sessionContext == null) {
            TransportListener listener = msgContext.getTransportIn().getReceiver();
            sessionContext = listener.getSessionContext(msgContext);
            if (sessionContext == null) {
                createAndFillContexts(service, msgContext, sessionContext);
                return;
            }
        }
        String serviceGroupName = msgContext.getAxisServiceGroup().getServiceGroupName();
        ServiceGroupContext serviceGroupContext =
                sessionContext.getServiceGroupContext(serviceGroupName);
        if (serviceGroupContext != null) {
            //setting service group context
            msgContext.setServiceGroupContext(serviceGroupContext);
            // setting Service context
            msgContext.setServiceContext(serviceGroupContext.getServiceContext(service));
        } else {
            createAndFillContexts(service, msgContext, sessionContext);
        }
        ServiceContext serviceContext = sessionContext.getServiceContext(service);
        //found the serviceContext from session context , so adding that into msgContext
        if (serviceContext != null) {
            msgContext.setServiceContext(serviceContext);
            serviceContext.setProperty(HTTPConstants.COOKIE_STRING, sessionContext.getCookieID());
        }
    }
View Full Code Here

        super();
        this.sessionmap = new HashMap<String, SessionContext>();
    }

    public synchronized SessionContext getSessionContext(String sessionKey) {
        SessionContext sessionContext = null;
        if (sessionKey != null && sessionKey.length() != 0) {
            sessionContext = (SessionContext) this.sessionmap.get(sessionKey);
        }
        if (sessionContext == null) {
            sessionKey = UIDGenerator.generateUID();
            sessionContext = new SessionContext(null);
            sessionContext.setCookieID(sessionKey);
            this.sessionmap.put(sessionKey, sessionContext);
        }
        sessionContext.touch();
        cleanupServiceGroupContexts();
        return sessionContext;
    }
View Full Code Here

    private void cleanupServiceGroupContexts() {
        long currentTime = System.currentTimeMillis();
        for (Iterator<String> it = this.sessionmap.keySet().iterator(); it.hasNext();) {
            String cookieID = (String) it.next();
            SessionContext sessionContext = (SessionContext) this.sessionmap.get(cookieID);
            if ((currentTime - sessionContext.getLastTouchedTime()) >
                    sessionContext.sessionContextTimeoutInterval) {
                it.remove();
                Iterator<ServiceGroupContext> serviceGroupContext = sessionContext.getServiceGroupContext();
                if (serviceGroupContext != null) {
                    while (serviceGroupContext.hasNext()) {
                        ServiceGroupContext groupContext =
                                (ServiceGroupContext) serviceGroupContext.next();
                        cleanupServiceContexts(groupContext);
View Full Code Here

        OutputStream out = null;
        try {
            Object sessionContext =
                    httpServletRequest.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
            if (sessionContext == null) {
                sessionContext = new SessionContext(null);
                httpServletRequest.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,
                        sessionContext);
            }

            Enumeration enu = httpServletRequest.getParameterNames();
View Full Code Here

        OutputStream out = null;
        try {
            Object sessionContext =
                    req.getSession().getAttribute(Constants.SESSION_CONTEXT_PROPERTY);
            if (sessionContext == null) {
                sessionContext = new SessionContext(null);
                req.getSession().setAttribute(Constants.SESSION_CONTEXT_PROPERTY,
                        sessionContext);
            }
            msgContext =
                    new MessageContext(configContext,
View Full Code Here

TOP

Related Classes of org.apache.axis2.context.SessionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.