mirror of
https://github.com/devsnaith/lumiere-server.git
synced 2024-11-23 17:13:14 +03:00
add missing stuff
This commit is contained in:
parent
c3f63ff55b
commit
4f14721b47
@ -48,7 +48,7 @@ If you want to make a dynamic response, use ``HttpRequestHandler``
|
|||||||
#### Example using ``HttpRequestHandler`` interface
|
#### Example using ``HttpRequestHandler`` interface
|
||||||
```java
|
```java
|
||||||
/* new HttpRequestHandler */
|
/* new HttpRequestHandler */
|
||||||
new Lumiere((HttpRequest request, HttpResponse response) -> {
|
new Lumiere((Socket socket, HttpRequest request, HttpResponse response) -> {
|
||||||
response.setContentType("text/html");
|
response.setContentType("text/html");
|
||||||
response.push("<b>"+request.getProperty("User-Agent")+"</b>");
|
response.push("<b>"+request.getProperty("User-Agent")+"</b>");
|
||||||
}).bootServer(8080);
|
}).bootServer(8080);
|
||||||
@ -61,7 +61,7 @@ You can create multiple pages for your simple server using ``HttpController``
|
|||||||
HttpController controller = new HttpController();
|
HttpController controller = new HttpController();
|
||||||
controller.addHandler("/", new SimpleResponse("<a href=\"/info\">GO TO INFO</a>", true));
|
controller.addHandler("/", new SimpleResponse("<a href=\"/info\">GO TO INFO</a>", true));
|
||||||
controller.addHandler("/info", new SimpleResponse("Meow", false));
|
controller.addHandler("/info", new SimpleResponse("Meow", false));
|
||||||
controller.addHandler("/agent", (HttpRequest request, HttpResponse response) -> {
|
controller.addHandler("/agent", (Socket socket, HttpRequest request, HttpResponse response) -> {
|
||||||
response.setContentType("text/html");
|
response.setContentType("text/html");
|
||||||
response.push("<b>"+request.getProperty("User-Agent")+"</b>");
|
response.push("<b>"+request.getProperty("User-Agent")+"</b>");
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user