mirror of
https://github.com/devsnaith/lumiere-server.git
synced 2024-11-23 17:13:14 +03:00
implements RequestHandler
This commit is contained in:
parent
f95cfe9ba4
commit
62b4cbdc57
@ -1,10 +1,12 @@
|
|||||||
package org.eu.lumiere.utils;
|
package org.eu.lumiere.utils;
|
||||||
|
|
||||||
import org.eu.lumiere.net.http.HttpRequest;
|
import java.net.Socket;
|
||||||
import org.eu.lumiere.net.http.HttpRequestHandler;
|
|
||||||
import org.eu.lumiere.net.http.HttpResponse;
|
|
||||||
|
|
||||||
public class SimpleResponse implements HttpRequestHandler {
|
import org.eu.lumiere.net.RequestHandler;
|
||||||
|
import org.eu.lumiere.net.http.HTTPRequest;
|
||||||
|
import org.eu.lumiere.net.http.HTTPResponse;
|
||||||
|
|
||||||
|
public class SimpleResponse implements RequestHandler {
|
||||||
|
|
||||||
private String body = "BasicResponse is running";
|
private String body = "BasicResponse is running";
|
||||||
private boolean html_response = false;
|
private boolean html_response = false;
|
||||||
@ -15,7 +17,7 @@ public class SimpleResponse implements HttpRequestHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestReceived(HttpRequest request, HttpResponse response) {
|
public void onRequestReceived(Socket socket, HTTPRequest request, HTTPResponse response) {
|
||||||
response.setContentType(String.format("text/%s", html_response ? "html" : "plan"));
|
response.setContentType(String.format("text/%s", html_response ? "html" : "plan"));
|
||||||
response.push(body);
|
response.push(body);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user