2016-11-12 42 views
0

我使用Netbeans 8.1。我想轉換一個EJB在寧靜的服務。Netbeans 8.1如何在平安的服務中暴露ejb

我EJB是

/* 
* To change this license header, choose License Headers in Project Properties. 
* To change this template file, choose Tools | Templates 
* and open the template in the editor. 
*/ 
package paqueteservicio; 

import javax.ejb.Stateless; 
import javax.ws.rs.GET; 
import javax.ws.rs.Path; 
import javax.ws.rs.QueryParam; 

/** 
* 
* @author Carlota 
*/ 
@Stateless 
@Path("/collatz") 
public class CollatzResource { 
    @GET 
    public String collatz(@QueryParam("base")long base){ 
     int num = (int)base; 
     String secuencia = "Inicio"+num+"\n"; 
     while (num != 1){ 
      if (num %2 == 0){ 
       num = num/2; 
      } 
      else { 
       num = num * 3 + 1; 
      } 
      secuencia += num + "\n"; 
     } 
     return secuencia; 
    } 

} 

我如何轉換這個EJB的RESTful服務?有什麼選擇嗎?

回答

0

你所要做的唯一事情是在你的應用程序使休息:

@ApplicationPath("/rest") 
public class JaxRsActivator extends Application { 
    /* class body intentionally left blank */ 
}