Which client will dominate?

I first got into the magical world of the internet in the happy 90’s. Back then you could find 3 basic types of network application clients: Internet lightweight web sites (HTML, JS), installed applications with network connection like ICQ or Applets. The years went by, the internet connection got faster and richer applications came out of the desktop and into the browser. The web applications clients became fatter. Even if the desktop applications still exist, they have clearly become a lot less common. That was about the time I started developing in java. The obvious solution for many of these fat clients were the java web frameworks like Struts, JSF and all the others. But as the years went by a new approach became more and more popular – the Ajax web applications, with GMail in the lead. Fat clients never looked better and the usability was excellent. It is almost as if we are using desktop applications (!?!). JavaScript was never so cool. Libraries like JQuery are born every day as well as some new solutions like GWT to make our life with JavaScript easier. But the story doesn’t end here. With the birth of the smart cellphones an Continue reading Which client will dominate?

Handeling session cookies with Java

Let’s say you are creating an HTTP request using Java. You are probably doing it with the use of the URL object like this: But sometimes you will also want to use cookies to send along with you request. To do so first we will learn how to read cookies from the request. Getting the cookies from a URL connection After the function uc.connect(); you are able to get cookies from your request. Here is the result of this example: PREF=ID=f0fd8b4c16931772:TM=1261387922:LM=1261387922:S=LLhLkHSpgfXkqxIe; expires=Wed, 21-Dec-2011 09:32:02 GMT; path=/; domain=.google.co.uk NID=30=C6Hb5SV2-pqYymnnrZmTAprCvDMrFwo6wzg9We7rvPztXmA_fTWxv-GPmDVXPsIBOOkecj1Ms4skmTWT-uUN5iW_-ZYiPUNNJXE8CC44xWVORe8Yyu1jI32XL51tvzCz; expires=Tue, 22-Jun-2010 09:32:02 GMT; path=/; domain=.google.co.uk; HttpOnly Sending HTTP request with cookies: Notice that the value of the property ‘Cookie’ is a string which contains cookies in the format of cookieName=CookieValue with a ‘;’ as a delimiter. Notice you have to set the cookie value before the connect() function. download source