Now the Plankton Webserver also supports POST.
http://worldofcreeps.com:443/signin.plk
I have extended the plankton webserver with the creeps app, to run both the world and the webserver. The sign in and the creep list is therefore made directly in the running world, no serializations and sending of data over sockets as in the tomcat-servlet solution before.
creeps app - inherits plankton webserver
the creeps app starts the world in a new thread
the world takes a jtextarea (app output in the web server swing gui) as start argument and dumps all the output there.
So the current world actually runs in the plankton webserver environment since a couple of weeks.
måndag 12 april 2010
måndag 15 februari 2010
Pools and Cache
This weekend I implemented a connection pool for the Plankton Webserver. I let a fixed number of threads start in the initialization and then leave them waiting for clients. Before I started a new connection thread whenever a client connected. This should be better for performance (not that it matters by now, but why not build it in from the start).
Before that I implemented a cache collection object. When a client requests a page, the connection will request it from the cache. If it's not in there, the cache will read it from file and save it in the collection. At this point all pages are kept in the cache, so that files would only have to be read once by the server. I will extend the cache functionality in the future though, calculating popularity, setting a max size etc.
Next i will build a special cache object for .plk pages. This object will keep the file content split up in a collection of WebParts, where the static content will be a new subclass of WebPart called StaticWebPart. This will minimize startup time for a new .plk page, because the page in the cache will already be parsed and ready for the load-method, the triggered event (if any) and the the rendering of the webparts collection.
Before that I implemented a cache collection object. When a client requests a page, the connection will request it from the cache. If it's not in there, the cache will read it from file and save it in the collection. At this point all pages are kept in the cache, so that files would only have to be read once by the server. I will extend the cache functionality in the future though, calculating popularity, setting a max size etc.
Next i will build a special cache object for .plk pages. This object will keep the file content split up in a collection of WebParts, where the static content will be a new subclass of WebPart called StaticWebPart. This will minimize startup time for a new .plk page, because the page in the cache will already be parsed and ready for the load-method, the triggered event (if any) and the the rendering of the webparts collection.
Etiketter:
connection pool,
java,
plankton,
thread pool,
webserver
fredag 22 januari 2010
Server Side Code
First try with a custom plankton app has succeeded. How to extend plankton and make your own server logic:
Start your java project. Include the plankton.jar library. In your app, import com.plankton.*. Create a new WebServer object. That's basically it. But that doesn't do anything more than running the plankton webserver on it's own.
To insert your own server logic - create a new class that extends com.plankton.WebPage, let's call it myapp.TestWebPage. Do something in the class, let's just write something to the page in the constructor of the class:
write("hello world");
Then, last step to attach it to a plk-file. Add the class reference to the initial <plk> node:
<plk template="template.html" class="myapp.TestWebPage">
... your design ...
Done. Run your app. Surf to your .plk page and the text "hello world" will be printed before any content in the file. My example here
http://worldofcreeps.com:443/plankton.plk
The text I wrote from my custom class is "I'm running the PlanktonTest!!!"
Start your java project. Include the plankton.jar library. In your app, import com.plankton.*. Create a new WebServer object. That's basically it. But that doesn't do anything more than running the plankton webserver on it's own.
To insert your own server logic - create a new class that extends com.plankton.WebPage, let's call it myapp.TestWebPage. Do something in the class, let's just write something to the page in the constructor of the class:
write("hello world");
Then, last step to attach it to a plk-file. Add the class reference to the initial <plk> node:
<plk template="template.html" class="myapp.TestWebPage">
... your design ...
Done. Run your app. Surf to your .plk page and the text "hello world" will be printed before any content in the file. My example here
http://worldofcreeps.com:443/plankton.plk
The text I wrote from my custom class is "I'm running the PlanktonTest!!!"
måndag 18 januari 2010
New Times
There has not been much development since the summer. I have my reasons. However, just recently I dusted off the old code. I have started to write a new webserver, for now called "Plankton". It is going to be a real lightweight and easy to start/use application for anyone who wants to run a small web without huge memory-and-process-consuming server applications, learning curve and tons of configuration options.
My thought is to also use Plankton for the World of Creeps, replacing the current tomcat/jsp setup. If this works as I intend, I will get rid of an application layer and in the same time make it much faster to develop since I won't be having the trouble with transferring live objects from one java-process to another (The running world -> Web app on tomcat). Web server and world will be the same running application.
The first test with Plankton v0.1b is running on port 443
http://worldofcreeps.com:443/
Etiketter:
applicationserver,
information,
plankton,
technical,
thoughts,
webserver
söndag 26 juli 2009
The Mail Problems
Well, it seems registrations has been working after all. The ISP may have shut down the account, but somehow the relay works. So I'll leave it for now. I guess I won't be able to read mail sent to the mail address, but it seems to work sending out info and that's what it's for...
tisdag 21 juli 2009
Always...
As always there is a problem when I leave home for a trip. This time my ISP shut down the mail account sending all creep mails. Reason, someone has hijacked it for sending spam. This means no one can register for now since I have an email confirmation on the registration. I talked to the support on the phone when I was on the airport, but it was a stupid drone who didn't know anything. When I'm back on Friday I will try to fix this.
Time for another pint. Over and out.
Time for another pint. Over and out.
lördag 18 juli 2009
Vacation
Summer vacation is finally here. 4 weeks. If you want www.worldofcreeps.com to develop - wish for rain and cold weather in Sweden :)
First off is a trip to Scotland 20-24 Aug. A good test to see if all my architectural changes has made the world more stable. But if the world decides to take a rest, hold on until Friday, then it will be restarted.
First off is a trip to Scotland 20-24 Aug. A good test to see if all my architectural changes has made the world more stable. But if the world decides to take a rest, hold on until Friday, then it will be restarted.
Prenumerera på:
Inlägg (Atom)