Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Jakarta RESTful Web Services

From Wikipedia, the free encyclopedia
(Redirected fromJava API for RESTful Web Services)
Jakarta EE specification
Jakarta RESTful Web Services (JAX-RS)
Original author(s)Sun Microsystems
Developer(s)Eclipse Foundation
Stable release
3.1.9 / October 17, 2024; 8 months ago (2024-10-17)
Repository
Written inJava
Operating systemCross-platform
PlatformJava
TypeApplication framework
LicenseEPL 2.0 orGPL v2 w/Classpath exception
Websiteprojects.eclipse.org/projects/ee4j.jaxrsEdit this at Wikidata

Jakarta RESTful Web Services, (JAX-RS; formerlyJava API for RESTful Web Services) is aJakarta EEAPI specification that provides support in creatingweb services according to theRepresentational State Transfer (REST) architectural pattern.[1] JAX-RS usesannotations, introduced inJava SE 5, to simplify the development and deployment of web service clients and endpoints.

From version 1.1 on, JAX-RS is an official part ofJava EE 6. A notable feature of being an official part of Java EE is that no configuration is necessary to start using JAX-RS. For non-Java EE 6 environments a small entry in theweb.xmldeployment descriptor is required.

Specification

[edit]

JAX-RS provides some annotations to aid in mapping a resource class (aPOJO) as a web resource. The annotations use theJava packagejakarta.ws.rs (previously wasjavax.ws.rs but was renamed on May 19, 2019[2]). They include:

  • @Path specifies the relativepath for a resource class or method.
  • @GET,@POST,@PUT,@PATCH (since JAX-RS 2.1),@DELETE,@HEAD and@OPTIONS (since JAX-RS 1.1) specify theHTTP request type of a resource.
  • @Produces specifies the responseInternet media types (used forcontent negotiation).
  • @Consumes specifies the accepted request Internet media types.

In addition, it provides further annotations tomethod parameters to pull information out of the request. All the@*Param annotations take a key of some form which is used to look up the value required.

  • @PathParam binds the method parameter to a path segment.
  • @QueryParam binds the method parameter to the value of an HTTPquery parameter.
  • @MatrixParam binds the method parameter to the value of anHTTP matrix parameter.
  • @HeaderParam binds the method parameter to anHTTP header value.
  • @CookieParam binds the method parameter to acookie value.
  • @FormParam binds the method parameter to aform value.
  • @DefaultValue specifies adefault value for the above bindings when the key is not found.
  • @Context returns the entire context of the object (for example@Context HttpServletRequest request).

JAX-RS 2.0

[edit]

In January 2011 the JCP formed the JSR 339 expert group to work on JAX-RS 2.0. The main targets are (among others) a common client API and support for Hypermedia following theHATEOAS-principle ofREST. In May 2013, it reached the Final Release stage.[3]

On 2017-08-22 JAX-RS 2.1[4] specification final release was published.Main new supported features includeserver-sent events,reactive clients,and JSON-B.[5]

Implementations

[edit]

Implementations of JAX-RS include:[6]

References

[edit]
  1. ^Hadley, p. 1.
  2. ^"Rename package commit on Github".GitHub.
  3. ^"JSR 339: JAX-RS 2.0: The Java API for RESTful Web Services".Java Community Process.
  4. ^"JSR 370: Java API for RESTful Web Services (JAX-RS 2.1) Specification".Java Community Process.
  5. ^"JSR 367: Java API for JSON Binding (JSON-B)".Java Community Process.
  6. ^Little, Mark (October 1, 2008)."A Comparison of JAX-RS Implementations".

External links

[edit]

Tutorials

[edit]
Jakarta EE specifications
formerly known as: Java Platform, Enterprise Edition (Java EE) and Java 2 Platform, Enterprise Edition (J2EE)
Web app
Enterprise app
Web services
Other
Removed
Related
Retrieved from "https://en.wikipedia.org/w/index.php?title=Jakarta_RESTful_Web_Services&oldid=1284300368"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp