File tree 1 file changed +14
-14
lines changed
java-serverhost/src/main/java/com/redhat/training/example/javaserverhost/rest
1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change 1
1
package com .redhat .training .example .javaserverhost .rest ;
2
2
3
-
4
3
import javax .ws .rs .Path ;
5
4
import javax .ws .rs .core .Response ;
6
5
import javax .ws .rs .GET ;
7
6
import javax .ws .rs .Produces ;
8
7
import java .net .InetAddress ;
9
8
10
-
11
9
@ Path ("/" )
12
10
public class ServerHostEndPoint {
13
11
14
- @ GET
15
- @ Produces ("text/plain" )
16
- public Response doGet () {
17
- String host = "" ;
18
- try {
19
- host = InetAddress .getLocalHost ().getHostName ();
20
- }
21
- catch (Exception e ) {
22
- e .printStackTrace ();
23
- }
24
- return Response .ok ("I am running on server " +host +" Version 1.0 \n " ).build ();
25
- }
12
+ @ GET
13
+ @ Produces ("text/plain" )
14
+ public Response doGet () {
15
+ String host = "" ;
16
+ try {
17
+ host = InetAddress .getLocalHost ().getHostName ();
18
+ }
19
+ catch (Exception e ) {
20
+ e .printStackTrace ();
21
+ }
22
+ String msg = "I am running on server " +host +" Version 1.0 \n "
23
+ return Response .ok (msg ).build ();
24
+ }
26
25
}
26
+
You can’t perform that action at this time.
0 commit comments