Skip to content

kfc35/sigh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kfc35m ss2249, hhc39

To run:
  Deploy the .war file into the tomcat7 webapps directory

Our code is separated into two components:
The java code:
	TERMINATOR
            A thread that removes expired session from the concurrent hashmap table of sessions. 
            This runs every 2 minutes, as every cookie expires in 2 minutes. 
            Every SERVLET owns its own terminator, and it is synchronized.
	SERVLET 
            The main instance and logic for this project, it is called in both GET and POST instances. 
            GET is for first time access and refresh, which we determined were very similar. 
            POST is for Log out and Replace. 
            There's a concurrent hash map for the sessions. We chose this over a priority queue because we believed it better to be better for lookups. 
            The sessionId is UUID (in the future with multiple servlets, the sessionID will be also include the servlet number, which is simply zero in this case). The version number and the location metadata are so far ignored in this project.  
            The cookies passed to the client is a regular java cookie with the value as the class name of CS5300PROJ1SESSION and the value as the sessionId, the version number, and the location. In the case of Log out, a max age of 0 is sent.
            The code is divided into many sub-functions that prevent repetitive code. The main difference that we've found is the different actions on what to do if a session is found. This is resolved with enums. 
	SESSION  
            In addition to its inherent values as a cookie, it also has a string sessionId, a string message, location, and a long end (expiration time). 
            

The html
  index.jsp:
	          The html is rendered per response. There are various getServletContext requests to fill out the information to be updated, such as the message, the expiration time, and the address.
            This is called every time there is a request, and it is sent through the requestDispatcher.
  bye.html:
            This is a simple PrintWriter for response to say "bye".

Concurrency:
	          The session table is a concurrent hash map.
            For all corresponding read/write to the hash map, there is synchronized (hashmap) surrounding the statements.

Cheers, 
Kevin, Horace, and Sweet

About

CS5300

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages