@GET
@Produces("application/xml")
public StreamingOutput getCustomers(final @QueryParam("start") int start,
final @QueryParam("size") @DefaultValue("2") int size)
{
return new StreamingOutput()
{
public void write(OutputStream outputStream) throws IOException, WebApplicationException
{
PrintStream writer = new PrintStream(outputStream);
writer.println("<customers>");
synchronized (customerDB)
{
int i = 0;
for (Customer customer : customerDB.values())
{
if (i >= start && i < start + size) outputCustomer(" ", writer, customer);
i++;
}
}
writer.println("</customers>");
}
};
}
CustomerResource.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:resteasy-examples
作者:
评论列表
文章目录