简体   繁体   English

如何在Glassfish管理控制台中获取有关已部署的REST服务的所有信息?

[英]How get all infomation about deployed REST services in Glassfish admin console?

If I annotate some class with @WebService compile and deploy it into glassfish. 如果我使用@WebService注释某个类,则将其编译并将其部署到glassfish中。 I can go to admin console find my class click to "View Endpoint" link and get all necessary information about service. 我可以转到管理控制台,找到我的课程,然后单击“查看端点”链接,并获取有关服务的所有必要信息。 How I can do that with Jersey? 我怎么能用泽西岛做到这一点? I have class with @Path annotation, and methods with @Produces , @Post , @Get etc. annotations. 我有类@Path注释,并与方法@Produces@Post@Get等注释。 Where I can find information about all these methods in glassfish? 在哪里可以找到有关玻璃鱼中所有这些方法的信息? Where find a link with generated wadl file? 在哪里找到生成的wadl文件的链接?

If you have a simple project, eg, the WADLTest and you have two simple classes: 如果您有一个简单的项目,例如WADLTest ,则有两个简单的类:

package net.paulvargas.test;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("resources")
public class RESTConfig extends Application {

}

And: 和:

package net.paulvargas.test;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("test")
public class Test {

    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String message() {
        return "Hello world!";
    }

}

You can find the WADL file in: 您可以在以下位置找到WADL文件:

http://localhost:8080/WADLTest/resources/application.wadl

ie: 即:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<application xmlns="http://wadl.dev.java.net/2009/02">
    <doc xmlns:jersey="http://jersey.java.net/" jersey:generatedBy="Jersey: 1.11.1 03/31/2012 06:49 PM"/>
    <grammars/>
    <resources base="http://localhost:8080/WADLTest/resources/">
        <resource path="test">
            <method id="message" name="GET">
                <response>
                    <representation mediaType="text/plain"/>
                </response>
            </method>
        </resource>
    </resources>
</application>

Note: for this example, does not require any extra configuration file, even not the web.xml . 注意:对于此示例,不需要任何额外的配置文件,甚至不需要web.xml Well, that if you use Java EE 6 or Java EE 7. I'm using GlassFish Server Open Source Edition 3.1.2.2 (build 5) and Java build 1.7.0_25-b16 好吧,如果您使用的是Java EE 6或Java EE 7,则使用的是GlassFish Server开源版3.1.2.2(内部版本5)和Java内部版本1.7.0_25-b16

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

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