SlideShare una empresa de Scribd logo
1 de 37
Descargar para leer sin conexión
Introdução à Programação Orientada para Aspectos,[object Object],Manuel Menezes de Sequeira,[object Object],http://www.google.com/profiles/MMSequeira,[object Object],DCTI,[object Object],ISCTE-IUL,[object Object]
Sumário,[object Object],Motivação,[object Object],Mais um paradigma da programação porquê?,[object Object],Orientação para aspectos,[object Object],Noções elementares de AspectJ,[object Object],Três aplicações,[object Object],Imposição de políticas e verificação de semântica,[object Object],Instrumentação,[object Object],UML dinâmico,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],2,[object Object]
Motivação,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],3,[object Object]
Desenvolvimento,[object Object],Humanos em equipa,[object Object],Somos limitados,[object Object],Lidamos bem com pouca informação,[object Object],Comunicamos com dificuldade,[object Object],Erramos,[object Object],Desenvolvimento adaptado a humanos,[object Object],Abstracção: apenas o essencial em cada passo,[object Object],Encapsulamento: ocultar pormenores irrelevantes,[object Object],Decomposição: divisão do sistema em módulos,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],4,[object Object]
Decomposições,[object Object],Procedimental,[object Object],Rotinas (funções e procedimentos),[object Object],Abordagem descendente ou ascendente,[object Object],Centrada nos Dados (ou Baseada em Objectos),[object Object],Centrada em dados e operações manipuladoras,[object Object],Tipos abstractos de dados,[object Object],Orientada para Objectos,[object Object],Centrada em objectos: responsabilidade, colaboração e comportamento,[object Object],Baseada em classificação,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],5,[object Object]
Preocupações ou facetas (concerns),[object Object],Requisitos funcionais,[object Object],Requisitos não funcionais,[object Object],Controlo de acessos,[object Object],Registo de operações,[object Object],Etc.,[object Object],Preocupações de implementação,[object Object],Protecção contra erros,[object Object],Auxílio à depuração,[object Object],Imposição de políticas de implementação,[object Object],Etc.,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],6,[object Object],Resolvidas através políticas de desenvolvimento,[object Object]
Análise: decomposição principal,[object Object],Levantamento de requisitos,[object Object],Identificação de casos de uso (requisitos funcionais),[object Object],Enumeração,[object Object],Descrição informal (estórias),[object Object],Diagramas de sequência ou colaboração,[object Object],Glossário do domínio,[object Object],Modelo,[object Object],Diagrama de classes/objectos,[object Object],Diagrama de sequência,[object Object],Etc.,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],7,[object Object]
Tirania da decomposição principal,[object Object],Decomposição em objectos permite boa modularização de algumas preocupações,[object Object],Mas não de outras…,[object Object],Exemplo,[object Object],Objectos criados apenas em fábrica,[object Object],Política complexa de controlo de acesso,[object Object],Registo de operações (logging),[object Object],Traçado da execução (tracing),[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],8,[object Object]
Problema,[object Object],Preocupações transversais a decomposição principal,[object Object],Emaranhamento – Várias preocupações no mesmo módulo,[object Object],Espalhamento – Mesma preocupação em vários módulos,[object Object],Necessidade de disciplina do programador: desastre…,[object Object],Código difícil de manter, actualizar, depurar, etc.,[object Object],Exemplo: Controlo de acesso em quase todos os métodos de quase todas as classes do domínio…,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],9,[object Object]
Análise sintáctica de XML no org.apache.tomcat,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],10,[object Object], “Tomcat is a servlet container with a JSP environment. A servlet container is a runtime shell that manages and invokes servlets on behalf of users.”,[object Object], Linhas de código relevantes.,[object Object],© Amiram Yehudai. School of Computer Science. Tel-Aviv University.,[object Object]
Emparelhamento de URL no org.apache.tomcat,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],11,[object Object], Linhas de código relevantes.,[object Object],© Amiram Yehudai. School of Computer Science. Tel-Aviv University.,[object Object]
Registos cronológicos (logs) no org.apache.tomcat,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],12,[object Object],Ops.,[object Object],Espalhamento…,[object Object],Emaranhamento…,[object Object],© Amiram Yehudai. School of Computer Science. Tel-Aviv University.,[object Object]
Mais um paradigma da programação porquê?,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],13,[object Object]
O que se pretende,[object Object],2010-05-19,[object Object],Introdução à Programação Orientada para Aspectos,[object Object],14,[object Object],ApplicationSession,[object Object],StandardSession,[object Object],SessionInterceptor,[object Object],ApplicationSession,[object Object],StandardSession,[object Object],SessionInterceptor,[object Object], private long lastAccessed = creationTime;,[object Object],    private int inactiveInterval = -1;,[object Object], void accessed() {,[object Object],        // set last accessed to thisAccessTime as it will be left over,[object Object],        // from the previous access,[object Object],        lastAccessed = thisAccessTime;,[object Object],        thisAccessTime = System.currentTimeMillis();,[object Object],        validate();,[object Object],    },[object Object],    void validate() {,[object Object],        // if we have an inactive interval, check to see if we've exceeded it,[object Object],        if (inactiveInterval != -1) {,[object Object],            int thisInterval =,[object Object],                (int)(System.currentTimeMillis() - lastAccessed) / 1000;,[object Object],            if (thisInterval > inactiveInterval) {,[object Object],                invalidate();,[object Object],            },[object Object],        },[object Object],    },[object Object], public long getLastAccessedTime() {,[object Object],        if (valid) {,[object Object],            return lastAccessed;,[object Object],        } else {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],    },[object Object], public long getLastAccessedTime() {,[object Object],        return lastAccessed;,[object Object],    },[object Object], private long lastAccessed = creationTime;,[object Object], void accessed() {,[object Object],        // set last accessed to thisAccessTime as it will be left over,[object Object],        // from the previous access,[object Object],        lastAccessed = thisAccessTime;,[object Object],        thisAccessTime = System.currentTimeMillis();,[object Object],    },[object Object],void validate() {,[object Object],        // if we have an inactive interval, check to see if,[object Object],        // we've exceeded it,[object Object],if (inactiveInterval != -1) {,[object Object],            int thisInterval =,[object Object],                (int)(System.currentTimeMillis() - lastAccessed) / 1000;,[object Object],            if (thisInterval > inactiveInterval) {,[object Object],                invalidate();,[object Object],                ServerSessionManager ssm =,[object Object],                    ServerSessionManager.getManager();,[object Object],                ssm.removeSession(this);,[object Object],            },[object Object],        },[object Object],    },[object Object], private long lastAccessedTime = creationTime;,[object Object],/**,[object Object],     * Return the last time the client sent a request associated with this,[object Object],     * session, as the number of milliseconds since midnight, January 1, 1970,[object Object],     * GMT.  Actions that your application takes, such as getting or setting,[object Object],     * a value associated with the session, do not affect the access time.,[object Object],     */,[object Object],    public long getLastAccessedTime() {,[object Object],        return (this.lastAccessedTime);,[object Object],    },[object Object],        this.lastAccessedTime = time;,[object Object],/**,[object Object],     * Update the accessed time information for this session.  This method,[object Object],     * should be called by the context when a request comes in for a particular,[object Object],     * session, even if the application does not reference it.,[object Object],     */,[object Object],    public void access() {,[object Object],        this.lastAccessedTime = this.thisAccessedTime;,[object Object],        this.thisAccessedTime = System.currentTimeMillis();,[object Object],        this.isNew=false;,[object Object],    },[object Object], lastAccessedTime = 0L;,[object Object], lastAccessedTime = ((Long) stream.readObject()).longValue();,[object Object],        maxInactiveInterval = ((Integer) stream.readObject()).intValue();,[object Object],        isNew = ((Boolean) stream.readObject()).booleanValue();,[object Object],stream.writeObject(new Long(lastAccessedTime));,[object Object], sM.accessed(ctx, request, sessionId );,[object Object],public void accessed( Context ctx, Request req, String id ) {,[object Object],        ApplicationSession apS=(ApplicationSession)findSession( ctx, id);,[object Object],        if( apS==null) return;,[object Object],        ServerSession servS=apS.getServerSession();,[object Object],        servS.accessed();,[object Object],        apS.accessed();,[object Object],        // cache it - no need to compute it again,[object Object],        req.setSession( apS );,[object Object],    },[object Object],/**,[object Object],     * Invalidate all sessions that have expired.,[object Object],     */,[object Object],    private void processExpires() {,[object Object],        long timeNow = System.currentTimeMillis();,[object Object],        Session sessions[] = findSessions();,[object Object],        for (int i = 0; i < sessions.length; i++) {,[object Object],            StandardSession session = (StandardSession) sessions[i];,[object Object],            if (!session.isValid()),[object Object],                continue;,[object Object],            int maxInactiveInterval = session.getMaxInactiveInterval();,[object Object],            if (maxInactiveInterval < 0),[object Object],                continue;,[object Object],            int timeIdle = // Truncate, do not round up,[object Object],                (int) ((timeNow - session.getLastAccessedTime()) / 1000L);,[object Object],            if (timeIdle >= maxInactiveInterval),[object Object],                session.expire();,[object Object],        },[object Object],    },[object Object],/**,[object Object],     * Mark the specified session's last accessed time.  This should be,[object Object],     * called for each request by a RequestInterceptor.,[object Object],     *,[object Object],     * @param session The session to be marked,[object Object],     */,[object Object],    public void accessed(Context ctx, Request req, String id) {,[object Object],        HttpSession session=findSession(ctx, id);,[object Object],        if( session == null) return;,[object Object],        if (session instanceof Session),[object Object],            ((Session) session).access();,[object Object],        // cache the HttpSession - avoid another find,[object Object],        req.setSession( session );,[object Object],    },[object Object],StandardManager,[object Object],package org.apache.tomcat.request;,[object Object],import org.apache.tomcat.core.*;,[object Object],import org.apache.tomcat.util.*;,[object Object],import java.io.*;,[object Object],import java.net.*;,[object Object],import java.util.*;,[object Object],import javax.servlet.http.*;,[object Object],/**,[object Object], * Will process the request and determine the session Id, and set it,[object Object], * in the Request.,[object Object], * It also marks the session as accessed.,[object Object], *,[object Object], * This implementation only handles Cookies sessions, please extend or,[object Object], * add new interceptors for other methods.,[object Object], *,[object Object], */,[object Object],public class SessionInterceptor extends  BaseInterceptor implements RequestInterceptor {,[object Object],    // GS, separates the session id from the jvm route,[object Object],    static final char SESSIONID_ROUTE_SEP = '.';,[object Object],    int debug=0;,[object Object],    ContextManager cm;,[object Object],    public SessionInterceptor() {,[object Object],    },[object Object],    public void setDebug( int i ) {,[object Object],        System.out.println("Set debug to " + i);,[object Object],        debug=i;,[object Object],    },[object Object],    public void setContextManager( ContextManager cm ) {,[object Object],        this.cm=cm;,[object Object],    },[object Object],    public int requestMap(Request request ) {,[object Object],        String sessionId = null;,[object Object],        Cookie cookies[]=request.getCookies(); // assert !=null,[object Object],        for( int i=0; i<cookies.length; i++ ) {,[object Object],            Cookie cookie = cookies[i];,[object Object],            if (cookie.getName().equals("JSESSIONID")) {,[object Object],                sessionId = cookie.getValue();,[object Object],                sessionId=validateSessionId(request, sessionId);,[object Object],                if (sessionId!=null){,[object Object],                    request.setRequestedSessionIdFromCookie(true);,[object Object],                },[object Object],            },[object Object],        },[object Object],        String sig=";jsessionid=";,[object Object],        int foundAt=-1;,[object Object],        if( debug>0 ) cm.log(" XXX RURI=" + request.getRequestURI());,[object Object],        if ((foundAt=request.getRequestURI().indexOf(sig))!=-1){,[object Object],            sessionId=request.getRequestURI().substring(foundAt+sig.length());,[object Object],            // rewrite URL, do I need to do anything more?,[object Object],            request.setRequestURI(request.getRequestURI().substring(0, foundAt));,[object Object],            sessionId=validateSessionId(request, sessionId);,[object Object],            if (sessionId!=null){,[object Object],                request.setRequestedSessionIdFromURL(true);,[object Object],            },[object Object],        },[object Object],        return 0;,[object Object],    },[object Object],    // XXX what is the correct behavior if the session is invalid ?,[object Object],    // We may still set it and just return session invalid.,[object Object],    /** Validate and fix the session id. If the session is not valid return null.,[object Object],     *  It will also clean up the session from load-balancing strings.,[object Object],     * @return sessionId, or null if not valid,[object Object],     */,[object Object],    private String validateSessionId(Request request, String sessionId){,[object Object],        // GS, We piggyback the JVM id on top of the session cookie,[object Object],        // Separate them ...,[object Object],        if( debug>0 ) cm.log(" Orig sessionId  " + sessionId );,[object Object],        if (null != sessionId) {,[object Object],            int idex = sessionId.lastIndexOf(SESSIONID_ROUTE_SEP);,[object Object],            if(idex > 0) {,[object Object],                sessionId = sessionId.substring(0, idex);,[object Object],            },[object Object],        },[object Object],        if (sessionId != null && sessionId.length()!=0) {,[object Object],            // GS, We are in a problem here, we may actually get,[object Object],            // multiple Session cookies (one for the root,[object Object],            // context and one for the real context... or old session,[object Object],            // cookie. We must check for validity in the current context.,[object Object],            Context ctx=request.getContext();,[object Object],            SessionManager sM = ctx.getSessionManager();    ,[object Object],            if(null != sM.findSession(ctx, sessionId)) {,[object Object],                sM.accessed(ctx, request, sessionId );,[object Object],                request.setRequestedSessionId(sessionId);,[object Object],                if( debug>0 ) cm.log(" Final session id " + sessionId );,[object Object],                return sessionId;,[object Object],            },[object Object],        },[object Object],        return null;,[object Object],    },[object Object],    public int beforeBody( Request rrequest, Response response ) {,[object Object],        String reqSessionId = response.getSessionId();,[object Object],        if( debug>0 ) cm.log("Before Body " + reqSessionId );,[object Object],        if( reqSessionId==null),[object Object],            return 0;,[object Object],        // GS, set the path attribute to the cookie. This way,[object Object],        // multiple session cookies can be used, one for each,[object Object],        // context.,[object Object],        String sessionPath = rrequest.getContext().getPath();,[object Object],        if(sessionPath.length() == 0) {,[object Object],            sessionPath = "/";,[object Object],        },[object Object],        // GS, piggyback the jvm route on the session id.,[object Object],        if(!sessionPath.equals("/")) {,[object Object],            String jvmRoute = rrequest.getJvmRoute();,[object Object],            if(null != jvmRoute) {,[object Object],                reqSessionId = reqSessionId + SESSIONID_ROUTE_SEP + jvmRoute;,[object Object],            },[object Object],        },[object Object],        Cookie cookie = new Cookie("JSESSIONID",,[object Object],                                   reqSessionId);,[object Object],        cookie.setMaxAge(-1);,[object Object],        cookie.setPath(sessionPath);,[object Object],        cookie.setVersion(1);,[object Object],        response.addHeader( CookieTools.getCookieHeaderName(cookie),,[object Object],                            CookieTools.getCookieHeaderValue(cookie));,[object Object],        cookie.setVersion(0);,[object Object],        response.addHeader( CookieTools.getCookieHeaderName(cookie),,[object Object],                            CookieTools.getCookieHeaderValue(cookie));,[object Object],        return 0;,[object Object],    },[object Object],    /** Notification of context shutdown,[object Object],     */,[object Object],    public void contextShutdown( Context ctx ),[object Object],        throws TomcatException,[object Object],    {,[object Object],        if( ctx.getDebug() > 0 ) ctx.log("Removing sessions from " + ctx );,[object Object],        ctx.getSessionManager().removeSessions(ctx);,[object Object],    },[object Object],},[object Object],StandardManager,[object Object],package org.apache.tomcat.request;,[object Object],import org.apache.tomcat.core.*;,[object Object],import org.apache.tomcat.util.*;,[object Object],import java.io.*;,[object Object],import java.net.*;,[object Object],import java.util.*;,[object Object],import javax.servlet.http.*;,[object Object],/**,[object Object], * Will process the request and determine the session Id, and set it,[object Object], * in the Request.,[object Object], * It also marks the session as accessed.,[object Object], *,[object Object], * This implementation only handles Cookies sessions, please extend or,[object Object], * add new interceptors for other methods.,[object Object], *,[object Object], */,[object Object],public class SessionInterceptor extends  BaseInterceptor implements RequestInterceptor {,[object Object],    // GS, separates the session id from the jvm route,[object Object],    static final char SESSIONID_ROUTE_SEP = '.';,[object Object],    int debug=0;,[object Object],    ContextManager cm;,[object Object],    public SessionInterceptor() {,[object Object],    },[object Object],    public void setDebug( int i ) {,[object Object],        System.out.println("Set debug to " + i);,[object Object],        debug=i;,[object Object],    },[object Object],    public void setContextManager( ContextManager cm ) {,[object Object],        this.cm=cm;,[object Object],    },[object Object],    public int requestMap(Request request ) {,[object Object],        String sessionId = null;,[object Object],        Cookie cookies[]=request.getCookies(); // assert !=null,[object Object],        for( int i=0; i<cookies.length; i++ ) {,[object Object],            Cookie cookie = cookies[i];,[object Object],            if (cookie.getName().equals("JSESSIONID")) {,[object Object],                sessionId = cookie.getValue();,[object Object],                sessionId=validateSessionId(request, sessionId);,[object Object],                if (sessionId!=null){,[object Object],                    request.setRequestedSessionIdFromCookie(true);,[object Object],                },[object Object],            },[object Object],        },[object Object],        String sig=";jsessionid=";,[object Object],        int foundAt=-1;,[object Object],        if( debug>0 ) cm.log(" XXX RURI=" + request.getRequestURI());,[object Object],        if ((foundAt=request.getRequestURI().indexOf(sig))!=-1){,[object Object],            sessionId=request.getRequestURI().substring(foundAt+sig.length());,[object Object],            // rewrite URL, do I need to do anything more?,[object Object],            request.setRequestURI(request.getRequestURI().substring(0, foundAt));,[object Object],            sessionId=validateSessionId(request, sessionId);,[object Object],            if (sessionId!=null){,[object Object],                request.setRequestedSessionIdFromURL(true);,[object Object],            },[object Object],        },[object Object],        return 0;,[object Object],    },[object Object],    // XXX what is the correct behavior if the session is invalid ?,[object Object],    // We may still set it and just return session invalid.,[object Object],    /** Validate and fix the session id. If the session is not valid return null.,[object Object],     *  It will also clean up the session from load-balancing strings.,[object Object],     * @return sessionId, or null if not valid,[object Object],     */,[object Object],    private String validateSessionId(Request request, String sessionId){,[object Object],        // GS, We piggyback the JVM id on top of the session cookie,[object Object],        // Separate them ...,[object Object],        if( debug>0 ) cm.log(" Orig sessionId  " + sessionId );,[object Object],        if (null != sessionId) {,[object Object],            int idex = sessionId.lastIndexOf(SESSIONID_ROUTE_SEP);,[object Object],            if(idex > 0) {,[object Object],                sessionId = sessionId.substring(0, idex);,[object Object],            },[object Object],        },[object Object],        if (sessionId != null && sessionId.length()!=0) {,[object Object],            // GS, We are in a problem here, we may actually get,[object Object],            // multiple Session cookies (one for the root,[object Object],            // context and one for the real context... or old session,[object Object],            // cookie. We must check for validity in the current context.,[object Object],            Context ctx=request.getContext();,[object Object],            SessionManager sM = ctx.getSessionManager();    ,[object Object],            if(null != sM.findSession(ctx, sessionId)) {,[object Object],request.setRequestedSessionId(sessionId);,[object Object],                if( debug>0 ) cm.log(" Final session id " + sessionId );,[object Object],                return sessionId;,[object Object],            },[object Object],        },[object Object],        return null;,[object Object],    },[object Object],    public int beforeBody( Request rrequest, Response response ) {,[object Object],        String reqSessionId = response.getSessionId();,[object Object],        if( debug>0 ) cm.log("Before Body " + reqSessionId );,[object Object],        if( reqSessionId==null),[object Object],            return 0;,[object Object],        // GS, set the path attribute to the cookie. This way,[object Object],        // multiple session cookies can be used, one for each,[object Object],        // context.,[object Object],        String sessionPath = rrequest.getContext().getPath();,[object Object],        if(sessionPath.length() == 0) {,[object Object],            sessionPath = "/";,[object Object],        },[object Object],        // GS, piggyback the jvm route on the session id.,[object Object],        if(!sessionPath.equals("/")) {,[object Object],            String jvmRoute = rrequest.getJvmRoute();,[object Object],            if(null != jvmRoute) {,[object Object],                reqSessionId = reqSessionId + SESSIONID_ROUTE_SEP + jvmRoute;,[object Object],            },[object Object],        },[object Object],        Cookie cookie = new Cookie("JSESSIONID",,[object Object],                                   reqSessionId);,[object Object],        cookie.setMaxAge(-1);,[object Object],        cookie.setPath(sessionPath);,[object Object],        cookie.setVersion(1);,[object Object],        response.addHeader( CookieTools.getCookieHeaderName(cookie),,[object Object],                            CookieTools.getCookieHeaderValue(cookie));,[object Object],        cookie.setVersion(0);,[object Object],        response.addHeader( CookieTools.getCookieHeaderName(cookie),,[object Object],                            CookieTools.getCookieHeaderValue(cookie));,[object Object],        return 0;,[object Object],    },[object Object],    /** Notification of context shutdown,[object Object],     */,[object Object],    public void contextShutdown( Context ctx ),[object Object],        throws TomcatException,[object Object],    {,[object Object],        if( ctx.getDebug() > 0 ) ctx.log("Removing sessions from " + ctx );,[object Object],        ctx.getSessionManager().removeSessions(ctx);,[object Object],    },[object Object],},[object Object],/*,[object Object], * ====================================================================,[object Object], *,[object Object], * The Apache Software License, Version 1.1,[object Object], *,[object Object], * Copyright (c) 1999 The Apache Software Foundation.  All rights,[object Object], * reserved.,[object Object], *,[object Object], * Redistribution and use in source and binary forms, with or without,[object Object], * modification, are permitted provided that the following conditions,[object Object], * are met:,[object Object], *,[object Object], * 1. Redistributions of source code must retain the above copyright,[object Object], *    notice, this list of conditions and the following disclaimer.,[object Object], *,[object Object], * 2. Redistributions in binary form must reproduce the above copyright,[object Object], *    notice, this list of conditions and the following disclaimer in,[object Object], *    the documentation and/or other materials provided with the,[object Object], *    distribution.,[object Object], *,[object Object], * 3. The end-user documentation included with the redistribution, if,[object Object], *    any, must include the following acknowlegement:,[object Object], *       "This product includes software developed by the,[object Object], *        Apache Software Foundation (http://www.apache.org/).",[object Object], *    Alternately, this acknowlegement may appear in the software,[object Object],itself,,[object Object], *    if and wherever such third-party acknowlegements normally appear.,[object Object], *,[object Object], * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software,[object Object], *    Foundation" must not be used to endorse or promote products,[object Object],derived,[object Object], *    from this software without prior written permission. For written,[object Object], *    permission, please contact apache@apache.org.,[object Object], *,[object Object], * 5. Products derived from this software may not be called "Apache",[object Object], *    nor may "Apache" appear in their names without prior written,[object Object], *    permission of the Apache Group.,[object Object], *,[object Object], * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED,[object Object], * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES,[object Object], * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE,[object Object], * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR,[object Object], * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,,[object Object], * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT,[object Object], * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF,[object Object], * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND,[object Object], * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,,[object Object], * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT,[object Object], * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF,[object Object], * SUCH DAMAGE.,[object Object], * ====================================================================,[object Object], *,[object Object], * This software consists of voluntary contributions made by many,[object Object], * individuals on behalf of the Apache Software Foundation.  For more,[object Object], * information on the Apache Software Foundation, please see,[object Object], * <http://www.apache.org/>.,[object Object], *,[object Object], * [Additional notices, if required by prior licensing conditions],[object Object], *,[object Object], */,[object Object],package org.apache.tomcat.session;,[object Object],import org.apache.tomcat.core.*;,[object Object],import org.apache.tomcat.util.StringManager;,[object Object],import java.io.*;,[object Object],import java.net.*;,[object Object],import java.util.*;,[object Object],import javax.servlet.*;,[object Object],import javax.servlet.http.*;,[object Object],/**,[object Object], * Core implementation of an application level session,[object Object], *,[object Object], * @author James Duncan Davidson [duncan@eng.sun.com],[object Object], * @author Jason Hunter [jch@eng.sun.com],[object Object], * @author James Todd [gonzo@eng.sun.com],[object Object], */,[object Object],public class ApplicationSession implements HttpSession {,[object Object],    private StringManager sm =,[object Object],        StringManager.getManager("org.apache.tomcat.session");,[object Object],    private Hashtable values = new Hashtable();,[object Object],    private String id;,[object Object],    private ServerSession serverSession;,[object Object],    private Context context;,[object Object],    private long creationTime = System.currentTimeMillis();;,[object Object],    private long thisAccessTime = creationTime;,[object Object],    private long lastAccessed = creationTime;,[object Object],    private int inactiveInterval = -1;,[object Object],    private boolean valid = true;,[object Object],    ApplicationSession(String id, ServerSession serverSession,,[object Object],        Context context) {,[object Object],        this.serverSession = serverSession;,[object Object],        this.context = context;,[object Object],        this.id = id;,[object Object],        this.inactiveInterval = context.getSessionTimeOut();,[object Object],        if (this.inactiveInterval != -1) {,[object Object],            this.inactiveInterval *= 60;,[object Object],        },[object Object],    },[object Object],    ServerSession getServerSession() {,[object Object],        return serverSession;,[object Object],    },[object Object],    /**,[object Object],     * Called by context when request comes in so that accesses and,[object Object],     * inactivities can be dealt with accordingly.,[object Object],     */,[object Object],    void accessed() {,[object Object],        // set last accessed to thisAccessTime as it will be left over,[object Object],        // from the previous access,[object Object],        lastAccessed = thisAccessTime;,[object Object],        thisAccessTime = System.currentTimeMillis();,[object Object],        validate();,[object Object],    },[object Object],    void validate() {,[object Object],        // if we have an inactive interval, check to see if we've exceeded it,[object Object],        if (inactiveInterval != -1) {,[object Object],            int thisInterval =,[object Object],                (int)(System.currentTimeMillis() - lastAccessed) / 1000;,[object Object],            if (thisInterval > inactiveInterval) {,[object Object],                invalidate();,[object Object],            },[object Object],        },[object Object],    },[object Object],    // HTTP SESSION IMPLEMENTATION METHODS,[object Object],    public String getId() {,[object Object],        if (valid) {,[object Object],            return id;,[object Object],        } else {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],    },[object Object],    public long getCreationTime() {,[object Object],        if (valid) {,[object Object],            return creationTime;,[object Object],        } else {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],    },[object Object],    /**,[object Object],     *,[object Object],     * @deprecated,[object Object],     */,[object Object],    public HttpSessionContext getSessionContext() {,[object Object],        return new SessionContextImpl();,[object Object],    },[object Object],    public long getLastAccessedTime() {,[object Object],        if (valid) {,[object Object],            return lastAccessed;,[object Object],        } else {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],    },[object Object],public void invalidate() {,[object Object],        serverSession.removeApplicationSession(context);,[object Object],        // remove everything in the session,[object Object],        Enumeration enum = values.keys();,[object Object],        while (enum.hasMoreElements()) {,[object Object],            String name = (String)enum.nextElement();,[object Object],            removeValue(name);,[object Object],        },[object Object],        valid = false;,[object Object],    },[object Object],    public boolean isNew() {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        if (thisAccessTime == creationTime) {,[object Object],            return true;,[object Object],        } else {,[object Object],            return false;,[object Object],        },[object Object],    },[object Object],/**,[object Object],     * @deprecated,[object Object],     */,[object Object],    public void putValue(String name, Object value) {,[object Object],        setAttribute(name, value);,[object Object],    },[object Object],    public void setAttribute(String name, Object value) {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        if (name == null) {,[object Object],            String msg = sm.getString("applicationSession.value.iae");,[object Object],            throw new IllegalArgumentException(msg);,[object Object],        },[object Object],        removeValue(name);  // remove any existing binding,[object Object],        if (value != null && value instanceof HttpSessionBindingListener) {,[object Object],            HttpSessionBindingEvent e =,[object Object],                new HttpSessionBindingEvent(this, name);,[object Object],            ((HttpSessionBindingListener)value).valueBound(e);,[object Object],        },[object Object],        values.put(name, value);,[object Object],    },[object Object],    /**,[object Object],     * @deprecated,[object Object],     */,[object Object],    public Object getValue(String name) {,[object Object],        return getAttribute(name);,[object Object],    },[object Object],    public Object getAttribute(String name) {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        if (name == null) {,[object Object],            String msg = sm.getString("applicationSession.value.iae");,[object Object],            throw new IllegalArgumentException(msg);,[object Object],        },[object Object],        return values.get(name);,[object Object],    },[object Object],    /**,[object Object],     * @deprecated,[object Object],     */,[object Object],    public String[] getValueNames() {,[object Object],        Enumeration e = getAttributeNames();,[object Object],        Vector names = new Vector();,[object Object],        while (e.hasMoreElements()) {,[object Object],            names.addElement(e.nextElement());,[object Object],        },[object Object],        String[] valueNames = new String[names.size()];,[object Object],        names.copyInto(valueNames);,[object Object],        return valueNames;,[object Object],    },[object Object],    public Enumeration getAttributeNames() {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        Hashtable valuesClone = (Hashtable)values.clone();,[object Object],        return (Enumeration)valuesClone.keys();,[object Object],    },[object Object], /**,[object Object],     * @deprecated,[object Object],     */,[object Object],    public void removeValue(String name) {,[object Object],        removeAttribute(name);,[object Object],    },[object Object],    public void removeAttribute(String name) {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        if (name == null) {,[object Object],            String msg = sm.getString("applicationSession.value.iae");,[object Object],            throw new IllegalArgumentException(msg);,[object Object],        },[object Object],        Object o = values.get(name);,[object Object],        if (o instanceof HttpSessionBindingListener) {,[object Object],            HttpSessionBindingEvent e =,[object Object],                new HttpSessionBindingEvent(this,name);,[object Object],            ((HttpSessionBindingListener)o).valueUnbound(e);,[object Object],        },[object Object],        values.remove(name);,[object Object],    },[object Object],    public void setMaxInactiveInterval(int interval) {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        inactiveInterval = interval;,[object Object],    },[object Object],    public int getMaxInactiveInterval() {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        return inactiveInterval;,[object Object],    },[object Object],},[object Object],//-----------------------------------------------------------------------,[object Object],package org.apache.tomcat.session;,[object Object],import java.io.IOException;,[object Object],import java.io.ObjectInputStream;,[object Object],import java.io.ObjectOutputStream;,[object Object],import java.io.Serializable;,[object Object],import java.util.Enumeration;,[object Object],import java.util.Hashtable;,[object Object],import java.util.Vector;,[object Object],import javax.servlet.ServletException;,[object Object],import javax.servlet.http.HttpSession;,[object Object],import javax.servlet.http.HttpSessionBindingEvent;,[object Object],import javax.servlet.http.HttpSessionBindingListener;,[object Object],import javax.servlet.http.HttpSessionContext;,[object Object],import org.apache.tomcat.catalina.*;,[object Object],import org.apache.tomcat.util.StringManager;,[object Object],/**,[object Object], * Standard implementation of the <b>Session</b> interface.  This object is,[object Object], * serializable, so that it can be stored in persistent storage or transferred,[object Object], * to a different JVM for distributable session support.,[object Object], * <p>,[object Object], * <b>IMPLEMENTATION NOTE</b>:  An instance of this class represents both the,[object Object], * internal (Session) and application level (HttpSession) view of the session.,[object Object], * However, because the class itself is not declared public, Java logic outside,[object Object], * of the <code>org.apache.tomcat.session</code> package cannot cast an,[object Object], * HttpSession view of this instance back to a Session view.,[object Object], *,[object Object], * @author Craig R. McClanahan,[object Object], * @version $Revision: 1.2 $ $Date: 2000/05/15 17:54:10 $,[object Object], */,[object Object],final class StandardSession,[object Object],    implements HttpSession, Session {,[object Object],    // ----------------------------------------------------------- Constructors,[object Object],    /**,[object Object],     * Construct a new Session associated with the specified Manager.,[object Object],     *,[object Object],     * @param manager The manager with which this Session is associated,[object Object],     */,[object Object],    public StandardSession(Manager manager) {,[object Object],        super();,[object Object],        this.manager = manager;,[object Object],    },[object Object],    // ----------------------------------------------------- Instance Variables,[object Object],    /**,[object Object],     * The collection of user data attributes associated with this Session.,[object Object],     */,[object Object],    private Hashtable attributes = new Hashtable();,[object Object],    /**,[object Object],     * The time this session was created, in milliseconds since midnight,,[object Object],     * January 1, 1970 GMT.,[object Object],     */,[object Object],    private long creationTime = 0L;,[object Object],    /**,[object Object],     * The session identifier of this Session.,[object Object],     */,[object Object],    private String id = null;,[object Object],    /**,[object Object],     * Descriptive information describing this Session implementation.,[object Object],     */,[object Object],    private static final String info = "StandardSession/1.0";,[object Object],    /**,[object Object],     * The last accessed time for this Session.,[object Object],     */,[object Object],    private long lastAccessedTime = creationTime;,[object Object],/**,[object Object],     * The Manager with which this Session is associated.,[object Object],     */,[object Object],    private Manager manager = null;,[object Object],    /**,[object Object],     * The maximum time interval, in seconds, between client requests before,[object Object],     * the servlet container may invalidate this session.  A negative time,[object Object],     * indicates that the session should never time out.,[object Object],     */,[object Object],    private int maxInactiveInterval = -1;,[object Object],    /**,[object Object],     * Flag indicating whether this session is new or not.,[object Object],     */,[object Object],    private boolean isNew = true;,[object Object],    /**,[object Object],     * Flag indicating whether this session is valid or not.,[object Object],     */,[object Object],    private boolean isValid = false;,[object Object],    /**,[object Object],     * The string manager for this package.,[object Object],     */,[object Object],    private StringManager sm =,[object Object],        StringManager.getManager("org.apache.tomcat.session");,[object Object],    /**,[object Object],     * The HTTP session context associated with this session.,[object Object],     */,[object Object],    private static HttpSessionContext sessionContext = null;,[object Object],    /**,[object Object],     * The current accessed time for this session.,[object Object],     */,[object Object],    private long thisAccessedTime = creationTime;,[object Object],    // ----------------------------------------------------- Session Properties,[object Object],    /**,[object Object],     * Set the creation time for this session.  This method is called by the,[object Object],     * Manager when an existing Session instance is reused.,[object Object],     *,[object Object],     * @param time The new creation time,[object Object],     */,[object Object],    public void setCreationTime(long time) {,[object Object],        this.creationTime = time;,[object Object],        this.lastAccessedTime = time;,[object Object],        this.thisAccessedTime = time;,[object Object],    },[object Object],    /**,[object Object],     * Return the session identifier for this session.,[object Object],     */,[object Object],    public String getId() {,[object Object],        return (this.id);,[object Object],    },[object Object],    /**,[object Object],     * Set the session identifier for this session.,[object Object],     *,[object Object],     * @param id The new session identifier,[object Object],     */,[object Object],    public void setId(String id) {,[object Object],        if ((this.id != null) && (manager != null) &&,[object Object],          (manager instanceof ManagerBase)),[object Object],            ((ManagerBase) manager).remove(this);,[object Object],        this.id = id;,[object Object],        if ((manager != null) && (manager instanceof ManagerBase)),[object Object],            ((ManagerBase) manager).add(this);,[object Object],    },[object Object],    /**,[object Object],     * Return descriptive information about this Session implementation and,[object Object],     * the corresponding version number, in the format,[object Object],     * <code>&lt;description&gt;/&lt;version&gt;</code>.,[object Object],     */,[object Object],    public String getInfo() {,[object Object],        return (this.info);,[object Object],    },[object Object],/**,[object Object],     * Return the last time the client sent a request associated with this,[object Object],     * session, as the number of milliseconds since midnight, January 1, 1970,[object Object],     * GMT.  Actions that your application takes, such as getting or setting,[object Object],     * a value associated with the session, do not affect the access time.,[object Object],     */,[object Object],    public long getLastAccessedTime() {,[object Object],        return (this.lastAccessedTime);,[object Object],    },[object Object],/**,[object Object],     * Return the Manager within which this Session is valid.,[object Object],     */,[object Object],    public Manager getManager() {,[object Object],        return (this.manager);,[object Object],    },[object Object],    /**,[object Object],     * Set the Manager within which this Session is valid.,[object Object],     *,[object Object],     * @param manager The new Manager,[object Object],     */,[object Object],    public void setManager(Manager manager) {,[object Object],        this.manager = manager;,[object Object],    },[object Object],    /**,[object Object],     * Return the maximum time interval, in seconds, between client requests,[object Object],     * before the servlet container will invalidate the session.  A negative,[object Object],     * time indicates that the session should never time out.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on,[object Object],     *  an invalidated session,[object Object],     */,[object Object],    public int getMaxInactiveInterval() {,[object Object],        return (this.maxInactiveInterval);,[object Object],    },[object Object],    /**,[object Object],     * Set the maximum time interval, in seconds, between client requests,[object Object],     * before the servlet container will invalidate the session.  A negative,[object Object],     * time indicates that the session should never time out.,[object Object],     *,[object Object],     * @param interval The new maximum interval,[object Object],     */,[object Object],    public void setMaxInactiveInterval(int interval) {,[object Object],        this.maxInactiveInterval = interval;,[object Object],    },[object Object],    /**,[object Object],     * Return the <code>HttpSession</code> for which this object,[object Object],     * is the facade.,[object Object],     */,[object Object],    public HttpSession getSession() {,[object Object],        return ((HttpSession) this);,[object Object],    },[object Object],    // ------------------------------------------------- Session Public Methods,[object Object],/**,[object Object],     * Update the accessed time information for this session.  This method,[object Object],     * should be called by the context when a request comes in for a particular,[object Object],     * session, even if the application does not reference it.,[object Object],     */,[object Object],    public void access() {,[object Object],        this.lastAccessedTime = this.thisAccessedTime;,[object Object],        this.thisAccessedTime = System.currentTimeMillis();,[object Object],        this.isNew=false;,[object Object],    },[object Object],    /**,[object Object],     * Perform the internal processing required to invalidate this session,,[object Object],     * without triggering an exception if the session has already expired.,[object Object],     */,[object Object],    public void expire() {,[object Object],        // Remove this session from our manager's active sessions,[object Object],        if ((manager != null) && (manager instanceof ManagerBase)),[object Object],            ((ManagerBase) manager).remove(this);,[object Object],        // Unbind any objects associated with this session,[object Object],        Vector results = new Vector();,[object Object],        Enumeration attrs = getAttributeNames();,[object Object],        while (attrs.hasMoreElements()) {,[object Object],            String attr = (String) attrs.nextElement();,[object Object],            results.addElement(attr);,[object Object],        },[object Object],        Enumeration names = results.elements();,[object Object],        while (names.hasMoreElements()) {,[object Object],            String name = (String) names.nextElement();,[object Object],            removeAttribute(name);,[object Object],        },[object Object],        // Mark this session as invalid,[object Object],        setValid(false);,[object Object],    },[object Object],    /**,[object Object],     * Release all object references, and initialize instance variables, in,[object Object],     * preparation for reuse of this object.,[object Object],     */,[object Object],    public void recycle() {,[object Object],        // Reset the instance variables associated with this Session,[object Object],        attributes.clear();,[object Object],        creationTime = 0L;,[object Object],        id = null;,[object Object],        lastAccessedTime = 0L;,[object Object],        manager = null;,[object Object],        maxInactiveInterval = -1;,[object Object],        isNew = true;,[object Object],        isValid = false;,[object Object],        // Tell our Manager that this Session has been recycled,[object Object],        if ((manager != null) && (manager instanceof ManagerBase)),[object Object],            ((ManagerBase) manager).recycle(this);,[object Object],    },[object Object],    // ------------------------------------------------ Session Package Methods,[object Object],    /**,[object Object],     * Return the <code>isValid</code> flag for this session.,[object Object],     */,[object Object],    boolean isValid() {,[object Object],        return (this.isValid);,[object Object],    },[object Object],    /**,[object Object],     * Set the <code>isNew</code> flag for this session.,[object Object],     *,[object Object],     * @param isNew The new value for the <code>isNew</code> flag,[object Object],     */,[object Object],    void setNew(boolean isNew) {,[object Object],        this.isNew = isNew;,[object Object],    },[object Object],    /**,[object Object],     * Set the <code>isValid</code> flag for this session.,[object Object],     *,[object Object],     * @param isValid The new value for the <code>isValid</code> flag,[object Object],     */,[object Object],    void setValid(boolean isValid) {,[object Object],        this.isValid = isValid;,[object Object],    },[object Object],    // ------------------------------------------------- HttpSession Properties,[object Object],    /**,[object Object],     * Return the time when this session was created, in milliseconds since,[object Object],     * midnight, January 1, 1970 GMT.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public long getCreationTime() {,[object Object],        return (this.creationTime);,[object Object],    },[object Object],    /**,[object Object],     * Return the session context with which this session is associated.,[object Object],     *,[object Object],     * @deprecated As of Version 2.1, this method is deprecated and has no,[object Object],     *  replacement.  It will be removed in a future version of the,[object Object],     *  Java Servlet API.,[object Object],     */,[object Object],    public HttpSessionContext getSessionContext() {,[object Object],        if (sessionContext == null),[object Object],            sessionContext = new StandardSessionContext();,[object Object],        return (sessionContext);,[object Object],    },[object Object],    // ----------------------------------------------HttpSession Public Methods,[object Object],    /**,[object Object],     * Return the object bound with the specified name in this session, or,[object Object],     * <code>null</code> if no object is bound with that name.,[object Object],     *,[object Object],     * @param name Name of the attribute to be returned,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public Object getAttribute(String name) {,[object Object],        return (attributes.get(name));,[object Object],    },[object Object],    /**,[object Object],     * Return an <code>Enumeration</code> of <code>String</code> objects,[object Object],     * containing the names of the objects bound to this session.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public Enumeration getAttributeNames() {,[object Object],        return (attributes.keys());,[object Object],    },[object Object],    /**,[object Object],     * Return the object bound with the specified name in this session, or,[object Object],     * <code>null</code> if no object is bound with that name.,[object Object],     *,[object Object],     * @param name Name of the value to be returned,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     *,[object Object],     * @deprecated As of Version 2.2, this method is replaced by,[object Object],     *  <code>getAttribute()</code>,[object Object],     */,[object Object],    public Object getValue(String name) {,[object Object],        return (getAttribute(name));,[object Object],    },[object Object],    /**,[object Object],     * Return the set of names of objects bound to this session.  If there,[object Object],     * are no such objects, a zero-length array is returned.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     *,[object Object],     * @deprecated As of Version 2.2, this method is replaced by,[object Object],     *  <code>getAttributeNames()</code>,[object Object],     */,[object Object],    public String[] getValueNames() {,[object Object],        Vector results = new Vector();,[object Object],        Enumeration attrs = getAttributeNames();,[object Object],        while (attrs.hasMoreElements()) {,[object Object],            String attr = (String) attrs.nextElement();,[object Object],            results.addElement(attr);,[object Object],        },[object Object],        String names[] = new String[results.size()];,[object Object],        for (int i = 0; i < names.length; i++),[object Object],            names[i] = (String) results.elementAt(i);,[object Object],        return (names);,[object Object],    },[object Object],    /**,[object Object],     * Invalidates this session and unbinds any objects bound to it.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on,[object Object],     *  an invalidated session,[object Object],     */,[object Object],    public void invalidate() {,[object Object],        // Cause this session to expire,[object Object],        expire();,[object Object],    },[object Object],    /**,[object Object],     * Return <code>true</code> if the client does not yet know about the,[object Object],     * session, or if the client chooses not to join the session.  For,[object Object],     * example, if the server used only cookie-based sessions, and the client,[object Object],     * has disabled the use of cookies, then a session would be new on each,[object Object],     * request.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public boolean isNew() {,[object Object],        return (this.isNew);,[object Object],    },[object Object], /**,[object Object],     * Bind an object to this session, using the specified name.  If an object,[object Object],     * of the same name is already bound to this session, the object is,[object Object],     * replaced.,[object Object],     * <p>,[object Object],     * After this method executes, and if the object implements,[object Object],     * <code>HttpSessionBindingListener</code>, the container calls,[object Object],     * <code>valueBound()</code> on the object.,[object Object],     *,[object Object],     * @param name Name to which the object is bound, cannot be null,[object Object],     * @param value Object to be bound, cannot be null,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     *,[object Object],     * @deprecated As of Version 2.2, this method is replaced by,[object Object],     *  <code>setAttribute()</code>,[object Object],     */,[object Object],    public void putValue(String name, Object value) {,[object Object],        setAttribute(name, value);,[object Object],    },[object Object],    /**,[object Object],     * Remove the object bound with the specified name from this session.  If,[object Object],     * the session does not have an object bound with this name, this method,[object Object],     * does nothing.,[object Object],     * <p>,[object Object],     * After this method executes, and if the object implements,[object Object],     * <code>HttpSessionBindingListener</code>, the container calls,[object Object],     * <code>valueUnbound()</code> on the object.,[object Object],     *,[object Object],     * @param name Name of the object to remove from this session.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public void removeAttribute(String name) {,[object Object],        synchronized (attributes) {,[object Object],            Object object = attributes.get(name);,[object Object],            if (object == null),[object Object],                return;,[object Object],            attributes.remove(name);,[object Object],            //      System.out.println( "Removing attribute " + name );,[object Object],            if (object instanceof HttpSessionBindingListener) {,[object Object],                ((HttpSessionBindingListener) object).valueUnbound,[object Object],                    (new HttpSessionBindingEvent((HttpSession) this, name));,[object Object],            },[object Object],        },[object Object],    },[object Object],    /**,[object Object],     * Remove the object bound with the specified name from this session.  If,[object Object],     * the session does not have an object bound with this name, this method,[object Object],     * does nothing.,[object Object],     * <p>,[object Object],     * After this method executes, and if the object implements,[object Object],     * <code>HttpSessionBindingListener</code>, the container calls,[object Object],     * <code>valueUnbound()</code> on the object.,[object Object],     *,[object Object],     * @param name Name of the object to remove from this session.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     *,[object Object],     * @deprecated As of Version 2.2, this method is replaced by,[object Object],     *  <code>removeAttribute()</code>,[object Object],     */,[object Object],    public void removeValue(String name) {,[object Object],        removeAttribute(name);,[object Object],    },[object Object],    /**,[object Object],     * Bind an object to this session, using the specified name.  If an object,[object Object],     * of the same name is already bound to this session, the object is,[object Object],     * replaced.,[object Object],     * <p>,[object Object],     * After this method executes, and if the object implements,[object Object],     * <code>HttpSessionBindingListener</code>, the container calls,[object Object],     * <code>valueBound()</code> on the object.,[object Object],     *,[object Object],     * @param name Name to which the object is bound, cannot be null,[object Object],     * @param value Object to be bound, cannot be null,[object Object],     *,[object Object],     * @exception IllegalArgumentException if an attempt is made to add a,[object Object],     *  non-serializable object in an environment marked distributable.,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public void setAttribute(String name, Object value) {,[object Object],        if ((manager != null) && manager.getDistributable() &&,[object Object],          !(value instanceof Serializable)),[object Object],            throw new IllegalArgumentException,[object Object],                (sm.getString("standardSession.setAttribute.iae"));,[object Object],        synchronized (attributes) {,[object Object],            removeAttribute(name);,[object Object],            attributes.put(name, value);,[object Object],            if (value instanceof HttpSessionBindingListener),[object Object],                ((HttpSessionBindingListener) value).valueBound,[object Object],                    (new HttpSessionBindingEvent((HttpSession) this, name));,[object Object],        },[object Object],    },[object Object],    // -------------------------------------------- HttpSession Private Methods,[object Object],    /**,[object Object],     * Read a serialized version of this session object from the specified,[object Object],     * object input stream.,[object Object],     * <p>,[object Object],     * <b>IMPLEMENTATION NOTE</b>:  The reference to the owning Manager,[object Object],     * is not restored by this method, and must be set explicitly.,[object Object],     *,[object Object],     * @param stream The input stream to read from,[object Object],     *,[object Object],     * @exception ClassNotFoundException if an unknown class is specified,[object Object],     * @exception IOException if an input/output error occurs,[object Object],     */,[object Object],    private void readObject(ObjectInputStream stream),[object Object],        throws ClassNotFoundException, IOException {,[object Object],        // Deserialize the scalar instance variables (except Manager),[object Object],        creationTime = ((Long) stream.readObject()).longValue();,[object Object],        id = (String) stream.readObject();,[object Object],        lastAccessedTime = ((Long) stream.readObject()).longValue();,[object Object],        maxInactiveInterval = ((Integer) stream.readObject()).intValue();,[object Object],        isNew = ((Boolean) stream.readObject()).booleanValue();,[object Object],        isValid = ((Boolean) stream.readObject()).booleanValue();,[object Object],        // Deserialize the attribute count and attribute values,[object Object],        int n = ((Integer) stream.readObject()).intValue();,[object Object],        for (int i = 0; i < n; i++) {,[object Object],            String name = (String) stream.readObject();,[object Object],            Object value = (Object) stream.readObject();,[object Object],            attributes.put(name, value);,[object Object],        },[object Object],    },[object Object],    /**,[object Object],     * Write a serialized version of this session object to the specified,[object Object],     * object output stream.,[object Object],     * <p>,[object Object],     * <b>IMPLEMENTATION NOTE</b>:  The owning Manager will not be stored,[object Object],     * in the serialized representation of this Session.  After calling,[object Object],     * <code>readObject()</code>, you must set the associated Manager,[object Object],     * explicitly.,[object Object],     * <p>,[object Object],     * <b>IMPLEMENTATION NOTE</b>:  Any attribute that is not Serializable,[object Object],     * will be silently ignored.  If you do not want any such attributes,,[object Object],     * be sure the <code>distributable</code> property of our associated,[object Object],     * Manager is set to <code>true</code>.,[object Object],     *,[object Object],     * @param stream The output stream to write to,[object Object],     *,[object Object],     * @exception IOException if an input/output error occurs,[object Object],     */,[object Object],    private void writeObject(ObjectOutputStream stream) throws IOException {,[object Object],        // Write the scalar instance variables (except Manager),[object Object],        stream.writeObject(new Long(creationTime));,[object Object],        stream.writeObject(id);,[object Object],        stream.writeObject(new Long(lastAccessedTime));,[object Object],        stream.writeObject(new Integer(maxInactiveInterval));,[object Object],        stream.writeObject(new Boolean(isNew));,[object Object],        stream.writeObject(new Boolean(isValid));,[object Object],        // Accumulate the names of serializable attributes,[object Object],        Vector results = new Vector();,[object Object],        Enumeration attrs = getAttributeNames();,[object Object],        while (attrs.hasMoreElements()) {,[object Object],            String attr = (String) attrs.nextElement();,[object Object],            Object value = attributes.get(attr);,[object Object],            if (value instanceof Serializable),[object Object],                results.addElement(attr);,[object Object],        },[object Object],        // Serialize the attribute count and the  attribute values,[object Object],        stream.writeObject(new Integer(results.size()));,[object Object],        Enumeration names = results.elements();,[object Object],        while (names.hasMoreElements()) {,[object Object],            String name = (String) names.nextElement();,[object Object],            stream.writeObject(name);,[object Object],            stream.writeObject(attributes.get(name));,[object Object],        },[object Object],    },[object Object],    crosscut invalidate(StandardSession s): s & (int getMaxInactiveInterval() | ,[object Object],                                                 long getCreationTime() |,[object Object],                                                 Object getAttribute(String) | ,[object Object],                                                 Enumeration getAttributeNames() |,[object Object],                                                 String[] getValueNames() |,[object Object],                                                 void invalidate() |,[object Object],                                                 boolean isNew() |,[object Object],                                                 void removeAttribute(String) |,[object Object],                                                 void setAttribute(String, Object));,[object Object],    static advice(StandardSession s): invalidate(s) {,[object Object],        before {,[object Object],            if (!s.isValid()),[object Object],                throw new IllegalStateException,[object Object],                    (s.sm.getString("standardSession." ,[object Object],                                    + thisJoinPoint.methodName,[object Object],                                    + ".ise"));,[object Object],        },[object Object],    },[object Object],},[object Object],// -------------------------------------------------------------- Private Class,[object Object],/**,[object Object], * This class is a dummy implementation of the <code>HttpSessionContext</code>,[object Object], * interface, to conform to the requirement that such an object be returned,[object Object], * when <code>HttpSession.getSessionContext()</code> is called.,[object Object], *,[object Object], * @author Craig R. McClanahan,[object Object], *,[object Object], * @deprecated As of Java Servlet API 2.1 with no replacement.  The,[object Object], *  interface will be removed in a future version of this API.,[object Object], */,[object Object],final class StandardSessionContext implements HttpSessionContext {,[object Object],    private Vector dummy = new Vector();,[object Object],    /**,[object Object],     * Return the session identifiers of all sessions defined,[object Object],     * within this context.,[object Object],     *,[object Object],     * @deprecated As of Java Servlet API 2.1 with no replacement.,[object Object],     *  This method must return an empty <code>Enumeration</code>,[object Object],     *  and will be removed in a future version of the API.,[object Object],     */,[object Object],    public Enumeration getIds() {,[object Object],        return (dummy.elements());,[object Object],    },[object Object],    /**,[object Object],     * Return the <code>HttpSession</code> associated with the,[object Object],     * specified session identifier.,[object Object],     *,[object Object],     * @param id Session identifier for which to look up a session,[object Object],     *,[object Object],     * @deprecated As of Java Servlet API 2.1 with no replacement.,[object Object],     *  This method must return null and will be removed in a,[object Object],     *  future version of the API.,[object Object],     */,[object Object],    public HttpSession getSession(String id) {,[object Object],        return (null);,[object Object],    },[object Object],},[object Object],StandardSessionManager,[object Object],/*,[object Object], * ====================================================================,[object Object], *,[object Object], * The Apache Software License, Version 1.1,[object Object], *,[object Object], * Copyright (c) 1999 The Apache Software Foundation.  All rights,[object Object], * reserved.,[object Object], *,[object Object], * Redistribution and use in source and binary forms, with or without,[object Object], * modification, are permitted provided that the following conditions,[object Object], * are met:,[object Object], *,[object Object], * 1. Redistributions of source code must retain the above copyright,[object Object], *    notice, this list of conditions and the following disclaimer.,[object Object], *,[object Object], * 2. Redistributions in binary form must reproduce the above copyright,[object Object], *    notice, this list of conditions and the following disclaimer in,[object Object], *    the documentation and/or other materials provided with the,[object Object], *    distribution.,[object Object], *,[object Object], * 3. The end-user documentation included with the redistribution, if,[object Object], *    any, must include the following acknowlegement:,[object Object], *       "This product includes software developed by the,[object Object], *        Apache Software Foundation (http://www.apache.org/).",[object Object], *    Alternately, this acknowlegement may appear in the software,[object Object],itself,,[object Object], *    if and wherever such third-party acknowlegements normally appear.,[object Object], *,[object Object], * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software,[object Object], *    Foundation" must not be used to endorse or promote products,[object Object],derived,[object Object], *    from this software without prior written permission. For written,[object Object], *    permission, please contact apache@apache.org.,[object Object], *,[object Object], * 5. Products derived from this software may not be called "Apache",[object Object], *    nor may "Apache" appear in their names without prior written,[object Object], *    permission of the Apache Group.,[object Object], *,[object Object], * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED,[object Object], * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES,[object Object], * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE,[object Object], * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR,[object Object], * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,,[object Object], * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT,[object Object], * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF,[object Object], * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND,[object Object], * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,,[object Object], * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT,[object Object], * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF,[object Object], * SUCH DAMAGE.,[object Object], * ====================================================================,[object Object], *,[object Object], * This software consists of voluntary contributions made by many,[object Object], * individuals on behalf of the Apache Software Foundation.  For more,[object Object], * information on the Apache Software Foundation, please see,[object Object], * <http://www.apache.org/>.,[object Object], *,[object Object], * [Additional notices, if required by prior licensing conditions],[object Object], *,[object Object], */,[object Object],package org.apache.tomcat.session;,[object Object],import org.apache.tomcat.core.*;,[object Object],import org.apache.tomcat.util.StringManager;,[object Object],import java.io.*;,[object Object],import java.net.*;,[object Object],import java.util.*;,[object Object],import javax.servlet.*;,[object Object],import javax.servlet.http.*;,[object Object],/**,[object Object], * Core implementation of an application level session,[object Object], *,[object Object], * @author James Duncan Davidson [duncan@eng.sun.com],[object Object], * @author Jason Hunter [jch@eng.sun.com],[object Object], * @author James Todd [gonzo@eng.sun.com],[object Object], */,[object Object],public class ApplicationSession implements HttpSession {,[object Object],    private StringManager sm =,[object Object],        StringManager.getManager("org.apache.tomcat.session");,[object Object],    private Hashtable values = new Hashtable();,[object Object],    private String id;,[object Object],    private ServerSession serverSession;,[object Object],    private Context context;,[object Object],    private long creationTime = System.currentTimeMillis();;,[object Object],    private long thisAccessTime = creationTime;,[object Object],private boolean valid = true;,[object Object],    ApplicationSession(String id, ServerSession serverSession,,[object Object],        Context context) {,[object Object],        this.serverSession = serverSession;,[object Object],        this.context = context;,[object Object],        this.id = id;,[object Object],        this.inactiveInterval = context.getSessionTimeOut();,[object Object],        if (this.inactiveInterval != -1) {,[object Object],            this.inactiveInterval *= 60;,[object Object],        },[object Object],    },[object Object],    ServerSession getServerSession() {,[object Object],        return serverSession;,[object Object],    },[object Object],    /**,[object Object],     * Called by context when request comes in so that accesses and,[object Object],     * inactivities can be dealt with accordingly.,[object Object],     */,[object Object],    // HTTP SESSION IMPLEMENTATION METHODS,[object Object],    public String getId() {,[object Object],        if (valid) {,[object Object],            return id;,[object Object],        } else {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],    },[object Object],    public long getCreationTime() {,[object Object],        if (valid) {,[object Object],            return creationTime;,[object Object],        } else {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],    },[object Object],    /**,[object Object],     *,[object Object],     * @deprecated,[object Object],     */,[object Object],    public HttpSessionContext getSessionContext() {,[object Object],        return new SessionContextImpl();,[object Object],    },[object Object],public void invalidate() {,[object Object],        serverSession.removeApplicationSession(context);,[object Object],        // remove everything in the session,[object Object],        Enumeration enum = values.keys();,[object Object],        while (enum.hasMoreElements()) {,[object Object],            String name = (String)enum.nextElement();,[object Object],            removeValue(name);,[object Object],        },[object Object],        valid = false;,[object Object],    },[object Object],    public boolean isNew() {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        if (thisAccessTime == creationTime) {,[object Object],            return true;,[object Object],        } else {,[object Object],            return false;,[object Object],        },[object Object],    },[object Object],/**,[object Object],     * @deprecated,[object Object],     */,[object Object],    public void putValue(String name, Object value) {,[object Object],        setAttribute(name, value);,[object Object],    },[object Object],    public void setAttribute(String name, Object value) {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        if (name == null) {,[object Object],            String msg = sm.getString("applicationSession.value.iae");,[object Object],            throw new IllegalArgumentException(msg);,[object Object],        },[object Object],        removeValue(name);  // remove any existing binding,[object Object],        if (value != null && value instanceof HttpSessionBindingListener) {,[object Object],            HttpSessionBindingEvent e =,[object Object],                new HttpSessionBindingEvent(this, name);,[object Object],            ((HttpSessionBindingListener)value).valueBound(e);,[object Object],        },[object Object],        values.put(name, value);,[object Object],    },[object Object],    /**,[object Object],     * @deprecated,[object Object],     */,[object Object],    public Object getValue(String name) {,[object Object],        return getAttribute(name);,[object Object],    },[object Object],    public Object getAttribute(String name) {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        if (name == null) {,[object Object],            String msg = sm.getString("applicationSession.value.iae");,[object Object],            throw new IllegalArgumentException(msg);,[object Object],        },[object Object],        return values.get(name);,[object Object],    },[object Object],    /**,[object Object],     * @deprecated,[object Object],     */,[object Object],    public String[] getValueNames() {,[object Object],        Enumeration e = getAttributeNames();,[object Object],        Vector names = new Vector();,[object Object],        while (e.hasMoreElements()) {,[object Object],            names.addElement(e.nextElement());,[object Object],        },[object Object],        String[] valueNames = new String[names.size()];,[object Object],        names.copyInto(valueNames);,[object Object],        return valueNames;,[object Object],    },[object Object],    public Enumeration getAttributeNames() {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        Hashtable valuesClone = (Hashtable)values.clone();,[object Object],        return (Enumeration)valuesClone.keys();,[object Object],    },[object Object], /**,[object Object],     * @deprecated,[object Object],     */,[object Object],    public void removeValue(String name) {,[object Object],        removeAttribute(name);,[object Object],    },[object Object],    public void removeAttribute(String name) {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        if (name == null) {,[object Object],            String msg = sm.getString("applicationSession.value.iae");,[object Object],            throw new IllegalArgumentException(msg);,[object Object],        },[object Object],        Object o = values.get(name);,[object Object],        if (o instanceof HttpSessionBindingListener) {,[object Object],            HttpSessionBindingEvent e =,[object Object],                new HttpSessionBindingEvent(this,name);,[object Object],            ((HttpSessionBindingListener)o).valueUnbound(e);,[object Object],        },[object Object],        values.remove(name);,[object Object],    },[object Object],    public void setMaxInactiveInterval(int interval) {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        inactiveInterval = interval;,[object Object],    },[object Object],    public int getMaxInactiveInterval() {,[object Object],        if (! valid) {,[object Object],            String msg = sm.getString("applicationSession.session.ise");,[object Object],            throw new IllegalStateException(msg);,[object Object],        },[object Object],        return inactiveInterval;,[object Object],    },[object Object],},[object Object],//-----------------------------------------------------------------------,[object Object],package org.apache.tomcat.session;,[object Object],import java.io.IOException;,[object Object],import java.io.ObjectInputStream;,[object Object],import java.io.ObjectOutputStream;,[object Object],import java.io.Serializable;,[object Object],import java.util.Enumeration;,[object Object],import java.util.Hashtable;,[object Object],import java.util.Vector;,[object Object],import javax.servlet.ServletException;,[object Object],import javax.servlet.http.HttpSession;,[object Object],import javax.servlet.http.HttpSessionBindingEvent;,[object Object],import javax.servlet.http.HttpSessionBindingListener;,[object Object],import javax.servlet.http.HttpSessionContext;,[object Object],import org.apache.tomcat.catalina.*;,[object Object],import org.apache.tomcat.util.StringManager;,[object Object],/**,[object Object], * Standard implementation of the <b>Session</b> interface.  This object is,[object Object], * serializable, so that it can be stored in persistent storage or transferred,[object Object], * to a different JVM for distributable session support.,[object Object], * <p>,[object Object], * <b>IMPLEMENTATION NOTE</b>:  An instance of this class represents both the,[object Object], * internal (Session) and application level (HttpSession) view of the session.,[object Object], * However, because the class itself is not declared public, Java logic outside,[object Object], * of the <code>org.apache.tomcat.session</code> package cannot cast an,[object Object], * HttpSession view of this instance back to a Session view.,[object Object], *,[object Object], * @author Craig R. McClanahan,[object Object], * @version $Revision: 1.2 $ $Date: 2000/05/15 17:54:10 $,[object Object], */,[object Object],final class StandardSession,[object Object],    implements HttpSession, Session {,[object Object],    // ----------------------------------------------------------- Constructors,[object Object],    /**,[object Object],     * Construct a new Session associated with the specified Manager.,[object Object],     *,[object Object],     * @param manager The manager with which this Session is associated,[object Object],     */,[object Object],    public StandardSession(Manager manager) {,[object Object],        super();,[object Object],        this.manager = manager;,[object Object],    },[object Object],    // ----------------------------------------------------- Instance Variables,[object Object],    /**,[object Object],     * The collection of user data attributes associated with this Session.,[object Object],     */,[object Object],    private Hashtable attributes = new Hashtable();,[object Object],    /**,[object Object],     * The time this session was created, in milliseconds since midnight,,[object Object],     * January 1, 1970 GMT.,[object Object],     */,[object Object],    private long creationTime = 0L;,[object Object],    /**,[object Object],     * The session identifier of this Session.,[object Object],     */,[object Object],    private String id = null;,[object Object],    /**,[object Object],     * Descriptive information describing this Session implementation.,[object Object],     */,[object Object],    private static final String info = "StandardSession/1.0";,[object Object],    /**,[object Object],     * The last accessed time for this Session.,[object Object],     */,[object Object],/**,[object Object],     * The Manager with which this Session is associated.,[object Object],     */,[object Object],    private Manager manager = null;,[object Object],    /**,[object Object],     * The maximum time interval, in seconds, between client requests before,[object Object],     * the servlet container may invalidate this session.  A negative time,[object Object],     * indicates that the session should never time out.,[object Object],     */,[object Object],    private int maxInactiveInterval = -1;,[object Object],    /**,[object Object],     * Flag indicating whether this session is new or not.,[object Object],     */,[object Object],    private boolean isNew = true;,[object Object],    /**,[object Object],     * Flag indicating whether this session is valid or not.,[object Object],     */,[object Object],    private boolean isValid = false;,[object Object],    /**,[object Object],     * The string manager for this package.,[object Object],     */,[object Object],    private StringManager sm =,[object Object],        StringManager.getManager("org.apache.tomcat.session");,[object Object],    /**,[object Object],     * The HTTP session context associated with this session.,[object Object],     */,[object Object],    private static HttpSessionContext sessionContext = null;,[object Object],    /**,[object Object],     * The current accessed time for this session.,[object Object],     */,[object Object],    private long thisAccessedTime = creationTime;,[object Object],    // ----------------------------------------------------- Session Properties,[object Object],    /**,[object Object],     * Set the creation time for this session.  This method is called by the,[object Object],     * Manager when an existing Session instance is reused.,[object Object],     *,[object Object],     * @param time The new creation time,[object Object],     */,[object Object],    public void setCreationTime(long time) {,[object Object],        this.creationTime = time;,[object Object],        this.thisAccessedTime = time;,[object Object],    },[object Object],    /**,[object Object],     * Return the session identifier for this session.,[object Object],     */,[object Object],    public String getId() {,[object Object],        return (this.id);,[object Object],    },[object Object],    /**,[object Object],     * Set the session identifier for this session.,[object Object],     *,[object Object],     * @param id The new session identifier,[object Object],     */,[object Object],    public void setId(String id) {,[object Object],        if ((this.id != null) && (manager != null) &&,[object Object],          (manager instanceof ManagerBase)),[object Object],            ((ManagerBase) manager).remove(this);,[object Object],        this.id = id;,[object Object],        if ((manager != null) && (manager instanceof ManagerBase)),[object Object],            ((ManagerBase) manager).add(this);,[object Object],    },[object Object],    /**,[object Object],     * Return descriptive information about this Session implementation and,[object Object],     * the corresponding version number, in the format,[object Object],     * <code>&lt;description&gt;/&lt;version&gt;</code>.,[object Object],     */,[object Object],    public String getInfo() {,[object Object],        return (this.info);,[object Object],    },[object Object],/**,[object Object],     * Return the Manager within which this Session is valid.,[object Object],     */,[object Object],    public Manager getManager() {,[object Object],        return (this.manager);,[object Object],    },[object Object],    /**,[object Object],     * Set the Manager within which this Session is valid.,[object Object],     *,[object Object],     * @param manager The new Manager,[object Object],     */,[object Object],    public void setManager(Manager manager) {,[object Object],        this.manager = manager;,[object Object],    },[object Object],    /**,[object Object],     * Return the maximum time interval, in seconds, between client requests,[object Object],     * before the servlet container will invalidate the session.  A negative,[object Object],     * time indicates that the session should never time out.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on,[object Object],     *  an invalidated session,[object Object],     */,[object Object],    public int getMaxInactiveInterval() {,[object Object],        return (this.maxInactiveInterval);,[object Object],    },[object Object],    /**,[object Object],     * Set the maximum time interval, in seconds, between client requests,[object Object],     * before the servlet container will invalidate the session.  A negative,[object Object],     * time indicates that the session should never time out.,[object Object],     *,[object Object],     * @param interval The new maximum interval,[object Object],     */,[object Object],    public void setMaxInactiveInterval(int interval) {,[object Object],        this.maxInactiveInterval = interval;,[object Object],    },[object Object],    /**,[object Object],     * Return the <code>HttpSession</code> for which this object,[object Object],     * is the facade.,[object Object],     */,[object Object],    public HttpSession getSession() {,[object Object],        return ((HttpSession) this);,[object Object],    },[object Object],    // ------------------------------------------------- Session Public Methods,[object Object],    /**,[object Object],     * Perform the internal processing required to invalidate this session,,[object Object],     * without triggering an exception if the session has already expired.,[object Object],     */,[object Object],    public void expire() {,[object Object],        // Remove this session from our manager's active sessions,[object Object],        if ((manager != null) && (manager instanceof ManagerBase)),[object Object],            ((ManagerBase) manager).remove(this);,[object Object],        // Unbind any objects associated with this session,[object Object],        Vector results = new Vector();,[object Object],        Enumeration attrs = getAttributeNames();,[object Object],        while (attrs.hasMoreElements()) {,[object Object],            String attr = (String) attrs.nextElement();,[object Object],            results.addElement(attr);,[object Object],        },[object Object],        Enumeration names = results.elements();,[object Object],        while (names.hasMoreElements()) {,[object Object],            String name = (String) names.nextElement();,[object Object],            removeAttribute(name);,[object Object],        },[object Object],        // Mark this session as invalid,[object Object],        setValid(false);,[object Object],    },[object Object],    /**,[object Object],     * Release all object references, and initialize instance variables, in,[object Object],     * preparation for reuse of this object.,[object Object],     */,[object Object],    public void recycle() {,[object Object],        // Reset the instance variables associated with this Session,[object Object],        attributes.clear();,[object Object],        creationTime = 0L;,[object Object],        id = null;,[object Object],manager = null;,[object Object],        maxInactiveInterval = -1;,[object Object],        isNew = true;,[object Object],        isValid = false;,[object Object],        // Tell our Manager that this Session has been recycled,[object Object],        if ((manager != null) && (manager instanceof ManagerBase)),[object Object],            ((ManagerBase) manager).recycle(this);,[object Object],    },[object Object],    // ------------------------------------------------ Session Package Methods,[object Object],    /**,[object Object],     * Return the <code>isValid</code> flag for this session.,[object Object],     */,[object Object],    boolean isValid() {,[object Object],        return (this.isValid);,[object Object],    },[object Object],    /**,[object Object],     * Set the <code>isNew</code> flag for this session.,[object Object],     *,[object Object],     * @param isNew The new value for the <code>isNew</code> flag,[object Object],     */,[object Object],    void setNew(boolean isNew) {,[object Object],        this.isNew = isNew;,[object Object],    },[object Object],    /**,[object Object],     * Set the <code>isValid</code> flag for this session.,[object Object],     *,[object Object],     * @param isValid The new value for the <code>isValid</code> flag,[object Object],     */,[object Object],    void setValid(boolean isValid) {,[object Object],        this.isValid = isValid;,[object Object],    },[object Object],    // ------------------------------------------------- HttpSession Properties,[object Object],    /**,[object Object],     * Return the time when this session was created, in milliseconds since,[object Object],     * midnight, January 1, 1970 GMT.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public long getCreationTime() {,[object Object],        return (this.creationTime);,[object Object],    },[object Object],    /**,[object Object],     * Return the session context with which this session is associated.,[object Object],     *,[object Object],     * @deprecated As of Version 2.1, this method is deprecated and has no,[object Object],     *  replacement.  It will be removed in a future version of the,[object Object],     *  Java Servlet API.,[object Object],     */,[object Object],    public HttpSessionContext getSessionContext() {,[object Object],        if (sessionContext == null),[object Object],            sessionContext = new StandardSessionContext();,[object Object],        return (sessionContext);,[object Object],    },[object Object],    // ----------------------------------------------HttpSession Public Methods,[object Object],    /**,[object Object],     * Return the object bound with the specified name in this session, or,[object Object],     * <code>null</code> if no object is bound with that name.,[object Object],     *,[object Object],     * @param name Name of the attribute to be returned,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public Object getAttribute(String name) {,[object Object],        return (attributes.get(name));,[object Object],    },[object Object],    /**,[object Object],     * Return an <code>Enumeration</code> of <code>String</code> objects,[object Object],     * containing the names of the objects bound to this session.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public Enumeration getAttributeNames() {,[object Object],        return (attributes.keys());,[object Object],    },[object Object],    /**,[object Object],     * Return the object bound with the specified name in this session, or,[object Object],     * <code>null</code> if no object is bound with that name.,[object Object],     *,[object Object],     * @param name Name of the value to be returned,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     *,[object Object],     * @deprecated As of Version 2.2, this method is replaced by,[object Object],     *  <code>getAttribute()</code>,[object Object],     */,[object Object],    public Object getValue(String name) {,[object Object],        return (getAttribute(name));,[object Object],    },[object Object],    /**,[object Object],     * Return the set of names of objects bound to this session.  If there,[object Object],     * are no such objects, a zero-length array is returned.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     *,[object Object],     * @deprecated As of Version 2.2, this method is replaced by,[object Object],     *  <code>getAttributeNames()</code>,[object Object],     */,[object Object],    public String[] getValueNames() {,[object Object],        Vector results = new Vector();,[object Object],        Enumeration attrs = getAttributeNames();,[object Object],        while (attrs.hasMoreElements()) {,[object Object],            String attr = (String) attrs.nextElement();,[object Object],            results.addElement(attr);,[object Object],        },[object Object],        String names[] = new String[results.size()];,[object Object],        for (int i = 0; i < names.length; i++),[object Object],            names[i] = (String) results.elementAt(i);,[object Object],        return (names);,[object Object],    },[object Object],    /**,[object Object],     * Invalidates this session and unbinds any objects bound to it.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on,[object Object],     *  an invalidated session,[object Object],     */,[object Object],    public void invalidate() {,[object Object],        // Cause this session to expire,[object Object],        expire();,[object Object],    },[object Object],    /**,[object Object],     * Return <code>true</code> if the client does not yet know about the,[object Object],     * session, or if the client chooses not to join the session.  For,[object Object],     * example, if the server used only cookie-based sessions, and the client,[object Object],     * has disabled the use of cookies, then a session would be new on each,[object Object],     * request.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public boolean isNew() {,[object Object],        return (this.isNew);,[object Object],    },[object Object], /**,[object Object],     * Bind an object to this session, using the specified name.  If an object,[object Object],     * of the same name is already bound to this session, the object is,[object Object],     * replaced.,[object Object],     * <p>,[object Object],     * After this method executes, and if the object implements,[object Object],     * <code>HttpSessionBindingListener</code>, the container calls,[object Object],     * <code>valueBound()</code> on the object.,[object Object],     *,[object Object],     * @param name Name to which the object is bound, cannot be null,[object Object],     * @param value Object to be bound, cannot be null,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     *,[object Object],     * @deprecated As of Version 2.2, this method is replaced by,[object Object],     *  <code>setAttribute()</code>,[object Object],     */,[object Object],    public void putValue(String name, Object value) {,[object Object],        setAttribute(name, value);,[object Object],    },[object Object],    /**,[object Object],     * Remove the object bound with the specified name from this session.  If,[object Object],     * the session does not have an object bound with this name, this method,[object Object],     * does nothing.,[object Object],     * <p>,[object Object],     * After this method executes, and if the object implements,[object Object],     * <code>HttpSessionBindingListener</code>, the container calls,[object Object],     * <code>valueUnbound()</code> on the object.,[object Object],     *,[object Object],     * @param name Name of the object to remove from this session.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public void removeAttribute(String name) {,[object Object],        synchronized (attributes) {,[object Object],            Object object = attributes.get(name);,[object Object],            if (object == null),[object Object],                return;,[object Object],            attributes.remove(name);,[object Object],            //      System.out.println( "Removing attribute " + name );,[object Object],            if (object instanceof HttpSessionBindingListener) {,[object Object],                ((HttpSessionBindingListener) object).valueUnbound,[object Object],                    (new HttpSessionBindingEvent((HttpSession) this, name));,[object Object],            },[object Object],        },[object Object],    },[object Object],    /**,[object Object],     * Remove the object bound with the specified name from this session.  If,[object Object],     * the session does not have an object bound with this name, this method,[object Object],     * does nothing.,[object Object],     * <p>,[object Object],     * After this method executes, and if the object implements,[object Object],     * <code>HttpSessionBindingListener</code>, the container calls,[object Object],     * <code>valueUnbound()</code> on the object.,[object Object],     *,[object Object],     * @param name Name of the object to remove from this session.,[object Object],     *,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     *,[object Object],     * @deprecated As of Version 2.2, this method is replaced by,[object Object],     *  <code>removeAttribute()</code>,[object Object],     */,[object Object],    public void removeValue(String name) {,[object Object],        removeAttribute(name);,[object Object],    },[object Object],    /**,[object Object],     * Bind an object to this session, using the specified name.  If an object,[object Object],     * of the same name is already bound to this session, the object is,[object Object],     * replaced.,[object Object],     * <p>,[object Object],     * After this method executes, and if the object implements,[object Object],     * <code>HttpSessionBindingListener</code>, the container calls,[object Object],     * <code>valueBound()</code> on the object.,[object Object],     *,[object Object],     * @param name Name to which the object is bound, cannot be null,[object Object],     * @param value Object to be bound, cannot be null,[object Object],     *,[object Object],     * @exception IllegalArgumentException if an attempt is made to add a,[object Object],     *  non-serializable object in an environment marked distributable.,[object Object],     * @exception IllegalStateException if this method is called on an,[object Object],     *  invalidated session,[object Object],     */,[object Object],    public void setAttribute(String name, Object value) {,[object Object],        if ((manager != null) && manager.getDistributable() &&,[object Object],          !(value instanceof Serializable)),[object Object],            throw new IllegalArgumentException,[object Object],                (sm.getString("standardSession.setAttribute.iae"));,[object Object],        synchronized (attributes) {,[object Object],            removeAttribute(name);,[object Object],            attributes.put(name, value);,[object Object],            if (value instanceof HttpSessionBindingListener),[object Object],                ((HttpSessionBindingListener) value).valueBound,[object Object],                    (new HttpSessionBindingEvent((HttpSession) this, name));,[object Object],        },[object Object],    },[object Object],    // -------------------------------------------- HttpSession Private Methods,[object Object],    /**,[object Object],     * Read a serialized version of this session object from the specified,[object Object],     * object input stream.,[object Object],     * <p>,[object Object],     * <b>IMPLEMENTATION NOTE</b>:  The reference to the owning Manager,[object Object],     * is not restored by this method, and must be set explicitly.,[object Object],     *,[object Object],     * @param stream The input stream to read from,[object Object],     *,[object Object],     * @exception ClassNotFoundException if an unknown class is specified,[object Object],     * @exception IOException if an input/output error occurs,[object Object],     */,[object Object],    private void readObject(ObjectInputStream stream),[object Object],        throws ClassNotFoundException, IOException {,[object Object],        // Deserialize the scalar instance variables (except Manager),[object Object],        creationTime = ((Long) stream.readObject()).longValue();,[object Object],        id = (String) stream.readObject();,[object Object],isValid = ((Boolean) stream.readObject()).booleanValue();,[object Object],        // Deserialize the attribute count and attribute values,[object Object],        int n = ((Integer) stream.readObject()).intValue();,[object Object],        for (int i = 0; i < n; i++) {,[object Object],            String name = (String) stream.readObject();,[object Object],            Object value = (Object) stream.readObject();,[object Object],            attributes.put(name, value);,[object Object],        },[object Object],    },[object Object],    /**,[object Object],     * Write a serialized version of this session object to the specified,[object Object],     * object output stream.,[object Object],     * <p>,[object Object],     * <b>IMPLEMENTATION NOTE</b>:  The owning Manager will not be stored,[object Object],     * in the serialized representation of this Session.  After calling,[object Object],     * <code>readObject()</code>, you must set the associated Manager,[object Object],     * explicitly.,[object Object],     * <p>,[object Object],     * <b>IMPLEMENTATION NOTE</b>:  Any attribute that is not Serializable,[object Object],     * will be silently ignored.  If you do not want any such attributes,,[object Object],     * be sure the <code>distributable</code> property of our associated,[object Object],     * Manager is set to <code>true</code>.,[object Object],     *,[object Object],     * @param stream The output stream to write to,[object Object],     *,[object Object],     * @exception IOException if an input/output error occurs,[object Object],     */,[object Object],    private void writeObject(ObjectOutputStream stream) throws IOException {,[object Object],        // Write the scalar instance variables (except Manager),[object Object],        stream.writeObject(new Long(creationTime));,[object Object],        stream.writeObject(id);,[object Object],stream.writeObject(new Integer(maxInactiveInterval));,[object Object],        stream.writeObject(new Boolean(isNew));,[object Object],        stream.writeObject(new Boolean(isValid));,[object Object],        // Accumulate the names of serializable attributes,[object Object],        Vector results = new Vector();,[object Object],        Enumeration attrs = getAttributeNames();,[object Object],        while (attrs.hasMoreElements()) {,[object Object],            String attr = (String) attrs.nextElement();,[object Object],            Object value = attributes.get(attr);,[object Object],            if (value instanceof Serializable),[object Object],                results.addElement(attr);,[object Object],        },[object Object],        // Serialize the attribute count and the  attribute values,[object Object],        stream.writeObject(new Integer(results.size()));,[object Object],        Enumeration names = results.elements();,[object Object],        while (names.hasMoreElements()) {,[object Object],            String name = (String) names.nextElement();,[object Object],            stream.writeObject(name);,[object Object],            stream.writeObject(attributes.get(name));,[object Object],        },[object Object],    },[object Object],    crosscut invalidate(StandardSession s): s & (int getMaxInactiveInterval() | ,[object Object],                                                 long getCreationTime() |,[object Object],                                                 Object getAttribute(String) | ,[object Object],                                                 Enumeration getAttributeNames() |,[object Object],                                                 String[] getValueNames() |,[object Object],                                                 void invalidate() |,[object Object],                                                 boolean isNew() |,[object Object],                                                 void removeAttribute(String) |,[object Object],                                                 void setAttribute(String, Object));,[object Object],    static advice(StandardSession s): invalidate(s) {,[object Object],        before {,[object Object],            if (!s.isValid()),[object Object],                throw new IllegalStateException,[object Object],                    (s.sm.getString("standardSession." ,[object Object],                                    + thisJoinPoint.methodName,[object Object],                                    + ".ise"));,[object Object],        },[object Object],    },[object Object],},[object Object],// -------------------------------------------------------------- Private Class,[object Object],/**,[object Object], * This class is a dummy implementation of the <code>HttpSessionContext</code>,[object Object], * interface, to conform to the requirement that such an object be returned,[object Object], * when <code>HttpSession.getSessionContext()</code> is called.,[object Object], *,[object Object], * @author Craig R. McClanahan,[object Object], *,[object Object], * @deprecated As of Java Servlet API 2.1 with no replacement.  The,[object Object], *  interface will be removed in a future version of this API.,[object Object], */,[object Object],final class StandardSessionContext implements HttpSessionContext {,[object Object],    private Vector dummy = new Vector();,[object Object],    /**,[object Object],     * Return the session identifiers of all sessions defined,[object Object],     * within this context.,[object Object],     *,[object Object],     * @deprecated As of Java Servlet API 2.1 with no replacement.,[object Object],     *  This method must return an empty <code>Enumeration</code>,[object Object],     *  and will be removed in a future version of the API.,[object Object],     */,[object Object],    public Enumeration getIds() {,[object Object],        return (dummy.elements());,[object Object],    },[object Object],    /**,[object Object],     * Return the <code>HttpSession</code> associated with the,[object Object],     * specified session identifier.,[object Object],     *,[object Object],     * @param id Session identifier for which to look up a session,[object Object],     *,[object Object],     * @deprecated As of Java Servlet API 2.1 with no replacement.,[object Object],     *  This method must return null and will be removed in a,[object Object],     *  future version of the API.,[object Object],     */,[object Object],    public HttpSession getSession(String id) {,[object Object],        return (null);,[object Object],    },[object Object],},[object Object],StandardSessionManager,[object Object],package org.apache.tomcat.session;,[object Object],import java.io.IOException;,[object Object],import java.util.Enumeration;,[object Object],import java.util.Hashtable;,[object Object],import java.util.Vector;,[object Object],import org.apache.tomcat.catalina.*;,[object Object],import javax.servlet.http.Cookie;,[object Object],import javax.servlet.http.HttpSession;,[object Object],import org.apache.tomcat.util.StringManager;,[object Object],import org.w3c.dom.NamedNodeMap;,[object Object],import org.w3c.dom.Node;,[object Object],/**,[object Object], * Standard implementation of the <b>Manager</b> interface that provides,[object Object], * no session persistence or distributable capabilities, but does support,[object Object], * an optional, configurable, maximum number of active sessions allowed.,[object Object], * <p>,[object Object], * Lifecycle configuration of this component assumes an XML node,[object Object], * in the following format:,[object Object], * <code>,[object Object], *     &lt;Manager className="org.apache.tomcat.session.StandardManager",[object Object], *              checkInterval="60" maxActiveSessions="-1",[object Object], *              maxInactiveInterval="-1" />,[object Object], * </code>,[object Object], * where you can adjust the following parameters, with default values,[object Object], * in square brackets:,[object Object], * <ul>,[object Object], * <li><b>checkInterval</b> - The interval (in seconds) between background,[object Object], *     thread checks for expired sessions.  [60],[object Object], * <li><b>maxActiveSessions</b> - The maximum number of sessions allowed to,[object Object], *     be active at once, or -1 for no limit.  [-1],[object Object], * <li><b>maxInactiveInterval</b> - The default maximum number of seconds of,[object Object], *     inactivity before which the servlet container is allowed to time out,[object Object], *     a session, or -1 for no limit.  This value should be overridden from,[object Object], *     the default session timeout specified in the web application deployment,[object Object], *     descriptor, if any.  [-1],[object Object], * </ul>,[object Object], *,[object Object], * @author Craig R. McClanahan,[object Object], * @version $Revision: 1.1.1.1 $ $Date: 2000/05/02 21:28:30 $,[object Object], */,[object Object],public final class StandardManager,[object Object],    extends ManagerBase,[object Object],    implements Lifecycle, Runnable {,[object Object],    // ----------------------------------------------------- Instance Variables,[object Object],    /**,[object Object],     * The interval (in seconds) between checks for expired sessions.,[object Object],     */,[object Object],    private int checkInterval = 60;,[object Object],    /**,[object Object],     * Has this component been configured yet?,[object Object],     */,[object Object],    private boolean configured = false;,[object Object],    /**,[object Object],     * The descriptive information about this implementation.,[object Object],     */,[object Object],    private static final String info = "StandardManager/1.0";,[object Object],    /**,[object Object],     * The maximum number of active Sessions allowed, or -1 for no limit.,[object Object],     */,[object Object],    protected int maxActiveSessions = -1;,[object Object],    /**,[object Object],     * The string manager for this package.,[object Object],     */,[object Object],    private StringManager sm =,[object Object],        StringManager.getManager("org.apache.tomcat.session");,[object Object],    /**,[object Object],     * Has this component been started yet?,[object Object],     */,[object Object],    private boolean started = false;,[object Object],    /**,[object Object],     * The background thread.,[object Object],     */,[object Object],    private Thread thread = null;,[object Object],    /**,[object Object],     * The background thread completion semaphore.,[object Object],     */,[object Object],    private boolean threadDone = false;,[object Object],    /**,[object Object],     * Name to register for the background thread.,[object Object],     */,[object Object],    private String threadName = "StandardManager";,[object Object],    // ------------------------------------------------------------- Properties,[object Object],    /**,[object Object],     * Return the check interval (in seconds) for this Manager.,[object Object],     */,[object Object],    public int getCheckInterval() {,[object Object],        return (this.checkInterval);,[object Object],    },[object Object],    /**,[object Object],     * Set the check interval (in seconds) for this Manager.,[object Object],     *,[object Object],     * @param checkInterval The new check interval,[object Object],     */,[object Object],    public void setCheckInterval(int checkInterval) {,[object Object],        this.checkInterval = checkInterval;,[object Object],    },[object Object],    /**,[object Object],     * Return descriptive information about this Manager implementation and,[object Object],     * the corresponding version number, in the format,[object Object],     * <code>&lt;description&gt;/&lt;version&gt;</code>.,[object Object],     */,[object Object],    public String getInfo() {,[object Object],        return (this.info);,[object Object],    },[object Object],    /**,[object Object],     * Return the maximum number of active Sessions allowed, or -1 for,[object Object],     * no limit.,[object Object],     */,[object Object],    public int getMaxActiveSessions() {,[object Object],        return (this.maxActiveSessions);,[object Object],    },[object Object],    /**,[object Object],     * Set the maximum number of actives Sessions allowed, or -1 for,[object Object],     * no limit.,[object Object],     *,[object Object],     * @param max The new maximum number of sessions,[object Object],     */,[object Object],    public void setMaxActiveSessions(int max) {,[object Object],        this.maxActiveSessions = max;,[object Object],    },[object Object],    // --------------------------------------------------------- Public Methods,[object Object],    /**,[object Object],     * Construct and return a new session object, based on the default,[object Object],     * settings specified by this Manager's properties.  The session,[object Object],     * id will be assigned by this method, and available via the getId(),[object Object],     * method of the returned session.  If a new session cannot be created,[object Object],     * for any reason, return <code>null</code>.,[object Object],     *,[object Object],     * @exception IllegalStateException if a new session cannot be,[object Object],     *  instantiated for any reason,[object Object],     */,[object Object],    public Session createSession() {,[object Object],        if ((maxActiveSessions >= 0) &&,[object Object],          (sessions.size() >= maxActiveSessions)),[object Object],            throw new IllegalStateException,[object Object],                (sm.getString("standardManager.createSession.ise"));,[object Object],        return (super.createSession());,[object Object],    },[object Object],    // ------------------------------------------------------ Lifecycle Methods,[object Object],    /**,[object Object],     * Configure this component, based on the specified configuration,[object Object],     * parameters.  This method should be called immediately after the,[object Object],     * component instance is created, and before <code>start()</code>,[object Object],     * is called.,[object Object],     *,[object Object],     * @param parameters Configuration parameters for this component,[object Object],     *  (<B>FIXME: What object type should this really be?),[object Object],     *,[object Object],     * @exception IllegalStateException if this component has already been,[object Object],     *  configured and/or started,[object Object],     * @exception LifecycleException if this component detects a fatal error,[object Object],     *  in the configuration parameters it was given,[object Object],     */,[object Object],    public void configure(Node parameters),[object Object],        throws LifecycleException {,[object Object],        // Validate and update our current component state,[object Object],        if (configured),[object Object],            throw new LifecycleException,[object Object],                (sm.getString("standardManager.alreadyConfigured"));,[object Object],        configured = true;,[object Object],        if (parameters == null),[object Object],            return;,[object Object],        // Parse and process our configuration parameters,[object Object],        if (!("
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos
Introdução à programação orientada para aspectos

Más contenido relacionado

La actualidad más candente

soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!Ryosuke Uchitate
 
Understanding Source Code Differences by Separating Refactoring Effects
Understanding Source Code Differences by Separating Refactoring EffectsUnderstanding Source Code Differences by Separating Refactoring Effects
Understanding Source Code Differences by Separating Refactoring EffectsShinpei Hayashi
 
Simple API for XML
Simple API for XMLSimple API for XML
Simple API for XMLguest2556de
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011julien.ponge
 
Software Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW SydneySoftware Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW Sydneyjulien.ponge
 
Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Campjulien.ponge
 
Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113SOAT
 
The Ring programming language version 1.3 book - Part 17 of 88
The Ring programming language version 1.3 book - Part 17 of 88The Ring programming language version 1.3 book - Part 17 of 88
The Ring programming language version 1.3 book - Part 17 of 88Mahmoud Samir Fayed
 
Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Ryosuke Uchitate
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency GotchasAlex Miller
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningCarol McDonald
 
망고100 보드로 놀아보자 19
망고100 보드로 놀아보자 19망고100 보드로 놀아보자 19
망고100 보드로 놀아보자 19종인 전
 

La actualidad más candente (20)

Jersey Guice AOP
Jersey Guice AOPJersey Guice AOP
Jersey Guice AOP
 
分散式系統
分散式系統分散式系統
分散式系統
 
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
 
#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG#JavaFX.forReal() - ElsassJUG
#JavaFX.forReal() - ElsassJUG
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
 
Understanding Source Code Differences by Separating Refactoring Effects
Understanding Source Code Differences by Separating Refactoring EffectsUnderstanding Source Code Differences by Separating Refactoring Effects
Understanding Source Code Differences by Separating Refactoring Effects
 
Simple API for XML
Simple API for XMLSimple API for XML
Simple API for XML
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011
 
Software Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW SydneySoftware Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW Sydney
 
Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Camp
 
Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113
 
Qt Rest Server
Qt Rest ServerQt Rest Server
Qt Rest Server
 
Play image
Play imagePlay image
Play image
 
The Ring programming language version 1.3 book - Part 17 of 88
The Ring programming language version 1.3 book - Part 17 of 88The Ring programming language version 1.3 book - Part 17 of 88
The Ring programming language version 1.3 book - Part 17 of 88
 
Noinject
NoinjectNoinject
Noinject
 
Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門
 
Java Concurrency Gotchas
Java Concurrency GotchasJava Concurrency Gotchas
Java Concurrency Gotchas
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
망고100 보드로 놀아보자 19
망고100 보드로 놀아보자 19망고100 보드로 놀아보자 19
망고100 보드로 놀아보자 19
 

Destacado

12. Paradigmas da programação; Programação orientada por objectos; Pacotes – ...
12. Paradigmas da programação; Programação orientada por objectos; Pacotes – ...12. Paradigmas da programação; Programação orientada por objectos; Pacotes – ...
12. Paradigmas da programação; Programação orientada por objectos; Pacotes – ...Manuel Menezes de Sequeira
 
9. Operação toString(); Classes, instâncias e objectos; Scanner – Fundamentos...
9. Operação toString(); Classes, instâncias e objectos; Scanner – Fundamentos...9. Operação toString(); Classes, instâncias e objectos; Scanner – Fundamentos...
9. Operação toString(); Classes, instâncias e objectos; Scanner – Fundamentos...Manuel Menezes de Sequeira
 
3. Funções/repórteres e listas em Snap!; Utilização de variáveis – Fundamento...
3. Funções/repórteres e listas em Snap!; Utilização de variáveis – Fundamento...3. Funções/repórteres e listas em Snap!; Utilização de variáveis – Fundamento...
3. Funções/repórteres e listas em Snap!; Utilização de variáveis – Fundamento...Manuel Menezes de Sequeira
 
7. Arrays multidimensionais; Estratégias de resolução de problemas – Fundamen...
7. Arrays multidimensionais; Estratégias de resolução de problemas – Fundamen...7. Arrays multidimensionais; Estratégias de resolução de problemas – Fundamen...
7. Arrays multidimensionais; Estratégias de resolução de problemas – Fundamen...Manuel Menezes de Sequeira
 
8. Classes e instâncias; Cadeias de caracteres – Fundamentos de Programação
8. Classes e instâncias; Cadeias de caracteres – Fundamentos de Programação8. Classes e instâncias; Cadeias de caracteres – Fundamentos de Programação
8. Classes e instâncias; Cadeias de caracteres – Fundamentos de ProgramaçãoManuel Menezes de Sequeira
 
4. Introdução à linguagem de programação Java – Fundamentos de Programação
4. Introdução à linguagem de programação Java – Fundamentos de Programação4. Introdução à linguagem de programação Java – Fundamentos de Programação
4. Introdução à linguagem de programação Java – Fundamentos de ProgramaçãoManuel Menezes de Sequeira
 
13. Polimorfismo de subtipos; Análise, desenho e implementação – Fundamentos ...
13. Polimorfismo de subtipos; Análise, desenho e implementação – Fundamentos ...13. Polimorfismo de subtipos; Análise, desenho e implementação – Fundamentos ...
13. Polimorfismo de subtipos; Análise, desenho e implementação – Fundamentos ...Manuel Menezes de Sequeira
 
11. Enumerações; Instrução switch; Limitações dos inteiros – Fundamentos de P...
11. Enumerações; Instrução switch; Limitações dos inteiros – Fundamentos de P...11. Enumerações; Instrução switch; Limitações dos inteiros – Fundamentos de P...
11. Enumerações; Instrução switch; Limitações dos inteiros – Fundamentos de P...Manuel Menezes de Sequeira
 
5. Atribuições especiais; Arrays; Tipos de ciclos; Classes-pacote – Fundament...
5. Atribuições especiais; Arrays; Tipos de ciclos; Classes-pacote – Fundament...5. Atribuições especiais; Arrays; Tipos de ciclos; Classes-pacote – Fundament...
5. Atribuições especiais; Arrays; Tipos de ciclos; Classes-pacote – Fundament...Manuel Menezes de Sequeira
 
2. Programação e resolução de problemas; Algoritmos; Snap! – Fundamentos de P...
2. Programação e resolução de problemas; Algoritmos; Snap! – Fundamentos de P...2. Programação e resolução de problemas; Algoritmos; Snap! – Fundamentos de P...
2. Programação e resolução de problemas; Algoritmos; Snap! – Fundamentos de P...Manuel Menezes de Sequeira
 
10. Encapsulação; Cópia de instâncias; Igualdade de instâncias – Fundamentos ...
10. Encapsulação; Cópia de instâncias; Igualdade de instâncias – Fundamentos ...10. Encapsulação; Cópia de instâncias; Igualdade de instâncias – Fundamentos ...
10. Encapsulação; Cópia de instâncias; Igualdade de instâncias – Fundamentos ...Manuel Menezes de Sequeira
 
1. Computador; Línguas naturais; Linguagens de Programação; Algoritmo e progr...
1. Computador; Línguas naturais; Linguagens de Programação; Algoritmo e progr...1. Computador; Línguas naturais; Linguagens de Programação; Algoritmo e progr...
1. Computador; Línguas naturais; Linguagens de Programação; Algoritmo e progr...Manuel Menezes de Sequeira
 
14. Interfaces; Listas e cadeias ligadas; Iteradores – Fundamentos de Program...
14. Interfaces; Listas e cadeias ligadas; Iteradores – Fundamentos de Program...14. Interfaces; Listas e cadeias ligadas; Iteradores – Fundamentos de Program...
14. Interfaces; Listas e cadeias ligadas; Iteradores – Fundamentos de Program...Manuel Menezes de Sequeira
 
Eng.ª do Software - 3. Processos da engenharia de requisitos
Eng.ª do Software - 3. Processos da engenharia de requisitosEng.ª do Software - 3. Processos da engenharia de requisitos
Eng.ª do Software - 3. Processos da engenharia de requisitosManuel Menezes de Sequeira
 

Destacado (20)

12. Paradigmas da programação; Programação orientada por objectos; Pacotes – ...
12. Paradigmas da programação; Programação orientada por objectos; Pacotes – ...12. Paradigmas da programação; Programação orientada por objectos; Pacotes – ...
12. Paradigmas da programação; Programação orientada por objectos; Pacotes – ...
 
9. Operação toString(); Classes, instâncias e objectos; Scanner – Fundamentos...
9. Operação toString(); Classes, instâncias e objectos; Scanner – Fundamentos...9. Operação toString(); Classes, instâncias e objectos; Scanner – Fundamentos...
9. Operação toString(); Classes, instâncias e objectos; Scanner – Fundamentos...
 
3. Funções/repórteres e listas em Snap!; Utilização de variáveis – Fundamento...
3. Funções/repórteres e listas em Snap!; Utilização de variáveis – Fundamento...3. Funções/repórteres e listas em Snap!; Utilização de variáveis – Fundamento...
3. Funções/repórteres e listas em Snap!; Utilização de variáveis – Fundamento...
 
Programação Orientada por Objectos - Aula 7
Programação Orientada por Objectos - Aula 7Programação Orientada por Objectos - Aula 7
Programação Orientada por Objectos - Aula 7
 
7. Arrays multidimensionais; Estratégias de resolução de problemas – Fundamen...
7. Arrays multidimensionais; Estratégias de resolução de problemas – Fundamen...7. Arrays multidimensionais; Estratégias de resolução de problemas – Fundamen...
7. Arrays multidimensionais; Estratégias de resolução de problemas – Fundamen...
 
8. Classes e instâncias; Cadeias de caracteres – Fundamentos de Programação
8. Classes e instâncias; Cadeias de caracteres – Fundamentos de Programação8. Classes e instâncias; Cadeias de caracteres – Fundamentos de Programação
8. Classes e instâncias; Cadeias de caracteres – Fundamentos de Programação
 
Programação Orientada por Objectos - Aula 1
Programação Orientada por Objectos - Aula 1Programação Orientada por Objectos - Aula 1
Programação Orientada por Objectos - Aula 1
 
Programação Orientada por Objectos - Aula 6
Programação Orientada por Objectos - Aula 6Programação Orientada por Objectos - Aula 6
Programação Orientada por Objectos - Aula 6
 
4. Introdução à linguagem de programação Java – Fundamentos de Programação
4. Introdução à linguagem de programação Java – Fundamentos de Programação4. Introdução à linguagem de programação Java – Fundamentos de Programação
4. Introdução à linguagem de programação Java – Fundamentos de Programação
 
13. Polimorfismo de subtipos; Análise, desenho e implementação – Fundamentos ...
13. Polimorfismo de subtipos; Análise, desenho e implementação – Fundamentos ...13. Polimorfismo de subtipos; Análise, desenho e implementação – Fundamentos ...
13. Polimorfismo de subtipos; Análise, desenho e implementação – Fundamentos ...
 
Programação Orientada por Objectos - Aula 3
Programação Orientada por Objectos - Aula 3Programação Orientada por Objectos - Aula 3
Programação Orientada por Objectos - Aula 3
 
11. Enumerações; Instrução switch; Limitações dos inteiros – Fundamentos de P...
11. Enumerações; Instrução switch; Limitações dos inteiros – Fundamentos de P...11. Enumerações; Instrução switch; Limitações dos inteiros – Fundamentos de P...
11. Enumerações; Instrução switch; Limitações dos inteiros – Fundamentos de P...
 
5. Atribuições especiais; Arrays; Tipos de ciclos; Classes-pacote – Fundament...
5. Atribuições especiais; Arrays; Tipos de ciclos; Classes-pacote – Fundament...5. Atribuições especiais; Arrays; Tipos de ciclos; Classes-pacote – Fundament...
5. Atribuições especiais; Arrays; Tipos de ciclos; Classes-pacote – Fundament...
 
2. Programação e resolução de problemas; Algoritmos; Snap! – Fundamentos de P...
2. Programação e resolução de problemas; Algoritmos; Snap! – Fundamentos de P...2. Programação e resolução de problemas; Algoritmos; Snap! – Fundamentos de P...
2. Programação e resolução de problemas; Algoritmos; Snap! – Fundamentos de P...
 
10. Encapsulação; Cópia de instâncias; Igualdade de instâncias – Fundamentos ...
10. Encapsulação; Cópia de instâncias; Igualdade de instâncias – Fundamentos ...10. Encapsulação; Cópia de instâncias; Igualdade de instâncias – Fundamentos ...
10. Encapsulação; Cópia de instâncias; Igualdade de instâncias – Fundamentos ...
 
Programação Orientada por Objectos - Aula 2
Programação Orientada por Objectos - Aula 2Programação Orientada por Objectos - Aula 2
Programação Orientada por Objectos - Aula 2
 
1. Computador; Línguas naturais; Linguagens de Programação; Algoritmo e progr...
1. Computador; Línguas naturais; Linguagens de Programação; Algoritmo e progr...1. Computador; Línguas naturais; Linguagens de Programação; Algoritmo e progr...
1. Computador; Línguas naturais; Linguagens de Programação; Algoritmo e progr...
 
Programação Orientada por Objectos - Aula 5
Programação Orientada por Objectos - Aula 5Programação Orientada por Objectos - Aula 5
Programação Orientada por Objectos - Aula 5
 
14. Interfaces; Listas e cadeias ligadas; Iteradores – Fundamentos de Program...
14. Interfaces; Listas e cadeias ligadas; Iteradores – Fundamentos de Program...14. Interfaces; Listas e cadeias ligadas; Iteradores – Fundamentos de Program...
14. Interfaces; Listas e cadeias ligadas; Iteradores – Fundamentos de Program...
 
Eng.ª do Software - 3. Processos da engenharia de requisitos
Eng.ª do Software - 3. Processos da engenharia de requisitosEng.ª do Software - 3. Processos da engenharia de requisitos
Eng.ª do Software - 3. Processos da engenharia de requisitos
 

Similar a Introdução à programação orientada para aspectos

Jsp session tracking
Jsp   session trackingJsp   session tracking
Jsp session trackingrvarshneyp
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session ManagementFahad Golra
 
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...Big Data Spain
 
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade ServerlessKatyShimizu
 
[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade Serverless[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade ServerlessKatyShimizu
 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Paco de la Cruz
 
Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsYakov Fain
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state managementpriya Nithya
 
Threads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSThreads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSTechWell
 
Session Tracking in servlets
Session Tracking in servletsSession Tracking in servlets
Session Tracking in servletschauhankapil
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3Simon Su
 
Java Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsJava Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsAleksandar Ilić
 
Java Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsJava Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsPSTechSerbia
 
#3 (Multi Threads With TCP)
#3 (Multi Threads With TCP)#3 (Multi Threads With TCP)
#3 (Multi Threads With TCP)Ghadeer AlHasan
 
Advanced iOS Build Mechanics, Sebastien Pouliot
Advanced iOS Build Mechanics, Sebastien PouliotAdvanced iOS Build Mechanics, Sebastien Pouliot
Advanced iOS Build Mechanics, Sebastien PouliotXamarin
 

Similar a Introdução à programação orientada para aspectos (20)

Jsp session tracking
Jsp   session trackingJsp   session tracking
Jsp session tracking
 
JavaScript Refactoring
JavaScript RefactoringJavaScript Refactoring
JavaScript Refactoring
 
Lecture 3: Servlets - Session Management
Lecture 3:  Servlets - Session ManagementLecture 3:  Servlets - Session Management
Lecture 3: Servlets - Session Management
 
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
BigQuery JavaScript User-Defined Functions by THOMAS PARK and FELIPE HOFFA at...
 
Introduccion a AspectJ
Introduccion a AspectJIntroduccion a AspectJ
Introduccion a AspectJ
 
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
 
[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade Serverless[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Enterprise-Grade Serverless
 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30)
 
Speed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSocketsSpeed up your Web applications with HTML5 WebSockets
Speed up your Web applications with HTML5 WebSockets
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Reactive Data System
Reactive Data SystemReactive Data System
Reactive Data System
 
Asp.net state management
Asp.net state managementAsp.net state management
Asp.net state management
 
Threads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOSThreads, Queues, and More: Async Programming in iOS
Threads, Queues, and More: Async Programming in iOS
 
Session Tracking in servlets
Session Tracking in servletsSession Tracking in servlets
Session Tracking in servlets
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3
 
Java Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsJava Svet - Communication Between Android App Components
Java Svet - Communication Between Android App Components
 
Java Svet - Communication Between Android App Components
Java Svet - Communication Between Android App ComponentsJava Svet - Communication Between Android App Components
Java Svet - Communication Between Android App Components
 
Unit Testing
Unit TestingUnit Testing
Unit Testing
 
#3 (Multi Threads With TCP)
#3 (Multi Threads With TCP)#3 (Multi Threads With TCP)
#3 (Multi Threads With TCP)
 
Advanced iOS Build Mechanics, Sebastien Pouliot
Advanced iOS Build Mechanics, Sebastien PouliotAdvanced iOS Build Mechanics, Sebastien Pouliot
Advanced iOS Build Mechanics, Sebastien Pouliot
 

Más de Manuel Menezes de Sequeira

6. Caracteres; Tipos char e int; Tipos de valor e de referência – Fundamentos...
6. Caracteres; Tipos char e int; Tipos de valor e de referência – Fundamentos...6. Caracteres; Tipos char e int; Tipos de valor e de referência – Fundamentos...
6. Caracteres; Tipos char e int; Tipos de valor e de referência – Fundamentos...Manuel Menezes de Sequeira
 
Semana 10: Encapsulação, cópia de instâncias, igualdade de instâncias
Semana 10: Encapsulação, cópia de instâncias, igualdade de instânciasSemana 10: Encapsulação, cópia de instâncias, igualdade de instâncias
Semana 10: Encapsulação, cópia de instâncias, igualdade de instânciasManuel Menezes de Sequeira
 
Semana 9: toString, classes, instâncias e objectos, Scanner
Semana  9: toString, classes, instâncias e objectos, ScannerSemana  9: toString, classes, instâncias e objectos, Scanner
Semana 9: toString, classes, instâncias e objectos, ScannerManuel Menezes de Sequeira
 
Semana 8: Classes e instâncias, cadeias de caracteres
Semana  8: Classes e instâncias, cadeias de caracteresSemana  8: Classes e instâncias, cadeias de caracteres
Semana 8: Classes e instâncias, cadeias de caracteresManuel Menezes de Sequeira
 
Semana 6: Matrizes multidimensionais, estratégias de resolução de problemas
Semana  6: Matrizes multidimensionais, estratégias de resolução de problemasSemana  6: Matrizes multidimensionais, estratégias de resolução de problemas
Semana 6: Matrizes multidimensionais, estratégias de resolução de problemasManuel Menezes de Sequeira
 
Semana 5: Caracteres, tipos char e int, tipos de valor vs. tipos de referência
Semana  5: Caracteres, tipos char e int, tipos de valor vs. tipos de referênciaSemana  5: Caracteres, tipos char e int, tipos de valor vs. tipos de referência
Semana 5: Caracteres, tipos char e int, tipos de valor vs. tipos de referênciaManuel Menezes de Sequeira
 
Semana 4: Atribuições especiais, matrizes, ciclos, classes pacote
Semana  4: Atribuições especiais, matrizes, ciclos, classes pacoteSemana  4: Atribuições especiais, matrizes, ciclos, classes pacote
Semana 4: Atribuições especiais, matrizes, ciclos, classes pacoteManuel Menezes de Sequeira
 
Semana 3: Introdução à linguagem de programação Java
Semana  3: Introdução à linguagem de programação Java Semana  3: Introdução à linguagem de programação Java
Semana 3: Introdução à linguagem de programação Java Manuel Menezes de Sequeira
 
Semana 1: Programação como arte de resolver problemas, algoritmos e problema...
Semana  1: Programação como arte de resolver problemas, algoritmos e problema...Semana  1: Programação como arte de resolver problemas, algoritmos e problema...
Semana 1: Programação como arte de resolver problemas, algoritmos e problema...Manuel Menezes de Sequeira
 
Semana 0: Computadores, linguagens e linguagens de programação, Noções de al...
Semana  0: Computadores, linguagens e linguagens de programação, Noções de al...Semana  0: Computadores, linguagens e linguagens de programação, Noções de al...
Semana 0: Computadores, linguagens e linguagens de programação, Noções de al...Manuel Menezes de Sequeira
 
Semana 11: Enumerações, limites de tipos numéricos (gama e precisão)
Semana 11: Enumerações, limites de tipos numéricos (gama e precisão)Semana 11: Enumerações, limites de tipos numéricos (gama e precisão)
Semana 11: Enumerações, limites de tipos numéricos (gama e precisão)Manuel Menezes de Sequeira
 
Eng.ª do Software - 9. Verificação e validação
Eng.ª do Software - 9. Verificação e validaçãoEng.ª do Software - 9. Verificação e validação
Eng.ª do Software - 9. Verificação e validaçãoManuel Menezes de Sequeira
 
Eng.ª do Software - 8. Desenho de interfaces com o utilizador
Eng.ª do Software - 8. Desenho de interfaces com o utilizadorEng.ª do Software - 8. Desenho de interfaces com o utilizador
Eng.ª do Software - 8. Desenho de interfaces com o utilizadorManuel Menezes de Sequeira
 
Eng.ª do Software - 7. Desenho arquitectónico
Eng.ª do Software - 7. Desenho arquitectónicoEng.ª do Software - 7. Desenho arquitectónico
Eng.ª do Software - 7. Desenho arquitectónicoManuel Menezes de Sequeira
 

Más de Manuel Menezes de Sequeira (17)

6. Caracteres; Tipos char e int; Tipos de valor e de referência – Fundamentos...
6. Caracteres; Tipos char e int; Tipos de valor e de referência – Fundamentos...6. Caracteres; Tipos char e int; Tipos de valor e de referência – Fundamentos...
6. Caracteres; Tipos char e int; Tipos de valor e de referência – Fundamentos...
 
Semana 10: Encapsulação, cópia de instâncias, igualdade de instâncias
Semana 10: Encapsulação, cópia de instâncias, igualdade de instânciasSemana 10: Encapsulação, cópia de instâncias, igualdade de instâncias
Semana 10: Encapsulação, cópia de instâncias, igualdade de instâncias
 
Semana 9: toString, classes, instâncias e objectos, Scanner
Semana  9: toString, classes, instâncias e objectos, ScannerSemana  9: toString, classes, instâncias e objectos, Scanner
Semana 9: toString, classes, instâncias e objectos, Scanner
 
Semana 8: Classes e instâncias, cadeias de caracteres
Semana  8: Classes e instâncias, cadeias de caracteresSemana  8: Classes e instâncias, cadeias de caracteres
Semana 8: Classes e instâncias, cadeias de caracteres
 
Semana 6: Matrizes multidimensionais, estratégias de resolução de problemas
Semana  6: Matrizes multidimensionais, estratégias de resolução de problemasSemana  6: Matrizes multidimensionais, estratégias de resolução de problemas
Semana 6: Matrizes multidimensionais, estratégias de resolução de problemas
 
Semana 5: Caracteres, tipos char e int, tipos de valor vs. tipos de referência
Semana  5: Caracteres, tipos char e int, tipos de valor vs. tipos de referênciaSemana  5: Caracteres, tipos char e int, tipos de valor vs. tipos de referência
Semana 5: Caracteres, tipos char e int, tipos de valor vs. tipos de referência
 
Semana 4: Atribuições especiais, matrizes, ciclos, classes pacote
Semana  4: Atribuições especiais, matrizes, ciclos, classes pacoteSemana  4: Atribuições especiais, matrizes, ciclos, classes pacote
Semana 4: Atribuições especiais, matrizes, ciclos, classes pacote
 
Semana 3: Introdução à linguagem de programação Java
Semana  3: Introdução à linguagem de programação Java Semana  3: Introdução à linguagem de programação Java
Semana 3: Introdução à linguagem de programação Java
 
Semana 2: Funções e listas, variáveis
Semana  2: Funções e listas, variáveisSemana  2: Funções e listas, variáveis
Semana 2: Funções e listas, variáveis
 
Semana 1: Programação como arte de resolver problemas, algoritmos e problema...
Semana  1: Programação como arte de resolver problemas, algoritmos e problema...Semana  1: Programação como arte de resolver problemas, algoritmos e problema...
Semana 1: Programação como arte de resolver problemas, algoritmos e problema...
 
Semana 0: Computadores, linguagens e linguagens de programação, Noções de al...
Semana  0: Computadores, linguagens e linguagens de programação, Noções de al...Semana  0: Computadores, linguagens e linguagens de programação, Noções de al...
Semana 0: Computadores, linguagens e linguagens de programação, Noções de al...
 
Semana 11: Enumerações, limites de tipos numéricos (gama e precisão)
Semana 11: Enumerações, limites de tipos numéricos (gama e precisão)Semana 11: Enumerações, limites de tipos numéricos (gama e precisão)
Semana 11: Enumerações, limites de tipos numéricos (gama e precisão)
 
Eng.ª do Software - 10. Testes de software
Eng.ª do Software - 10. Testes de softwareEng.ª do Software - 10. Testes de software
Eng.ª do Software - 10. Testes de software
 
Eng.ª do Software - 9. Verificação e validação
Eng.ª do Software - 9. Verificação e validaçãoEng.ª do Software - 9. Verificação e validação
Eng.ª do Software - 9. Verificação e validação
 
Eng.ª do Software - 8. Desenho de interfaces com o utilizador
Eng.ª do Software - 8. Desenho de interfaces com o utilizadorEng.ª do Software - 8. Desenho de interfaces com o utilizador
Eng.ª do Software - 8. Desenho de interfaces com o utilizador
 
Eng.ª do Software - 7. Desenho arquitectónico
Eng.ª do Software - 7. Desenho arquitectónicoEng.ª do Software - 7. Desenho arquitectónico
Eng.ª do Software - 7. Desenho arquitectónico
 
Eng.ª do Software - 6. Gestão de projectos
Eng.ª do Software - 6. Gestão de projectosEng.ª do Software - 6. Gestão de projectos
Eng.ª do Software - 6. Gestão de projectos
 

Último

CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapitolTechU
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?TechSoup
 
How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17Celine George
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRATanmoy Mishra
 
Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.EnglishCEIPdeSigeiro
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptxmary850239
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfMohonDas
 
Ultra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxUltra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxDr. Asif Anas
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxheathfieldcps1
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfMohonDas
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational PhilosophyShuvankar Madhu
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17Celine George
 
UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptxSandy Millin
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxiammrhaywood
 
How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17Celine George
 
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxPractical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxKatherine Villaluna
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice documentXsasf Sfdfasd
 
Practical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxPractical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxKatherine Villaluna
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfTechSoup
 

Último (20)

CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptx
 
What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?
 
How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17How to Use api.constrains ( ) in Odoo 17
How to Use api.constrains ( ) in Odoo 17
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
 
Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.Easter in the USA presentation by Chloe.
Easter in the USA presentation by Chloe.
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptx
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdf
 
Ultra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxUltra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptx
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptx
 
HED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdfHED Office Sohayok Exam Question Solution 2023.pdf
HED Office Sohayok Exam Question Solution 2023.pdf
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational Philosophy
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17
 
UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024UKCGE Parental Leave Discussion March 2024
UKCGE Parental Leave Discussion March 2024
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
 
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptxAUDIENCE THEORY -- FANDOM -- JENKINS.pptx
AUDIENCE THEORY -- FANDOM -- JENKINS.pptx
 
How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17
 
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxPractical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice document
 
Practical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxPractical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptx
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
 

Introdução à programação orientada para aspectos

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.