Generated by GPT-5-mini| JAX-RS | |
|---|---|
| Name | JAX-RS |
| Developer | Oracle Corporation |
| Released | 2007 |
| Programming language | Java |
| Platform | Java Platform, Standard Edition |
| License | Eclipse Public License |
JAX-RS JAX-RS is a Java API specification for building RESTful web services on the Java platform. It defines annotations and programming models that integrate with Java SE and Java EE (Jakarta EE), enabling developers to create HTTP-based services using resource classes and providers. The specification is governed by expert groups from Oracle and the Eclipse Foundation and is implemented by multiple vendors and open-source projects.
JAX-RS specifies annotations such as javax.ws.rs.Path, javax.ws.rs.GET, and javax.ws.rs.POST that map Java classes and methods to HTTP resources, and integrates with Java technologies like Java SE, Jakarta EE, Enterprise JavaBeans, Servlet API, and Java Persistence API. It complements standards including SOAP, WSDL, and JAXB for XML binding while aligning with HTTP semantics from Hypertext Transfer Protocol and media typing from Internet Media Type. The API design reflects principles from REST as articulated by Roy Fielding and practical patterns used in frameworks like Spring Framework, Apache Struts, and Google Guice.
The JAX-RS specification emerged from initiatives within Sun Microsystems and later development under Oracle Corporation and the Eclipse Foundation during the evolution of Java web specifications. Early proposals referenced work on RESTful architecture, influence from projects such as Apache CXF, Jersey, and RESTEasy, and coordination with standards bodies like the Java Community Process and the JSR process. Over successive versions, the spec integrated improvements inspired by implementations from IBM, Red Hat, Oracle, Payara, and community projects including GlassFish, WildFly, and TomEE.
At its core, the API models resources as Java classes annotated with path and HTTP method designators, and supports parameter injection from URI path segments, query parameters, headers, cookies, and request bodies. Key concepts include resource locators, entity providers, message body readers and writers, and exception mapping, which interact with Java technologies such as JSON-B, Jackson, GSON, and JAXB for content negotiation. The API specifies media type negotiation with constants from Internet Assigned Numbers Authority conventions and integrates lifecycle management consistent with Context and Dependency Injection and Contexts and Dependency Injection for Java.
JAX-RS provides features like filtering and intercepting via ContainerRequestFilter and ContainerResponseFilter, asynchronous processing via CompletionStage and Reactive Streams patterns, and support for WebSockets and Server-Sent Events influenced by standards from WHATWG and IETF. Extensions and community projects add facilities for API documentation (inspired by OpenAPI Initiative and Swagger), metrics integration using MicroProfile Metrics and Prometheus, tracing via OpenTracing and OpenTelemetry, and validation using Bean Validation (JSR 380). Integrations exist for security frameworks like OAuth 2.0 providers, JWT libraries, and enterprise identity products from Keycloak and Okta.
Notable implementations include vendor and open-source servers and libraries such as Jersey, RESTEasy, Apache CXF, and Payara Micro, alongside application servers like GlassFish, WildFly, Apache TomEE, and Oracle WebLogic Server. Tooling support spans build and package systems like Maven (software), Gradle, IDE integrations for Eclipse (software), IntelliJ IDEA, and NetBeans, and testing frameworks including JUnit, TestNG, and Arquillian. Continuous integration and deployment tools used in JAX-RS projects commonly involve Jenkins, GitHub Actions, GitLab CI, containerization with Docker (software), and orchestration via Kubernetes.
Secure JAX-RS services adopt best practices from application security guidance published by organizations such as OWASP, employing transport-layer protection with TLS, authentication via OAuth 2.0 and OpenID Connect providers, and authorization using role mapping integrated with Java EE Security API. Input validation and output encoding utilize Bean Validation and security libraries from Apache Shiro or application server realms, while defenses against threats like injection and cross-site request forgery follow recommendations from CIS (Center for Internet Security) and secure coding standards promoted by CERT. Logging, auditing, and incident response often integrate with platforms like ELK Stack and Splunk.
JAX-RS is widely used for microservices, enterprise APIs, and public-facing REST endpoints by organizations across finance, healthcare, telecommunications, and government that employ Java stacks such as Spring Boot (interop scenarios), Jakarta EE-based platforms, and cloud providers including Amazon Web Services, Google Cloud Platform, and Microsoft Azure. Common use cases include backend APIs for web and mobile applications, API gateways, facade services in Service-Oriented Architecture contexts, and integration layers connecting to systems like Apache Kafka, RabbitMQ, and Oracle Database. The technology is prevalent in examples from developer conferences and vendor case studies showcased at events like JavaOne, Devoxx, and FOSDEM.
Category:Java APIs