KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > spice > netserve > connection > impl > ClosingSocketConnectionHandler


1 /*
2  * Copyright (C) The Spice Group. All rights reserved.
3  *
4  * This software is published under the terms of the Spice
5  * Software License version 1.1, a copy of which has been included
6  * with this distribution in the LICENSE.txt file.
7  */

8 package org.codehaus.spice.netserve.connection.impl;
9
10 import java.io.OutputStream JavaDoc;
11 import java.net.Socket JavaDoc;
12
13 import org.codehaus.spice.netserve.connection.handlers.AbstractRequestHandler;
14
15 /**
16  *
17  * @author Peter Donald
18  * @version $Revision: 1.2 $ $Date: 2004/03/21 23:42:59 $
19  */

20 class ClosingSocketConnectionHandler
21    extends AbstractRequestHandler
22 {
23    static final String JavaDoc MESSAGE = "Bye!";
24
25    protected void doPerformRequest( Socket JavaDoc socket )
26       throws Exception JavaDoc
27    {
28       final OutputStream JavaDoc outputStream = socket.getOutputStream();
29       outputStream.write( MESSAGE.getBytes() );
30       outputStream.flush();
31       outputStream.close();
32    }
33 }
34
Popular Tags