0

I created a webservice successfully tested on glassfish within netbeans , which uses POST and give back results as follows:

@Path("caas")
public class Cribservice {
    @Context
    private UriInfo context;
    public Cribservice() {
        TimeZone theTz = TimeZone.getTimeZone("UTC");
     }
    @POST
    @Path("/post")
    @Consumes(MediaType.TEXT_PLAIN) 
    public void setJson(String p) {
        String x = p;
        System.out.println(x);
        run(x);
    }
    @POST
    @Path("/postid")
    @Consumes(MediaType.TEXT_PLAIN)
    @Produces(MediaType.TEXT_PLAIN)
    public String halloween(String p){
        int sizy;
     return some string;
    }
}

I dont have any web.xml but using ApplicationConfig.java

@javax.ws.rs.ApplicationPath("webresources")
public class ApplicationConfig extends Application {

    public Set<Class<?>> getClasses() {
        return getRestResourceClasses();
    }

    /**
     * Do not modify this method. It is automatically generated by NetBeans REST support.
     */
    private Set<Class<?>> getRestResourceClasses() {
        Set<Class<?>> resources = new java.util.HashSet<Class<?>>();
        resources.add(cribservice.Cribservice.class);
        return resources;
    }

}

I tried to deploy this app on jetty on localmachine out of netbeans , but i am not able to access my services , all i am able to see is helloworld on local browser when i access localhost:8080/caas

4

1 に答える 1

0

したがって、プロジェクトを netbeans の突堤にデプロイする前に。まず、関連するすべての jetty-web.xml およびその他の必要なファイルがあることを確認します。

これらのファイルを生成するには、netbeans 用の jetty プラグインをインストールし、jetty サーバーをインターネットからダウンロードします。 新しいプロジェクトを作成し、jetty をサーバーとして選択し、jetty の場所を指定します。次に、プロジェクトを作成し、テストして、生成された .war を /webapps フォルダーに貼り付けた後にデプロイします。

于 2012-10-31T10:52:18.663 に答える