Java REST jersey produces URL -
i have method return java.net.url , can´t find right mediatype @produces annotation. possible produce url mediatype?
my code:
@get @produces(mediatype.text_html) //mediatype 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; }
what want in rest service that:
as far know, there's no content type urls.
you can assume url returning piece of plain text , use mediatype.text_plain
:
@get @path("terms.html") @produces(mediatype.text_plain) public url getterms() { ... }
if need, can return html document (using mediatype.text_html
) containing <a>
element, referencing url want return.
Comments
Post a Comment