commit | author | age
|
0c8d27
|
1 |
/* |
U |
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package de.uhilger.avdirektor.handler; |
|
7 |
|
|
8 |
import com.sun.net.httpserver.HttpExchange; |
b5cc80
|
9 |
import java.io.IOException; |
U |
10 |
import java.io.OutputStream; |
0c8d27
|
11 |
import java.util.logging.Level; |
U |
12 |
import java.util.logging.Logger; |
|
13 |
|
|
14 |
/** |
|
15 |
* |
|
16 |
* @author ulrich |
|
17 |
*/ |
e499f8
|
18 |
public class PingHandler extends CmdHandler { |
0c8d27
|
19 |
|
U |
20 |
private static final Logger logger = Logger.getLogger(PingHandler.class.getName()); |
|
21 |
|
e499f8
|
22 |
public PingHandler(String cmd) { |
U |
23 |
super(cmd); |
|
24 |
} |
|
25 |
|
b5cc80
|
26 |
protected String process(HttpExchange t, String params) { |
U |
27 |
logger.log(Level.FINE, cmd); |
|
28 |
return cmd; |
|
29 |
} |
|
30 |
|
|
31 |
protected void sendResponse(HttpExchange t, String cmd, String antwort) throws IOException { |
|
32 |
t.sendResponseHeaders(200, antwort.length()); |
0c8d27
|
33 |
OutputStream os = t.getResponseBody(); |
b5cc80
|
34 |
os.write(antwort.getBytes()); |
0c8d27
|
35 |
os.close(); |
U |
36 |
} |
|
37 |
|
|
38 |
} |