commit | author | age
|
63b711
|
1 |
package de.uhilger.avdirektor.handler; |
U |
2 |
|
|
3 |
import com.sun.net.httpserver.HttpExchange; |
|
4 |
import com.sun.net.httpserver.HttpHandler; |
|
5 |
import java.io.IOException; |
|
6 |
import java.io.OutputStream; |
|
7 |
import java.util.Map; |
|
8 |
import java.util.logging.Level; |
|
9 |
import java.util.logging.Logger; |
|
10 |
|
|
11 |
/** |
|
12 |
* |
|
13 |
* @author ulrich |
|
14 |
*/ |
|
15 |
public class SeekHandler extends PlayHandler { |
|
16 |
|
|
17 |
private static final Logger logger = Logger.getLogger(SeekHandler.class.getName()); |
|
18 |
|
|
19 |
public SeekHandler(String cmd) { |
|
20 |
super(cmd); |
|
21 |
} |
|
22 |
|
852f20
|
23 |
/* |
63b711
|
24 |
@Override |
U |
25 |
public void handle(HttpExchange t) throws IOException { |
|
26 |
logger.log(Level.FINE, "RequestURI: {0}", t.getRequestURI().toString()); |
|
27 |
|
|
28 |
StringBuilder params = super.buildParams(t); |
|
29 |
params.append(" --pos "); |
|
30 |
params.append(getParam(map, "p")); |
|
31 |
|
|
32 |
String antwort = abspielenMitParameternUndRueckmeldung( |
|
33 |
getParam(map, "titel"), params.toString(), getParam(map, "r"), "1"); |
|
34 |
|
|
35 |
String response = getResponseString(map, "play", antwort); |
|
36 |
t.sendResponseHeaders(200, response.length()); |
|
37 |
OutputStream os = t.getResponseBody(); |
|
38 |
os.write(response.getBytes()); |
|
39 |
os.close(); |
|
40 |
} |
852f20
|
41 |
*/ |
63b711
|
42 |
|
U |
43 |
@Override |
|
44 |
protected String process(HttpExchange t, String params) { |
|
45 |
String antwort = abspielenMitParameternUndRueckmeldung( |
|
46 |
getParam(map, "titel"), params, getParam(map, "r"), "1"); |
|
47 |
logger.log(Level.FINE, antwort); |
|
48 |
return antwort; |
|
49 |
} |
|
50 |
|
|
51 |
protected StringBuilder buildParams(HttpExchange t) { |
|
52 |
StringBuilder params = super.buildParams(t); |
|
53 |
params.append(" --pos "); |
852f20
|
54 |
params.append(getParam(map, "pos")); |
63b711
|
55 |
return params; |
U |
56 |
} |
|
57 |
|
|
58 |
} |