Skip to content

Commit 4fe36cd

Browse files
committed
MSF4J Hello World
1 parent 10ce3f1 commit 4fe36cd

3 files changed

Lines changed: 107 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.javahelps</groupId>
5+
<artifactId>msf4j-helloworld</artifactId>
6+
<version>0.0.1-SNAPSHOT</version>
7+
8+
<!-- Define Java version and the MSF4J version -->
9+
<properties>
10+
<maven.compiler.source>1.8</maven.compiler.source>
11+
<maven.compiler.target>1.8</maven.compiler.target>
12+
<msf4j.version>2.2.2</msf4j.version>
13+
</properties>
14+
15+
<!-- Use the WSO2's repository -->
16+
<repositories>
17+
<repository>
18+
<id>wso2.releases</id>
19+
<name>WSO2 Internal Repository</name>
20+
<url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
21+
<releases>
22+
<enabled>true</enabled>
23+
<updatePolicy>daily</updatePolicy>
24+
<checksumPolicy>ignore</checksumPolicy>
25+
</releases>
26+
</repository>
27+
</repositories>
28+
29+
<!-- Add the dependency -->
30+
<dependencies>
31+
<dependency>
32+
<groupId>org.wso2.msf4j</groupId>
33+
<artifactId>msf4j-core</artifactId>
34+
<version>${msf4j.version}</version>
35+
</dependency>
36+
</dependencies>
37+
38+
39+
<!-- Optionally deine the main class -->
40+
<build>
41+
<plugins>
42+
<plugin>
43+
<groupId>org.codehaus.mojo</groupId>
44+
<artifactId>exec-maven-plugin</artifactId>
45+
<version>1.6.0</version>
46+
<executions>
47+
<execution>
48+
<goals>
49+
<goal>java</goal>
50+
</goals>
51+
</execution>
52+
</executions>
53+
<configuration>
54+
<mainClass>com.javahelps.service.Application</mainClass>
55+
</configuration>
56+
</plugin>
57+
</plugins>
58+
</build>
59+
</project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.javahelps.service;
2+
3+
import org.wso2.msf4j.MicroservicesRunner;
4+
5+
public class Application {
6+
7+
public static void main(String[] args) {
8+
new MicroservicesRunner()
9+
.deploy(new HelloService())
10+
.start();
11+
}
12+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.javahelps.service;
2+
3+
import javax.ws.rs.DELETE;
4+
import javax.ws.rs.GET;
5+
import javax.ws.rs.POST;
6+
import javax.ws.rs.PUT;
7+
import javax.ws.rs.Path;
8+
9+
@Path("/service")
10+
public class HelloService {
11+
12+
@GET
13+
@Path("/")
14+
public String get() {
15+
System.out.println("GET invoked");
16+
return "Hello from WSO2 MSF4J";
17+
}
18+
19+
@POST
20+
@Path("/")
21+
public void post() {
22+
System.out.println("POST invoked");
23+
}
24+
25+
@PUT
26+
@Path("/")
27+
public void put() {
28+
System.out.println("PUT invoked");
29+
}
30+
31+
@DELETE
32+
@Path("/")
33+
public void delete() {
34+
System.out.println("DELETE invoked");
35+
}
36+
}

0 commit comments

Comments
 (0)