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; |
|
9 |
import java.util.logging.Level; |
|
10 |
import java.util.logging.Logger; |
|
11 |
|
|
12 |
/** |
|
13 |
* |
|
14 |
* @author ulrich |
|
15 |
*/ |
e499f8
|
16 |
public class PingHandler extends CmdHandler { |
0c8d27
|
17 |
|
U |
18 |
private static final Logger logger = Logger.getLogger(PingHandler.class.getName()); |
|
19 |
|
e499f8
|
20 |
public PingHandler(String cmd) { |
U |
21 |
super(cmd); |
|
22 |
} |
|
23 |
|
|
24 |
/* |
0c8d27
|
25 |
@Override |
U |
26 |
public void handle(HttpExchange t) throws IOException { |
|
27 |
logger.log(Level.FINE, "RequestURI: {0}", t.getRequestURI().toString()); |
|
28 |
|
cc2a32
|
29 |
String response = "ping"; |
0c8d27
|
30 |
t.sendResponseHeaders(200, response.length()); |
U |
31 |
OutputStream os = t.getResponseBody(); |
|
32 |
os.write(response.getBytes()); |
|
33 |
os.close(); |
|
34 |
} |
e499f8
|
35 |
*/ |
U |
36 |
|
|
37 |
protected String process(HttpExchange t, String params) { |
|
38 |
String antwort = cmd; |
|
39 |
logger.log(Level.FINE, antwort); |
|
40 |
return antwort; |
|
41 |
} |
0c8d27
|
42 |
|
U |
43 |
} |