用思想、知识和音乐去影响和改变

restful-xml

@Path("student")
public class StudentXMLService {


// <student>
// <name>xiewenbo</name>
// <number>13061012</number>
// </student>
@GET
@Produces(MediaType.APPLICATION_XML)
public Student getStudentXML(){

Student student = new Student("xiewenbo","13061012");
return student;
}

}

public class StudentTest {


public static void main(String[] args) throws IOException {
        URI ServerURI=UriBuilder.fromUri("http://localhost/").port(9998).build();
    startServer(ServerURI);
        System.out.println("服务已启动,请访问:"+ServerURI);
    }    

    protected static SelectorThread startServer(URI serverURI) throws IOException {
        final Map<String, String> initParams = new HashMap<String, String>();
        initParams.put("com.sun.jersey.config.property.packages","com.ws.service.xml");
        System.out.println("Grizzly 启动中...");
        SelectorThread threadSelector = GrizzlyWebContainerFactory.create(serverURI, initParams);     
        return threadSelector;
    }  


}


阅读更多
文章标签: string class path xml
上一篇restful 的线程安全问题
下一篇mysql cast vonvert
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭