Thursday Feb 05, 2009

Java SE 6 update 12 supports Windows 2008 Server

 Java SE 6 update 12 shipped earlier this week and it is now available for download here. Key improvements include:

  • Windows 2008 Server Support : Java 6 Update 12 now support Windows 2008.
  • Java Plug-in now supports 64-bit browsers (4802695)

Sunday Feb 17, 2008

What are the web servers that power the internet?

So how can you tell what server is being used to run a website? Here is a simple Java program that can help one figure out the kind of server that serves a particular website.

package whataretheyrunning;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

/\*\*
 \*
 \* @author octav
 \*/
public class SnoopURL {

    String URLString = null;

    public SnoopURL(String URLString) {
        this.URLString = URLString;
    }

    public void snoop() {
        try {
            // build URL
            URL url = new URL(URLString);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestMethod("GET";);
            conn.setDoOutput(true);

            // start talking
            conn.connect();

            // int length = conn.getContentLength();
            // System.out.println(" \*\*\*\* the length of the content is " + length + " for URL " + URLString);

            System.out.println(" \*\*\*\* Server type is:  " + conn.getHeaderField("Server";) + "\\n\\n";);

            // get more information
            Map map = conn.getHeaderFields();
            for (int i = 0; i < map.size(); i++) {
                System.out.println(" \*\*\*\* " + conn.getHeaderField(i));
            }

            // cleanup
            conn.disconnect();
        } catch (MalformedURLException ex) {
            Logger.getLogger(SnoopURL.class.getName()).log(Level.SEVERE, null, ex);
        } catch (java.io.IOException ioe) {
            ioe.printStackTrace();
        } finally {
            // do whatever cleanup ...
        }
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
    }

    @Override
    public String toString() {
        return super.toString();
    }
}

The output of this program is something like this:

\*\*\*\* Server type is: Sun-Java-System-Web-Server/6.1

\*\*\*\* HTTP/1.1 200 OK
\*\*\*\* Sun-Java-System-Web-Server/6.1
\*\*\*\* Mon, 18 Feb 2008 04:46:48 GMT
\*\*\*\* text/html;charset=UTF-8
\*\*\*\* policyref="http://www.sun.com/p3p/Sun_P3P_Policy.xml", CP="CAO DSP COR CUR ADMa DEVa TAIa PSAa PSDa CONi TELi OUR SAMi PUBi IND PHY ONL PUR COM NAV INT DEM CNT STA POL PRE GOV"
\*\*\*\* Servlet/2.4,JSP/2.0
\*\*\*\* chunked
\*\*\*\* Starload=star-fep5; Path=/
 

Now let's look at some popular websites.

Sun's www.sun.com is using the old Web Enterprise server, version 6.1 (the same is true for java.sun.com). The site the publishes this blog: blogs.sun.com is powered by Sun-Java-System-Web-Server/7.0 (a newer version of the same web server). Google seems to use their own version: gws. Yahoo does not tell you (returns null). Microsoft eats their own dog food: Microsoft-IIS/7.0. Nice. IBM runs something called: IBM_HTTP_Server (I bet is Apache's web server).



 

About

octav

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today