Code Search for Developers
 
 
  

ThinkcapSessionListener.java from ThinkCap Collaborative Knowledge Portal at Krugle


Show ThinkcapSessionListener.java syntax highlighted

package org.integratedmodelling.thinkcap;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

import org.apache.velocity.VelocityContext;
import org.integratedmodelling.thinklab.exception.ThinklabException;

public class ThinkcapSessionListener implements HttpSessionListener {

	public void sessionCreated(HttpSessionEvent arg0) {

		HttpSession session = arg0.getSession();
		
    	/* create new IMT session and link it to HTTP session */
    	ThinkcapSession sess = null;
    	
    	ThinkCap thinkcap = ThinkcapManager.getThinkcapManager().getThinkcap();
        	
       	try {
			sess = (ThinkcapSession) thinkcap.createNewSession();
		} catch (ThinklabException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        session.setAttribute("thinkcap.session.IMTSession", sess);

        
        /*
         *  TODO authentication, logging, bookkeeping 
         * lookup cookies
         * 
         * */
        
        /* retrieve common context */
        VelocityContext cct = (VelocityContext)
        session.getServletContext().getAttribute("thinkcap.VelocityContext");
        
        
        /* 
         * prepare context for request handling, merging in common context 
         */
        VelocityContext ctx = new VelocityContext(cct);
        
        /* initialize as needed */
        ctx.put("pageSpecs", new PageSpecs(ctx));
        ctx.put("thinkcapSession", sess);
        
        /* put stuff into session */
        sess.initialize(session, ctx);
        
        /* set context into http session */
        session.setAttribute("thinkcap.session.VelocityContext", ctx);

	}

	public void sessionDestroyed(HttpSessionEvent arg0) {
		// TODO cleanup, save

	}

}




See more files for this project here

ThinkCap Collaborative Knowledge Portal

A portal to explore and edit the knowledge contained in a set of ontologies in intuitive ways. Presents a Dictionary view (a Google-like interface), a Thesaurus view (a graphical display with simplified relationships) and a full graphical Concept view.

Project homepage: http://sourceforge.net/projects/thinkcap
Programming language(s): Java,JavaScript,XML
License: other

  basecommands/
    StreamResource.java
    StreamTemplate.java
    ThinkcapMain.java
  exceptions/
    ThinkcapException.java
    ThinkcapWidgetException.java
  portfolio/
    ThinkcapPortfolio.java
  widget/
    HtmlLink.java
    IItemDecorator.java
    IThinkcapWidget.java
    IWidgetPublisher.java
    ImageDecorator.java
    PopupMenu.java
    ThinkcapInputWidget.java
    ThinkcapWidgetManager.java
  PageSpecs.java
  ResultContainer.java
  TemplateProcessor.java
  ThinkCap.java
  ThinkcapAction.java
  ThinkcapAnswer.java
  ThinkcapCommand.java
  ThinkcapManager.java
  ThinkcapPlugin.java
  ThinkcapSession.java
  ThinkcapSessionListener.java