简体   繁体   English

EJB模块和RESTFULL API

[英]EJB module and RESTFULL api

I have EJB module that I want to make RESTFULL api. 我有要制作RESTFULL API的EJB模块。

I do not have any war files. 我没有任何战争档案。 Only EJB.jar file which has been deployed on glassfish server. 仅在glassfish服务器上已部署的EJB.jar文件。

Following is my SessionBean class. 以下是我的SessionBean类。

@Stateless
@LocalBean
public class TestSessionBean {

@GET
@Path("/test")
@Produces(MediaType.APPLICATION_JSON)
public JSONObject getObjects(@QueryParam("city") String city) {
    try {

        JSONObject jSONObject = new JSONObject();

        jSONObject.put(city, "test");

        return jSONObject;
    } catch (JSONException e) {
        e.printStackTrace();
        return null;
    }
}
}

My ejb module name as TestEJB . 我的ejb模块名称为TestEJB I am using JEE6 . 我正在使用JEE6 I tried to get resource from googling. 我试图从谷歌搜索中获取资源。 but did not get any idea. 但没有任何想法。 I went Inject a EJB into JAX-RS (RESTfull service) and so on. 我去了将EJB注入JAX-RS(RESTfull服务)等等。 But could not get any usefull resources. 但是无法获得任何有用的资源。

Note: I heard from one of my friend that it is possible in EJB3 so I tried to do. 注意:我从一位朋友那里听说EJB3是可能的,所以我尝试这样做。

I do not know is it possible or not please kindly guide me. 我不知道有没有可能请指导我。

好吧,规范只说“ JAX-RS应用程序作为Web应用程序打包在.war文件中。”,而在独立的ejb模块中使用它一无所获(至少我找不到)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM