我有一个方法返回java.net.URL,我无法找到@Produces注释的正确MediaType。有可能产生一个URL MediaType?Java REST球衣生产URL
我的代码:
@GET
@Produces(MediaType.TEXT_HTML) //MediaType I don´t know
@Path("terms.html")
public URL getTerms(){
Iterator<String> it=definitions.keySet().iterator();
URL url,url1=null;
try {
url = new URL("http://localhost:8080/Dictionary/definitions/");
url1 = new URL(url,it.next()+".html");
} catch (MalformedURLException e) {
e.printStackTrace();
}
return url1;
}
我想在我的休息服务是类似的东西: