宁静的Web服务方法命名

时间:2016-02-09 07:01:41

标签: java web-services rest jersey

我对Web服务比较陌生,似乎无法找到方法命名的明确解释。

的例子

https://docs.oracle.com/cd/E19776-01/820-4867/6nga7f5n6/index.html

package com.sun.jersey.samples.helloworld.resources;

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

// The Java class will be hosted at the URI path "/helloworld"
@Path("/helloworld")
public class HelloWorldResource {

// The Java method will process HTTP GET requests
@GET
// The Java method will produce content identified by the MIME Media
// type "text/plain"
@Produces("text/plain")

    public String getClichedMessage() {
      // Return some cliched textual content
      return "Hello World";
    }
}

此方法:@produces部分中的getClichedMessage(),如何知道要命名的内容,或者无关紧要?我注意到,当我将其改为其他任何东西时,我必须刷新几次然后它才能工作。有时候它会给出空的isses。那有关系吗?

1 个答案:

答案 0 :(得分:0)

请检查以下URl,之前已经询问了类似的问题。

Are there any naming convention guidelines for REST APIs?

另外,您是否为命名约定引用了以下URL?如果尚未访问,你可以试一试.. :)

http://www.restapitutorial.com/lessons/restfulresourcenaming.html

相关问题