File tree 6 files changed +56
-1
lines changed
src/main/java/info/unterrainer/commons/httpserver
6 files changed +56
-1
lines changed Original file line number Diff line number Diff line change
1
+ package @package@;
2
+
3
+ public class Information {
4
+ public static final String BuildTime = "@buildTime@";
5
+ public static final String PomVersion = "@pomVersion@";
6
+ }
Original file line number Diff line number Diff line change 5
5
<parent >
6
6
<groupId >info.unterrainer.commons</groupId >
7
7
<artifactId >parent-pom</artifactId >
8
- <version >0.0.20 </version >
8
+ <version >0.0.21 </version >
9
9
</parent >
10
10
11
11
<properties >
12
12
<mainclass >info.unterrainer.commons.httpserver.HttpServer</mainclass >
13
+ <package-path >info/unterrainer/commons/httpserver</package-path >
14
+ <packg-string >info.unterrainer.commons.httpserver</packg-string >
13
15
</properties >
14
16
15
17
<modelVersion >4.0.0</modelVersion >
Original file line number Diff line number Diff line change 17
17
import info .unterrainer .commons .httpserver .exceptions .HttpException ;
18
18
import info .unterrainer .commons .httpserver .exceptions .NotFoundException ;
19
19
import info .unterrainer .commons .httpserver .handlers .AppNameHandler ;
20
+ import info .unterrainer .commons .httpserver .handlers .AppVersionHandler ;
20
21
import info .unterrainer .commons .httpserver .handlers .DateTimeHandler ;
21
22
import info .unterrainer .commons .httpserver .handlers .HealthHandler ;
22
23
import info .unterrainer .commons .httpserver .jsons .MessageJson ;
@@ -108,6 +109,7 @@ private void create() {
108
109
});
109
110
110
111
get ("/" , new AppNameHandler (applicationName ));
112
+ get ("/version" , new AppVersionHandler ());
111
113
get ("/datetime" , new DateTimeHandler ());
112
114
get ("/health" , new HealthHandler ());
113
115
Original file line number Diff line number Diff line change
1
+ package info .unterrainer .commons .httpserver ;
2
+
3
+ public class Information {
4
+ public static final String BuildTime = "2020-07-06T13:16:01Z" ;
5
+ public static final String PomVersion = "0.0.19" ;
6
+ }
Original file line number Diff line number Diff line change
1
+ package info .unterrainer .commons .httpserver .handlers ;
2
+
3
+ import info .unterrainer .commons .httpserver .Information ;
4
+ import info .unterrainer .commons .httpserver .enums .Attribute ;
5
+ import info .unterrainer .commons .httpserver .jsons .AppVersionJson ;
6
+ import io .javalin .http .Context ;
7
+ import io .javalin .http .Handler ;
8
+ import lombok .RequiredArgsConstructor ;
9
+
10
+ @ RequiredArgsConstructor
11
+ public class AppVersionHandler implements Handler {
12
+
13
+ private AppVersionJson message ;
14
+
15
+ @ Override
16
+ public void handle (final Context ctx ) throws Exception {
17
+ if (message == null )
18
+ message = AppVersionJson .builder ()
19
+ .PomVersion (Information .PomVersion )
20
+ .BuildTime (Information .BuildTime )
21
+ .build ();
22
+ ctx .attribute (Attribute .RESPONSE_OBJECT , message );
23
+ ctx .attribute (Attribute .RESPONSE_STATUS , 200 );
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ package info .unterrainer .commons .httpserver .jsons ;
2
+
3
+ import lombok .Data ;
4
+ import lombok .NoArgsConstructor ;
5
+ import lombok .experimental .SuperBuilder ;
6
+
7
+ @ Data
8
+ @ NoArgsConstructor
9
+ @ SuperBuilder (toBuilder = true )
10
+ public class AppVersionJson {
11
+
12
+ private String BuildTime ;
13
+ private String PomVersion ;
14
+ }
You can’t perform that action at this time.
0 commit comments