具有json/xml响应的嵌入式码头 [英] Embedded jetty with json/xml response

查看:125
本文介绍了具有json/xml响应的嵌入式码头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有嵌入式码头服务器,我想创建RESTful GET服务,该服务以XML/JSON格式返回pojo作为响应.谁能给我一个基本的例子,说明如何为码头编写处理程序?给出的示例仅显示文本类型的输出.

I have embedded jetty server I want to create RESTful GET service which returns a pojo in XML/JSON format as response. can anyone give me one basic example how to write the handler for jetty? the example given only shows text type output.

推荐答案

我建议您使用Jersey java REST框架(http://jersey.java.net/).该框架很容易学习.您可以使用JAXB之类的Object to Xml转换器来简化您的生活.

I suggest you use Jersey java REST framework (http://jersey.java.net/). The framework is easy to learn. You can use Object to Xml converter like JAXB to make your life easier.

这篇关于具有json/xml响应的嵌入式码头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆