Friday, June 3, 2011

Threading the HTTP Server

Unfortunately, I have not had as much time as I would like to have to spend at 8th Light (porque tengo una clase de español en la tarde). That being said, this week I was able to create a working HTTP server and play out entire tic-tac-toe games. This works great and I'm glad to be at this point. From here I need to make my server threaded (we don't want everyone playing one collective game) and manage games per user. This lead my inquiries into two directions; one, to Threads in Java and two, to using cookies to manage user sessions.

Java's standard library includes a Thread class which makes threaded concurrency fairly simple when working with Java. By having my Server class extend Thread I am able to receive concurrent Socket connections and handle them properly. This piece of work is still in progress, but extending Thread allows me to avoid a complete headache.

Using cookies is also fairly simple. When generating my packet headers I now need to be mindful of the Set-Cookie and Cookie fields. When generating a new Game, I can assign a new cookie and use a HashMap to map the unique cookie to the specific Game. Moving forward, I need to reset the cookie at the end of each game and then this portion of my code will be working.

I was also able to implement a few other odds and ends relating to my HTTP server, namely I now give out a 404 Error for paths that do not exist.

This week I was also introduced to Artisan and 8th Light's project management process. Mike was able to help me get started with using Artisan. He explained the ideas of stories, iterations, estimating, ect, that all go into managing projects. I was also able to work on an Artisan project on Artisan (let that sink in). Kevin and I were able to take some time to pair and work on a story to validate unique login names and allow users to only edit their own profile.

Finally, I was able to deploy my gaeshi project to fulfill the homework requirements for last week's 8th Light university. It's not much and I would really like to play around with Gaeshi when I have some spare time. I want to try something ambitious and create a blogging app for Gaeshi and migrate my 8th Light blog.

No comments:

Post a Comment