私はジャージーを使用しています。次の方法があります。
@POST
@Path("hello")
@Produces(MediaType.TEXT_HTML)
public String hello(@FormParam("username") String username)
{
Gson gson = new Gson();
CommunicationResponseM result = new CommunicationResponseM();
String result = "hello";
return gson.toJson(result);
}
これまでのところすべてうまくいっていますが、ここでいくつかのヘッダーを追加する必要があります。どうやってやるの?
ありがとう!
PS:
この方法でジャージー サーバーを起動します。
final HttpServer server = HttpServerFactory.create(baseUrl);
server.start();