public void run() {
		BufferedReader inp = null;

		System.out.println("Doing Service with " + s.getInetAddress());
		try {
			char[] buffer = new char[1024];
			int length = 0;
			String request = new String();
			String pageRequested = new String();
			String data = new String();

			//reading message received
			inp = new BufferedReader(new InputStreamReader(s.getInputStream()));
			length = inp.read(buffer);
			request = new String(buffer);

			System.out.println("Received packet : ");
			System.out.println("---------------------------------");
			System.out.println(request);
			System.out.println("---------------------------------");

			pageRequested = pageRequested(request);
			data = dataReceived(request);

			if (request.startsWith("GET ")){ 
				// if it wasn't an element needed for the page creation
				// then it must be an element needed for the chat
				if (!sendElementForPageCreation(pageRequested)) {
					sendElementForJavaScriptChat(pageRequested);
				}
			}
			else if (request.startsWith("POST ")){
				if (pageRequested.startsWith("/chat.java?")) {
					String functionRequested = pageRequested.substring("/chat.java?".length());
					// if request.substring = sendLine
					if (functionRequested.startsWith("sendLine")) {
						ChatLine line = getChatLineFromJavaScriptChat(data);
						if (line != null) {
							//Add the line to the chat
							chat.addLine(line);
						}
					}
					else if (functionRequested.startsWith("sendParticipant")) { 
						// if request.substring = sendParticipant
						Participant participant = getParticipantFromJavaScriptChat(data);
						if (participant != null) {
							//Add the participant to the chat participants
							System.out.println(participant.toString());
						}
					}
				}
			}

			inp.close();
			s.close();
		} 
				catch (IOException e) {
			System.err.println("---------------------------------");
			System.err.println("Error in run : ");
			e.printStackTrace();
			System.err.println("---------------------------------");
		}
	}