package net.redborder.correlation.rest;


import org.glassfish.grizzly.http.server.HttpServer;
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
import org.glassfish.jersey.server.ResourceConfig;

import java.io.IOException;
import java.net.URI;

/**
 * Created by jmf on 11/06/15.
 */
public class RESTManager {

    // Base URI the Grizzly HTTP server will listen on
    private String BASE_URI = "http://localhost:8080/myapp/";
    private ResourceConfig rc;
    private HttpServer server;


    /*Realizar constructor que establezca la configuracion:
    *       -URI:ip/port/
    *
    * */
    public RESTManager(){
        // create a resource config that scans for JAX-RS resources and providers
        // in com.example package
        rc = new ResourceConfig().packages("net.redborder.correlation.rest");

    }

    /**
     * Starts Grizzly HTTP server exposing JAX-RS resources defined in this application.
     * @return Grizzly HTTP server.
     */
    public void startServer() {
        // create a resource config that scans for JAX-RS resources and providers
        // in com.example package
        //rc = new ResourceConfig().packages("net.redborder.correlation.rest");

        // create and start a new instance of grizzly http server
        // exposing the Jersey application at BASE_URI
        server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc);
    }

    public void stopServer(){

        server.stop();
    }

}

@@ -212,16 +212,73 @@
 eConfig;
+%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;
 %0A%0Aimport
@@ -388,16 +388,92 @@
 ager %7B%0A%0A
+    private final Logger log = LoggerFactory.getLogger(RESTManager.class);%0A%0A
     // B
@@ -1550,16 +1550,153 @@
 I), rc);
+%0A%0A        if(server != null)%0A            log.info(%22Starting server...%22);%0A        else%0A            log.error(%22Server is not initialized%22);
 %0A    %7D%0A%0A
@@ -1725,16 +1725,42 @@
 rver()%7B%0A
+        if(server != null)
 %0A       
@@ -1764,16 +1764,20 @@
     
+    
 server.s
 top(
@@ -1772,19 +1772,23 @@
 server.s
-top
+hutdown
 ();%0A    

Add method to stop http server and RESTManager.java logging