Add own REST server to archetype-servlet

Hi,

I am new to Camunda and I am running some case studies.

I am using IntelliJ IDEA and created a maven application from the archetype “camunda-archetype-servlet-war:7.9.0”.

I tried the tutorial (https://www.youtube.com/watch?v=HxtZf5VD6lQ) and it works fine. Now I want to add my own REST api to this project in order to make database requests for an external GUI.

Now I have the following questions:

  • Which REST library should I use? JAX-RS or Spring?
  • Is it better to extend my “tutorial” application or is it better to write a seperate REST-API tomcat application and add the Camunda functions?

Right now I tried to extend the tutorial application with Spring.

I added the following dependency to my pom.xml file:

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>4.3.25.RELEASE</version>
        </dependency>

I created a new package to the existing one and added a new class.

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/data")
@CrossOrigin

public class RestDbController {
    @RequestMapping(method = RequestMethod.GET, path="/users", produces = "application/json")
    public String getUsers () {
        return "{\"text\": \"Hallo\" }";
    }

}

The name of the war file is mysample.war. So I tried to access the REST api using the following URL: http://localhost:8080/mysample/data/users
But all I got is a HTTP state 404.

Any hints how I should proceed?

Best regards,

Rainer