|  |  |  | 
|---|
|  |  |  | package de.uhilger.avdirektor.handler; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.sun.net.httpserver.HttpExchange; | 
|---|
|  |  |  | import java.io.IOException; | 
|---|
|  |  |  | import java.io.OutputStream; | 
|---|
|  |  |  | import java.util.logging.Level; | 
|---|
|  |  |  | import java.util.logging.Logger; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | super(cmd); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void handle(HttpExchange t) throws IOException { | 
|---|
|  |  |  | logger.log(Level.FINE, "RequestURI: {0}", t.getRequestURI().toString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String response = "ping"; | 
|---|
|  |  |  | t.sendResponseHeaders(200, response.length()); | 
|---|
|  |  |  | OutputStream os = t.getResponseBody(); | 
|---|
|  |  |  | os.write(response.getBytes()); | 
|---|
|  |  |  | os.close(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected String process(HttpExchange t, String params) { | 
|---|
|  |  |  | String antwort = cmd; | 
|---|
|  |  |  | logger.log(Level.FINE, antwort); | 
|---|
|  |  |  | return antwort; | 
|---|
|  |  |  | logger.log(Level.FINE, cmd); | 
|---|
|  |  |  | return cmd; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected void sendResponse(HttpExchange t, String cmd, String antwort) throws IOException { | 
|---|
|  |  |  | t.sendResponseHeaders(200, antwort.length()); | 
|---|
|  |  |  | OutputStream os = t.getResponseBody(); | 
|---|
|  |  |  | os.write(antwort.getBytes()); | 
|---|
|  |  |  | os.close(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|