如何在rest类上运行java类(应用程序)?

如何在rest类上运行java类(应用程序)?,java,rest,Java,Rest,其余课程如下: @Path("generic") public class GenericResource { @Context private UriInfo context; /** * Creates a new instance of GenericResource */ public GenericResource() { } @GET @Produces(MediaType.TEXT_HTML)

其余课程如下:

@Path("generic")
public class GenericResource {

    @Context
    private UriInfo context;

    /**
     * Creates a new instance of GenericResource
     */
    public GenericResource() {
    }
    @GET
    @Produces(MediaType.TEXT_HTML)
    public String getXml() {
        return "App Running";
    }

    @POST
    @Produces(MediaType.TEXT_PLAIN)
    @Consumes(MediaType.TEXT_PLAIN)
    public String postXml(String param) {
        ImagesBean imagesBean = new ImagesBean();
        imagesBean.fillValues(param);
     //TODO call and Run my application RunService.java
     //ParamWrapper.wrapParams(param);
        return "return post " + param;
    }

    /**
     * PUT method for updating or creating an instance of GenericResource
     * @param content representation for the resource
     */
    @PUT
    @Consumes(MediaType.APPLICATION_XML)
    public void putXml(String content) {
    }
}

所以我想在REST类上运行名为RunService.java的java类。我如何实现这一点?java类包含一个服务,用于格式化在我的服务器上找到的图片

在应用服务器内部运行REST类,如Jetty或Tomcat。REST类不应该包含调用java类的方法吗?REST类在Tomcat上运行。如果你想编写一个独立的客户机,你的类将是一个带有main方法的普通java类。您可以使用该类来执行rest端点。将main方法添加到rest java类之后,我可以使用GET reguest调用它吗。如果是这样,怎么做?