Workshop Lab 1 - Going public - Online

From Juneday education
Jump to: navigation, search

Plan for the workshop


What we aim to do during this workshop is to set up a network in the class room and have you connect to that WIFI-network. Being on the same network, means that you can access each other's computers if they are running e.g. a web server etc.

This allows us to start a web api with the Systembolaget products on one computer, and from another computer connect to it and request the JSON with products.

So far, you have only run the servlet on your own computer and used your own computer to connect to it. We appreciate that this is rather confusing and seems weird and pointless. Therefore, we want to show you how a web api typically sits on one computer and is accessed by many clients over a network (typically the WWW and internet).

We hope that this will give you a better understanding of the purpose of the Exposing data over HTTP assignments - and give you a feel of how things work in the real world.

Connect to juneday-X

The teachers will provide the very secret password for the juneday-X wlan. It is important that you are connected to the same network for reasons we'll discuss during the workshop. If you are on different networks (on different wlan-routers), you will not be able to contact each other's computers.

Sit down in your groups.

One from each group connects to juneday-1 (if your groupnumber is an odd number) or juneday-2 (if your group number is an even number).

If you can't get in, try with juneday-3 (only after trying for some time).

Next, one more group member connects, but not to the same network.


Group 1 (odd number): Member a1 connects to juneday-1.

Group 2 (even number): Member b1 connects to juneday-2


Next, Group 1, Member a2 connects to juneday-2. Group 2, Member b2 connects to juneday-1.

Finding out your IP number

First we'll discuss what an IP number is, and some special IP numbers. Next, we'll ask you to figure out what IP number you got from juneday-1.

We'll leave this as an exercise for the students (using google or whatever). If they can't figure it out, we'll give them some hints.

Some special IP numbers:

Private networks (not on the internet):

  • - (16 777 216 addresses)
  • - (1 048 576 addresses)
  • - (65 536 addresses)


  • (localhost)


  • x.x.x.255 (local net broadcast)

Network address:

  • x.x.x.0 (with netmask

There's also a list of assigned IP numbers. See wikipedia for the list.

Start your web apis (run winstone, which will run the servlet) on your computer

Now, when we know each other's IP numbers, we can request some products from one another, by pointing our browsers to a friend's IP number.

Let's make the Servlet a little more interesting

As the first statements of your doGet() method in the servlet, add the following:

    System.out.println("Got query from: " +
                       request.getRemoteAddr() +
                       "/" + request.getRemoteHost() +
                       " using " +

We'll discuss what this means during the workshop.

Connect again and watch your serlvet output

Now you can see who is connecting to the Servlet. Can you figure out how to also print the query string?

Spoofing the user-agent

We'll show you how easy it is to pretend to be using a special browser by spoofing the User-Agent header, using telnet.


  • 09:15 - 09:30 - Introduction and discussion - the teachers show graphically what the network looks like
  • 09:30 - 10:00 - Connect to the new wireless network, make sure it works
  • 10:15 - 11:00 - What is an IP number? How do you figure out your IP number?
  • 11:15 - 12:00 - Setting up your web apis, connecting to one and other
  • 12:00 - 13:15 - LUNCH
  • 13:15 - 15:00 - Some more network experiments, discussion and summary