Update README.md

This commit is contained in:
강남스타일 2023-04-19 21:30:58 +03:00 committed by GitHub
parent 4f14721b47
commit eeccd7951b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,9 +28,9 @@ lumiere-server at github https://github.com/DevSnaith/lumiere-server
Now copy the ``lumiere-server.jar`` and add it to your project. Now copy the ``lumiere-server.jar`` and add it to your project.
## Usage/Examples ## Usage/Examples
`Lumiere` class contains the basic things that must be available for the server to work well, it manages the traffic of requests and forwards them to the `HttpRequestHandler` interface. It also adds some properties in the header. `Lumiere` class contains the basic things that must be available for the server to work well, it manages the traffic of requests and forwards them to the `RequestHandler` interface. It also adds some properties in the header.
You need to pass a `HttpRequestHandler` to `Lumiere`, The easiest way to do that is to use the `SimpleResponse` class that implements the `HttpRequestHandler` interface. You need to pass a `RequestHandler` to `Lumiere`, The easiest way to do that is to use the `SimpleResponse` class that implements the `RequestHandler` interface.
#### Example using ``SimpleResponse`` class #### Example using ``SimpleResponse`` class
```java ```java
@ -44,10 +44,10 @@ Lumiere server = new Lumiere(requestHandler);
server.bootServer(server_port); // start the server server.bootServer(server_port); // start the server
``` ```
If you want to make a dynamic response, use ``HttpRequestHandler`` If you want to make a dynamic response, use ``RequestHandler``
#### Example using ``HttpRequestHandler`` interface #### Example using ``RequestHandler`` interface
```java ```java
/* new HttpRequestHandler */ /* new RequestHandler */
new Lumiere((Socket socket, 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>");