'How do I convert a basic server code that exposes a few REST endpoints and provides static response into an ear and deploy it in a lightweight server?

I have written an interface and an implementation class - which exposes a few REST endpoints (eg. /mock/abc/user) and returns some static values as json response. How do I bundle these code into an ear/war and deploy them in a lightweight standalone server such as Wildfly.

Interface

@Path("/mock/server")
public interface MockServer{

       @Path("/user")
       @GET
       @Produces({MimeTypes.APPLICATION_JSON})
       Response getUserDetails();
}

Impl Class

public class MockServerImpl implements MockServer{
    @Override
    public Response getUserDetails() {
    ...
    }

I am supposed to deploy it in a separate server and hit these endpoints from my JUnit tests.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source