RESTful Service use comment

Java RESTful

  • 注解

    • @ApplicationPath
    • @Path // 声明资源路径 @Path("/book") or @Path("/{bookId: [0-9]*}")
      • @PathParam("bookId") <- [PUT POST DELETE]
      • @QueryParam("ip") // query param <- [GET]
    • @Consumes 标识输入实体的类型
      • @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, MediaType.TEXT_XML})
    • @Produces 标识返回实体的类型
      • @Produces(MediaType.TEXT_PLAIN) // 传输格式是字符串类型 text/plain
      • @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    • MediaType

            
                org.glassfish.jersey.media
                jersey-media-moxy
            
      
    • @PUT // http protocol put method
    • @POST // http protocol post method
    • @DELETE // http protocol delete method
    • @GET // http protocol get method
    • Jersey 内部 JAXB 处理 java pojo class 和 xml 格式的信息、json 格式的信息映射:
      • XML
        • @XmlRootElement(name= "book") // root node
        • @XmlElement(name= "book")
        • @XmlAttribute(name= "status") // node attribute
        • @XmlElementWrapper
      • JSON

持续更新...

你可能感兴趣的:(RESTful Service use comment)