How to add rest resource to process app

hello

i’m new to Java EE so my question might be dummy but i’ll be thankful to any one answer it.

what i want to do in Sammy is “annual leave management app”

this is my requirment

  1. i need a process application to manage the process ( i learned how to create Java EE8 web app)
  2. i need to store the approved request in custom table ( done using EJB )
  3. i need a custom form to inter the data ( done using HTML forms SDK )
  4. i need a secured rest endpoint to show the employee his balance at start form ( i don’t know how to do it)

that’s what i did as a test
but it does not work!

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
<jboss-web>
  <security-domain>other</security-domain>
  <context-root>/full-app</context-root>
</jboss-web>
import javax.inject.Inject;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

@Path("/api")
public class HelloWorldResource {
	
    @Inject
    HelloService helloService;

	@POST
	@Path("/json/{name}")
	@Produces("application/json")
	public String getHelloWorldJSON(@PathParam("name") String name) {
		System.out.println("name: " + name);
		return "{\"result\":\"" + helloService.createHelloMessage(name) + "\"}";
	}

}
1 Like