|
1 | 1 | package org.web1; |
2 | 2 |
|
3 | 3 | import com.fastcgi.*; |
| 4 | + |
4 | 5 | import java.util.HashMap; |
5 | 6 | import java.util.function.Function; |
6 | 7 |
|
|
9 | 10 | import org.web1.DTOs.RequestDTO; |
10 | 11 | import org.web1.checkers.Checker; |
11 | 12 | import org.web1.checkers.CheckerFunction; |
12 | | -import org.web1.netUtils.JsonBuilder; |
13 | | -import org.web1.netUtils.QueryStringToHashmap; |
14 | | -import org.web1.netUtils.ResponseFactory; |
15 | | -import org.web1.timer.Timer; |
| 13 | +import org.web1.utils.mappers.JsonBuilder; |
| 14 | +import org.web1.utils.mappers.QueryStringToHashmap; |
| 15 | +import org.web1.utils.responce.ResponseFactory; |
| 16 | +import org.web1.utils.responce.ResponseStatus; |
| 17 | +import org.web1.utils.timer.Timer; |
16 | 18 |
|
17 | 19 | public class Main { |
18 | 20 | private static final Function<String, HashMap<String,String>> parseQuery = new QueryStringToHashmap(); |
@@ -46,13 +48,16 @@ public static void main(String[] args) { |
46 | 48 | String result = ResponseFactory.create( |
47 | 49 | new JsonBuilder() |
48 | 50 | .add("result", checkResult) |
49 | | - .add("elapsedTimeNs", timer.stop()) |
| 51 | + .add("elapsedTimeNs", timer.stop()), |
| 52 | + ResponseStatus.OK |
50 | 53 | ); |
51 | 54 |
|
52 | 55 | System.out.println(result); |
53 | 56 | } catch (ValidationException e) { |
54 | 57 | String result = ResponseFactory.create( |
55 | | - new JsonBuilder().add("error", '"'+e.getMessage()+'"') |
| 58 | + new JsonBuilder() |
| 59 | + .add("error", '"'+e.getMessage()+'"'), |
| 60 | + ResponseStatus.BAD_REQUEST |
56 | 61 | ); |
57 | 62 | System.out.println(result); |
58 | 63 | } |
|
0 commit comments