### SeBootstrap - Starting Applications Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.1.0.html Methods for starting a Jakarta RESTful Web Services application in a Java SE environment. These methods allow for starting with an Application instance or a Class, with or without a custom Configuration. ```APIDOC ## SeBootstrap.start ### Description Starts the provided application using the specified configuration. This method is intended to be used in Java SE environments only. The outcome of invocations in Jakarta EE container environments is undefined. ### Method CompletionStage ### Endpoint jakarta.ws.rs.SeBootstrap.start(Application, Configuration) --- ## SeBootstrap.start ### Description Starts the provided application using a default configuration. This method is intended to be used in Java SE environments only. The outcome of invocations in Jakarta EE container environments is undefined. ### Method CompletionStage ### Endpoint jakarta.ws.rs.SeBootstrap.start(Application) --- ## SeBootstrap.start ### Description Starts the provided application using the specified configuration. Creates application instance from class using default constructor. Injection is not supported. This method is intended to be used in Java SE environments only. The outcome of invocations in Jakarta EE container environments is undefined. ### Method CompletionStage ### Endpoint jakarta.ws.rs.SeBootstrap.start(Class, Configuration) --- ## SeBootstrap.start ### Description Starts the provided application using a default configuration. Creates application instance from class using default constructor. Injection is not supported. This method is intended to be used in Java SE environments only. The outcome of invocations in Jakarta EE container environments is undefined. ### Method CompletionStage ### Endpoint jakarta.ws.rs.SeBootstrap.start(Class) ``` -------------------------------- ### SeBootstrap Start (Application, Configuration) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Starts the provided application using the specified configuration, intended for Java SE environments. ```APIDOC ## SeBootstrap.start(Application, Configuration) ### Description Starts the provided application using the specified configuration. This method is intended to be used in Java SE environments only. The outcome of invocations in Jakarta EE container environments is undefined. ### Method `start` ### Endpoint `jakarta.ws.SeBootstrap` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ``` -------------------------------- ### Basic Client Usage Source: https://context7.com/jakartaee/rest/llms.txt Demonstrates basic GET, POST, PUT, and DELETE requests using the Client API. Includes examples for path and query parameters, request headers, and sending JSON and form data. ```java import jakarta.ws.rs.client.*; import jakarta.ws.rs.core.*; import java.util.List; import java.util.concurrent.Future; public class RestClientExamples { public void basicClientUsage() { // Create a client instance (reusable, thread-safe) Client client = ClientBuilder.newClient(); try { // Simple GET request Response response = client .target("http://api.example.com/customers") .request(MediaType.APPLICATION_JSON) .get(); System.out.println("Status: " + response.getStatus()); String body = response.readEntity(String.class); System.out.println("Body: " + body); response.close(); // GET with path parameters String customer = client .target("http://api.example.com/customers/{id}") .resolveTemplate("id", 123) .request(MediaType.APPLICATION_JSON) .get(String.class); // GET with query parameters Response searchResponse = client .target("http://api.example.com/customers") .queryParam("name", "John") .queryParam("limit", 10) .request(MediaType.APPLICATION_JSON) .header("Authorization", "Bearer token123") .get(); // POST with JSON entity Response createResponse = client .target("http://api.example.com/customers") .request(MediaType.APPLICATION_JSON) .post(Entity.json("{\"name\":\"Jane Doe\",\"email\":\"jane@example.com\"}")); // PUT request Response updateResponse = client .target("http://api.example.com/customers/123") .request() .put(Entity.json("{\"name\":\"Jane Smith\"}")); // DELETE request Response deleteResponse = client .target("http://api.example.com/customers/123") .request() .delete(); // Using Form data Form form = new Form() .param("username", "johndoe") .param("password", "secret"); Response loginResponse = client .target("http://api.example.com/login") .request() .post(Entity.form(form)); } finally { client.close(); } } public void typedResponses() { Client client = ClientBuilder.newClient(); // Read response directly as typed object Customer customer = client .target("http://api.example.com/customers/123") .request(MediaType.APPLICATION_JSON) .get(Customer.class); // Read generic collection type List customers = client .target("http://api.example.com/customers") .request(MediaType.APPLICATION_JSON) .get(new GenericType>() {}); client.close(); } public void asyncRequests() throws Exception { Client client = ClientBuilder.newClient(); WebTarget target = client.target("http://api.example.com/customers/{id}"); // Async with Future Future futureResponse = target .resolveTemplate("id", 123) .request(MediaType.APPLICATION_JSON) .async() .get(); // Do other work while request is in progress Response response = futureResponse.get(); // Blocks until complete Customer customer = response.readEntity(Customer.class); // Async with callback target.resolveTemplate("id", 456) .request(MediaType.APPLICATION_JSON) .async() .get(new InvocationCallback() { @Override public void completed(Customer customer) { System.out.println("Received: " + customer.getName()); } @Override public void failed(Throwable throwable) { System.err.println("Request failed: " + throwable.getMessage()); } }); client.close(); } public void clientConfiguration() { // Configure client with timeouts and SSL Client client = ClientBuilder.newBuilder() .connectTimeout(5, java.util.concurrent.TimeUnit.SECONDS) .readTimeout(30, java.util.concurrent.TimeUnit.SECONDS) .build(); ``` -------------------------------- ### SeBootstrap Start (Application) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Starts the provided application using a default configuration, intended for Java SE environments. ```APIDOC ## SeBootstrap.start(Application) ### Description Starts the provided application using a default configuration. This method is intended to be used in Java SE environments only. The outcome of invocations in Jakarta EE container environments is undefined. ### Method `start` ### Endpoint `jakarta.ws.SeBootstrap` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ``` -------------------------------- ### SeBootstrap Start (Class, Configuration) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Starts an application specified by a class using the provided configuration, intended for Java SE environments. ```APIDOC ## SeBootstrap.start(Class, Configuration) ### Description Starts an application specified by a class using the provided configuration. This method is intended to be used in Java SE environments only. The outcome of invocations in Jakarta EE container environments is undefined. ### Method `start` ### Endpoint `jakarta.ws.SeBootstrap` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response None ``` -------------------------------- ### JAX-RS HTTP Method Annotations Example Source: https://context7.com/jakartaee/rest/llms.txt Demonstrates the use of JAX-RS annotations for different HTTP methods including GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS. Ensure JAX-RS dependencies are included. ```java import jakarta.ws.rs.*; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; import java.net.URI; @Path("customers") public class CustomerResource { // GET /customers/123 - Retrieve a customer @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response getCustomer(@PathParam("id") long id) { String customer = "{\"id\":" + id + ",\"name\":\"John Doe\"}"; return Response.ok(customer).build(); } // POST /customers - Create a new customer @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response createCustomer(String customerJson) { long newId = 456; // Generated ID return Response.created(URI.create("/customers/" + newId)) .entity("{\"id\":" + newId + "}") .build(); } // PUT /customers/123 - Update entire customer @PUT @Path("{id}") @Consumes(MediaType.APPLICATION_JSON) public Response updateCustomer(@PathParam("id") long id, String customerJson) { return Response.ok().build(); } // PATCH /customers/123 - Partial update @PATCH @Path("{id}") @Consumes(MediaType.APPLICATION_JSON) public Response patchCustomer(@PathParam("id") long id, String patchJson) { return Response.ok().build(); } // DELETE /customers/123 - Delete a customer @DELETE @Path("{id}") public Response deleteCustomer(@PathParam("id") long id) { return Response.noContent().build(); } // HEAD /customers/123 - Check if customer exists @HEAD @Path("{id}") public Response checkCustomer(@PathParam("id") long id) { return Response.ok().build(); } // OPTIONS /customers - Get allowed methods @OPTIONS public Response getOptions() { return Response.ok() .header("Allow", "GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS") .build(); } } ``` -------------------------------- ### GET Request Handling with Sub-Resource Methods Source: https://github.com/jakartaee/rest/blob/main/jaxrs-spec/src/main/asciidoc/chapters/resources/_uritemplates.adoc Demonstrates how GET requests are routed to specific methods based on URI patterns. A request for 'widgets/offers' is handled by 'getDiscounted' in WidgetsResource, while 'widgets/xxx' is handled by 'getDetails' in WidgetResource. ```java @GET public Widget getDetails() {...} } ``` -------------------------------- ### Java Resource Classes Example Source: https://github.com/jakartaee/rest/blob/main/jaxrs-spec/src/main/asciidoc/chapters/resources/_mapping_requests_to_java_methods.adoc Demonstrates the structure of JAX-RS resource classes, including path annotations and method definitions for handling HTTP requests. This example shows how nested path annotations are resolved. ```java @Path("widget") public class WidgetResource { private String id; public WidgetResource() { this("0"); } public WidgetResource(String id) { this.id = id; } @GET public Widget findWidget() { return Widget.findWidgetById(id); } } @Path("widgets") public class WidgetsResource { @Path("{id}") public WidgetResource getWidget(@PathParam("id") String id) { return new WidgetResource(id); } } ``` -------------------------------- ### SeBootstrap.start() - With Class Argument Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Starts the provided application using the specified configuration. This method creates an application instance from the given class using its default constructor. Injection is not supported. It is intended for use in Java SE environments only, and its behavior in Jakarta EE container environments is undefined. ```APIDOC ## SeBootstrap.start(Class) ### Description Starts the provided application using the specified configuration. Creates application instance from class using default constructor. Injection is not supported. This method is intended to be used in Java SE environments only. The outcome of invocations in Jakarta EE container environments is undefined. ### Method `SeBootstrap.start` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (CompletionStage) - **CompletionStage** - Represents the asynchronous result of starting the application. #### Response Example None ``` -------------------------------- ### Sub-Resource Method Example Source: https://github.com/jakartaee/rest/blob/main/jaxrs-spec/src/main/asciidoc/chapters/resources/_uritemplates.adoc A sub-resource method annotated with @GET and @Path. This method handles requests for URIs matching the concatenated path of the resource class and this method. ```java @Path("widgets") public class WidgetsResource { @GET @Path("offers") public WidgetList getDiscounted() {...} @Path("{id}") public WidgetResource findWidget(@PathParam("id") String id) { return new WidgetResource(id); } } public class WidgetResource { public WidgetResource(String id) {...} ``` -------------------------------- ### SeBootstrap.start() - With Default Configuration Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Starts the provided application using a default configuration. This method creates an application instance from the given class using its default constructor. Injection is not supported. It is intended for use in Java SE environments only, and its behavior in Jakarta EE container environments is undefined. ```APIDOC ## SeBootstrap.start() ### Description Starts the provided application using a default configuration. Creates application instance from class using default constructor. Injection is not supported. This method is intended to be used in Java SE environments only. The outcome of invocations in Jakarta EE container environments is undefined. ### Method `SeBootstrap.start` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (CompletionStage) - **CompletionStage** - Represents the asynchronous result of starting the application. #### Response Example None ``` -------------------------------- ### Define a RESTful Web Resource with JAX-RS Source: https://github.com/jakartaee/rest/blob/main/jaxrs-api/src/main/javadoc/overview.html Expose Java POJOs as RESTful web resources using JAX-RS annotations. This example defines a resource for 'widgets' with GET and PUT methods. ```java @Path("widgets/{widgetid}") @Consumes("application/widgets+xml") @Produces("application/widgets+xml") public class WidgetResource { @GET public String getWidget(@PathParam("widgetid") String id) { return getWidgetAsXml(id); } @PUT public void updateWidget(@PathParam("widgetid") String id, Source update) { updateWidgetFromXml(id, update); } ... } ``` -------------------------------- ### Implement DynamicFeature for Conditional Binding Source: https://github.com/jakartaee/rest/blob/main/jaxrs-spec/src/main/asciidoc/chapters/filters_and_interceptors/_binding.adoc Use DynamicFeature to conditionally bind providers like filters or interceptors to resource methods based on annotations or other criteria. This example binds LoggingFilter to resource methods annotated with @GET in MyResource. ```java @Provider public final class DynamicLoggingFilterFeature implements DynamicFeature { @Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { if (MyResource.class.isAssignableFrom(resourceInfo.getResourceClass()) && resourceInfo.getResourceMethod().isAnnotationPresent(GET.class)) { context.register(new LoggingFilter()); } } } ``` -------------------------------- ### RxInvoker GET Method Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.1.0.html Invoke HTTP GET method for the current request. ```APIDOC ## GET /api/resource ### Description Invoke HTTP GET method for the current request. ### Method GET ### Endpoint /api/resource ### Parameters #### Query Parameters - **genericType** (GenericType) - Required - The generic type for the response. ### Response #### Success Response (200) - **Object** - The response object. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### CompletionStageRxInvoker GET Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Invokes the HTTP GET method asynchronously using CompletionStage. ```APIDOC ## CompletionStageRxInvoker GET ### Description Invoke HTTP GET method for the current request. ### Method `get()` ### Endpoint jakarta.ws.rs.client.CompletionStageRxInvoker ### Description Invoke HTTP GET method for the current request. ### Method `get(Class responseType)` ### Endpoint jakarta.ws.rs.client.CompletionStageRxInvoker ### Description Invoke HTTP GET method for the current request. ### Method `get(GenericType responseType)` ### Endpoint jakarta.ws.rs.client.CompletionStageRxInvoker ``` -------------------------------- ### Bootstrap and Configure Client Instance Source: https://github.com/jakartaee/rest/blob/main/jaxrs-spec/src/main/asciidoc/chapters/client_api/_bootstrapping-a-client-instance.adoc Obtain a default Client instance using ClientBuilder.newClient() and configure it with properties and providers. Properties are name-value pairs, and Features are providers that group related configurations. ```java // Default instance of client Client client = ClientBuilder.newClient(); // Additional configuration of default client client.property("MyProperty", "MyValue") .register(MyProvider.class) .register(MyFeature.class); ``` -------------------------------- ### RuntimeDelegate bootstrap Methods Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Methods for bootstrapping application startup in Java SE environments. ```APIDOC ## RuntimeDelegate bootstrap Methods ### Description Methods for bootstrapping application startup in Java SE environments. These methods are not intended for direct application use. ### Methods #### `jakarta.ws.rs.ext.RuntimeDelegate.bootstrap(Application, Configuration)` ##### Description Perform startup of the application in Java SE environments. This method is not intended to be invoked by applications. Call SeBootstrap#start(Application, SeBootstrap.Configuration) instead. ##### Method BOOTSTRAP #### `jakarta.ws.rs.ext.RuntimeDelegate.bootstrap(Class, Configuration)` ##### Description Perform startup of the application in Java SE environments. This method is not intended to be invoked by applications. Call SeBootstrap#start(Class, SeBootstrap.Configuration) instead. ##### Method BOOTSTRAP ``` -------------------------------- ### RxInvoker GET Method Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Invokes an HTTP GET method for the current request asynchronously. ```APIDOC ## GET /api/resource ### Description Invokes an HTTP GET method for the current request asynchronously. ### Method GET ### Endpoint /api/resource ### Parameters #### Query Parameters - **genericType** (GenericType) - Required - The generic type for the response. ### Response #### Success Response (200) - **Object** - The response payload. ### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### SeBootstrap.Configuration.Builder - Building Configuration Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.1.0.html Methods for building a bootstrap configuration instance. ```APIDOC ## SeBootstrap.Configuration.Builder.build ### Description Builds a bootstrap configuration instance from the provided property values. ### Method Configuration ### Endpoint jakarta.ws.rs.SeBootstrap.Configuration.Builder.build --- ## SeBootstrap.Configuration.Builder.from ### Description Creates a new bootstrap configuration builder instance from a BiFunction. ### Method Builder ### Parameters #### Path Parameters - **BiFunction** (BiFunction) - Required - A BiFunction to create the builder from. ### Endpoint jakarta.ws.rs.SeBootstrap.Configuration.Builder.from(BiFunction) ``` -------------------------------- ### SeBootstrap.Configuration.Builder.build() Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Builds a bootstrap configuration instance from the provided property values. ```APIDOC ## SeBootstrap.Configuration.Builder.build() ### Description Builds a bootstrap configuration instance from the provided property values. ### Method `SeBootstrap.Configuration.Builder.build` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Configuration) - **Configuration** - A bootstrap configuration instance. #### Response Example None ``` -------------------------------- ### SyncInvoker GET Methods Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.0.0.html Provides methods to invoke HTTP GET requests synchronously. ```APIDOC ## GET /resource ### Description Invoke HTTP GET method for the current request synchronously. ### Method GET ### Endpoint /resource ### Parameters None ### Request Example None ### Response #### Success Response (200) - **Response** (Response) - The response from the server. #### Response Example None ``` ```APIDOC ## GET /resource ### Description Invoke HTTP GET method for the current request synchronously, returning the response as a specific object type. ### Method GET ### Endpoint /resource ### Parameters #### Path Parameters - **Class** (Class) - The class to which the response should be converted. ### Request Example None ### Response #### Success Response (200) - **Object** (Object) - The response from the server, converted to the specified class. #### Response Example None ``` ```APIDOC ## GET /resource ### Description Invoke HTTP GET method for the current request synchronously, returning the response as a specific generic type. ### Method GET ### Endpoint /resource ### Parameters #### Path Parameters - **GenericType** (GenericType) - The generic type to which the response should be converted. ### Request Example None ### Response #### Success Response (200) - **Object** (Object) - The response from the server, converted to the specified generic type. #### Response Example None ``` -------------------------------- ### SeBootstrap.Configuration.Builder.from(Object) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Optional convenience method to bulk-load external configuration. Implementations are free to support any external configuration mechanics, or none at all. It is completely up to the implementation what set of properties is effectively loaded from the provided external configuration, possibly none at all. If the passed external configuration mechanics is unsupported, this method MUST simply do nothing. Portable applications should not call this method, as the outcome is completely implementation-specific. ```APIDOC ## SeBootstrap.Configuration.Builder.from(Object) ### Description Optional convenience method to bulk-load external configuration. Implementations are free to support any external configuration mechanics, or none at all. It is completely up to the implementation what set of properties is effectively loaded from the provided external configuration, possibly none at all. If the passed external configuration mechanics is unsupported, this method MUST simply do nothing. Portable applications should not call this method, as the outcome is completely implementation-specific. ### Method `SeBootstrap.Configuration.Builder.from` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Builder) - **Builder** - The configuration builder instance. #### Response Example None ``` -------------------------------- ### RxInvoker - GET Method Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.1.0.html Invokes an HTTP GET method for the current request and returns an Object. ```APIDOC ## GET /api/resource ### Description Invokes an HTTP GET method for the current request. ### Method GET ### Endpoint [Full endpoint path] ### Parameters #### Query Parameters - **param** (type) - Optional - Description of the parameter ### Request Example (No request body for GET) ### Response #### Success Response (200) - **Object** - The response from the GET request. #### Response Example (Example response body depends on the resource) ``` -------------------------------- ### SSE Client Example with Reconnection Source: https://context7.com/jakartaee/rest/llms.txt Demonstrates how to use SseEventSource to consume SSE streams. Includes configuration for automatic reconnection and registration of event, error, and completion handlers. ```java import jakarta.ws.rs.*; import jakarta.ws.rs.client.*; import jakarta.ws.rs.core.*; import jakarta.ws.rs.sse.*; import java.util.concurrent.TimeUnit; // SSE Client Example public class SseClientExample { public static void main(String[] args) throws InterruptedException { Client client = ClientBuilder.newClient(); WebTarget target = client.target("http://localhost:8080/api/events"); // Build SSE event source with reconnect configuration try (SseEventSource eventSource = SseEventSource.target(target) .reconnectingEvery(5, TimeUnit.SECONDS) .build()) { // Register event consumer only eventSource.register(event -> { System.out.println("Event received:"); System.out.println(" ID: " + event.getId()); System.out.println(" Name: " + event.getName()); System.out.println(" Data: " + event.readData()); }); // Or register with error and completion handlers eventSource.register( event -> System.out.println("Data: " + event.readData()), error -> System.err.println("Error: " + error.getMessage()), () -> System.out.println("Stream completed") ); // Open the connection eventSource.open(); // Keep consuming events Thread.sleep(60000); } // Auto-closes the event source client.close(); } } ``` -------------------------------- ### CompletionStageRxInvoker - GET Method Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.1.0.html Invokes an HTTP GET method for the current request and returns a CompletionStage. ```APIDOC ## GET /api/resource ### Description Invokes an HTTP GET method for the current request. ### Method GET ### Endpoint [Full endpoint path] ### Parameters #### Query Parameters - **param** (type) - Optional - Description of the parameter ### Request Example (No request body for GET) ### Response #### Success Response (200) - **CompletionStage** - A CompletionStage representing the asynchronous response. #### Response Example (Example response body depends on the resource) ``` -------------------------------- ### SeBootstrap.Configuration.Builder.from(BiFunction) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Convenience method for bulk-loading configuration from a property supplier. Implementations ask the passed provider function for the actual values of all their supported properties before returning from this configuration method. For each single request, the implementation provides the name of the property and the expected data type of the value. If no such property exists (i.e., either the name is unknown or misspelled, or the type does not exactly match), the Optional is Optional.empty(). ```APIDOC ## SeBootstrap.Configuration.Builder.from(BiFunction) ### Description Convenience method for bulk-loading configuration from a property supplier. Implementations ask the passed provider function for the actual values of all their supported properties, before returning from this configuration method. For each single request the implementation provides the name of the property and the expected data type of the value. If no such property exists (i. e. either the name is unknown or misspelled, or the type does not exactly match), the Optional is Optional#empty() empty. ### Method `SeBootstrap.Configuration.Builder.from` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Builder) - **Builder** - The configuration builder instance. #### Response Example None ``` -------------------------------- ### Get Link Builder by Relation - Jakarta REST Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.0.0.html Provides a convenience method to get a Link.Builder for a given relation. ```java Link.Builder linkBuilder = containerResponseContext.getLinkBuilder("self"); ``` -------------------------------- ### SeBootstrap.Configuration.builder Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Creates a new bootstrap configuration builder instance. ```APIDOC ## SeBootstrap.Configuration.builder ### Description Creates a new bootstrap configuration builder instance. ### Method `SeBootstrap.Configuration.builder` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Builder) - **Builder** - A new instance of the configuration builder. #### Response Example None ``` -------------------------------- ### SeBootstrap Instance Methods Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.1.0.html Methods for interacting with a running JAX-RS application instance. ```APIDOC ## jakarta.ws.rs.SeBootstrap.Instance.configuration ### Description Provides access to the configuration actually used by the implementation used to create this instance. This may, or may not, be the same instance passed to SeBootstrap#start(Application, Configuration), not even an equal instance, as implementations MAY create a new intance and MUST update at least the PORT property with the actually used value. Portable applications should not make any assumptions but always explicitly read the actual values from the configuration returned from this method. ### Method Configuration ### Endpoint N/A (Instance method) ``` ```APIDOC ## jakarta.ws.rs.SeBootstrap.Instance.stop ### Description Initiate immediate shutdown of running application instance. ### Method CompletionStage ### Endpoint N/A (Instance method) ``` ```APIDOC ## jakarta.ws.rs.SeBootstrap.Instance.stopOnShutdown (Consumer) ### Description Registers a consumer for a StopResult which will be executed in a new thread during the JVM shutdown phase. ### Method void ### Endpoint N/A (Instance method) ``` ```APIDOC ## jakarta.ws.rs.SeBootstrap.Instance.unwrap (Class) ### Description Provides access to the wrapped native handle of the application instance. Implementations may, or may not, have native handles. Portable applications should not invoke this method, as the outcome is undefined. ### Method Object ### Endpoint N/A (Instance method) ``` -------------------------------- ### Async GET Operations Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.0.0.html Asynchronously invokes the HTTP GET method. Handles potential exceptions during invocation and response processing. ```APIDOC ## GET /api/resource (Async) ### Description Invokes the HTTP GET method asynchronously. The `Future#get()` method may throw `ExecutionException` wrapping `ProcessingException`. ### Method GET ### Endpoint [Resource Endpoint] ### Parameters #### Path Parameters None specified. #### Query Parameters None specified. #### Request Body None specified. ### Request Example ```json {} ``` ### Response #### Success Response (200) - **Future** (java.util.concurrent.Future) - Represents the asynchronous result of the GET operation. #### Response Example ```json { "example": "Future object representing the result" } ``` ## GET /api/resource (Async with Class) ### Description Invokes the HTTP GET method asynchronously, expecting a response of a specific class. Handles potential exceptions during invocation and response processing. ### Method GET ### Endpoint [Resource Endpoint] ### Parameters #### Path Parameters None specified. #### Query Parameters None specified. #### Request Body None specified. ### Request Example ```json {} ``` ### Response #### Success Response (200) - **Future** (java.util.concurrent.Future) - Represents the asynchronous result of the GET operation. #### Response Example ```json { "example": "Future object representing the result" } ``` ## GET /api/resource (Async with GenericType) ### Description Invokes the HTTP GET method asynchronously, expecting a response of a specific generic type. Handles potential exceptions during invocation and response processing. ### Method GET ### Endpoint [Resource Endpoint] ### Parameters #### Path Parameters None specified. #### Query Parameters None specified. #### Request Body None specified. ### Request Example ```json {} ``` ### Response #### Success Response (200) - **Future** (java.util.concurrent.Future) - Represents the asynchronous result of the GET operation. #### Response Example ```json { "example": "Future object representing the result" } ``` ## GET /api/resource (Async with InvocationCallback) ### Description Invokes the HTTP GET method asynchronously using an `InvocationCallback`. Handles potential exceptions during invocation and response processing. ### Method GET ### Endpoint [Resource Endpoint] ### Parameters #### Path Parameters None specified. #### Query Parameters None specified. #### Request Body None specified. ### Request Example ```json {} ``` ### Response #### Success Response (200) - **Future** (java.util.concurrent.Future) - Represents the asynchronous result of the GET operation. #### Response Example ```json { "example": "Future object representing the result" } ``` ``` -------------------------------- ### SeBootstrap.Configuration.Builder.host(String) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Convenience method to set the host to be used. This is equivalent to calling property(HOST, value). ```APIDOC ## SeBootstrap.Configuration.Builder.host(String) ### Description Convenience method to set the host to be used. Same as if calling #property(String, Object) property(HOST, value). ### Method `SeBootstrap.Configuration.Builder.host` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (Builder) - **Builder** - The configuration builder instance. #### Response Example None ``` -------------------------------- ### RxInvoker - GET Method with Class Parameter Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.1.0.html Invokes an HTTP GET method for the current request with a Class parameter and returns an Object. ```APIDOC ## GET /api/resource ### Description Invokes an HTTP GET method for the current request. ### Method GET ### Endpoint [Full endpoint path] ### Parameters #### Query Parameters - **param** (type) - Optional - Description of the parameter #### Request Body - **type** (Class) - Required/Optional - The class type for the response. ### Request Example (No request body for GET) ### Response #### Success Response (200) - **Object** - The response from the GET request. #### Response Example (Example response body depends on the resource) ``` -------------------------------- ### Servlet Deployment Configuration (web.xml) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-spec/src/main/asciidoc/chapters/applications/_publication.adoc An example of a `web.xml` file for a JAX-RS application in a Servlet 3 environment. It configures a servlet to automatically discover resources when no `Application` subclass is present. ```xml jakarta.ws.rs.core.Application jakarta.ws.rs.core.Application /myresources/* ``` -------------------------------- ### Async GET Request Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.0.0.html Invoke HTTP GET method asynchronously. Returns a Future that may complete with an ExecutionException wrapping ProcessingException or WebApplicationException. ```APIDOC ## GET /api/resource ### Description Invoke HTTP GET method for the current request asynchronously. ### Method GET ### Endpoint [Endpoint path for GET request] ### Parameters None explicitly defined in the provided text for this specific method signature. ### Request Example (No request body example provided) ### Response #### Success Response (200) - **Future** (java.util.concurrent.Future) - Represents the asynchronous result of the GET request. #### Response Example (No response body example provided, as it's a Future) ### Error Handling Calling `Future#get()` may throw `ExecutionException` which can wrap: - `jakarta.ws.rs.ProcessingException`: If there's an invocation processing failure. - `WebApplicationException` or subclasses: If the response status is not successful and the generic type is not `jakarta.ws.rs.core.Response`. - `ResponseProcessingException`: If processing a properly received response fails, containing the `Response` instance. ``` -------------------------------- ### Deploy Site to GitHub Pages Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/userguide/README.md Deploys the generated static site to GitHub Pages. This command typically requires passwordless authentication to be set up. ```bash mvn deploy ``` -------------------------------- ### SeBootstrap Configuration Builder Methods Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.1.0.html Methods for configuring a JAX-RS application using SeBootstrap. ```APIDOC ## SeBootstrap.Configuration.Builder.from (Object) ### Description Convenience method for bulk-loading configuration from a property supplier. Implementations ask the passed provider function for the actual values of all their supported properties, before returning from this configuration method. For each single request the implementation provides the name of the property and the expected data type of the value. If no such property exists (i. e. either the name is unknown or misspelled, or the type does not exactly match), the Optional is Optional#empty() empty. ### Method Builder ### Endpoint N/A (Configuration method) ``` ```APIDOC ## SeBootstrap.Configuration.Builder.host (String) ### Description Convenience method to set the host to be used. Same as if calling #property(String, Object) property(HOST, value). ### Method Builder ### Endpoint N/A (Configuration method) ``` ```APIDOC ## SeBootstrap.Configuration.Builder.port (Integer) ### Description Convenience method to set the port to be used. Same as if calling #property(String, Object) property(PORT, value). ### Method Builder ### Endpoint N/A (Configuration method) ``` ```APIDOC ## SeBootstrap.Configuration.Builder.property (String, Object) ### Description Sets the property name to the provided value. This method does not check the validity, type or syntax of the provided value. ### Method Builder ### Endpoint N/A (Configuration method) ``` ```APIDOC ## SeBootstrap.Configuration.Builder.protocol (String) ### Description Convenience method to set the protocol to be used. Same as if calling #property(String, Object) property(PROTOCOL, value). ### Method Builder ### Endpoint N/A (Configuration method) ``` ```APIDOC ## SeBootstrap.Configuration.Builder.rootPath (String) ### Description Convenience method to set the rootPath to be used. Same as if calling #property(String, Object) property(ROOT_PATH, value). ### Method Builder ### Endpoint N/A (Configuration method) ``` ```APIDOC ## SeBootstrap.Configuration.Builder.sslClientAuthentication (SSLClientAuthentication) ### Description Convenience method to set SSL client authentication policy. Same as if calling #property(String, Object) property(SSL_CLIENT_AUTHENTICATION, value). ### Method Builder ### Endpoint N/A (Configuration method) ``` ```APIDOC ## SeBootstrap.Configuration.Builder.sslContext (SSLContext) ### Description Convenience method to set the sslContext to be used. Same as if calling #property(String, Object) property(SSL_CONTEXT, value). ### Method Builder ### Endpoint N/A (Configuration method) ``` -------------------------------- ### Get Forecast with CompletionStage Source: https://github.com/jakartaee/rest/blob/main/jaxrs-spec/src/main/asciidoc/chapters/client_api/_reactive_clients.adoc Initiates an asynchronous GET request and returns a CompletionStage. Use thenAccept to process the result when it becomes available. ```java CompletionStage csf = client.target("forecast/{destination}") .resolveTemplate("destination", "mars") .request() .rx() .get(String.class); csf.thenAccept(System.out::println); ``` -------------------------------- ### Async GET Request (with InvocationCallback parameter) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Asynchronously invokes an HTTP GET request with an InvocationCallback. The returned Future may throw ExecutionException wrapping ProcessingException or WebApplicationException. ```APIDOC ## GET /api/resource ### Description Invokes an HTTP GET method for the current request asynchronously, using an InvocationCallback for handling the response. ### Method GET ### Endpoint [Resource Endpoint] ### Parameters #### Path Parameters None specified. #### Query Parameters None specified. #### Request Body None specified. ### Request Example None specified. ### Response #### Success Response (200) None specified. #### Response Example None specified. ### Error Handling Calling `java.util.concurrent.Future#get()` on the returned Future instance may throw `java.util.concurrent.ExecutionException` that wraps either a `jakarta.ws.rs.ProcessingException` (invocation processing failure) or a `WebApplicationException` (or subclass) if the response status is not `SUCCESSFUL` and the generic type of the supplied response callback is not `Response`. If response processing fails, the wrapped exception will be of `ResponseProcessingException` type containing the `Response` instance. ``` -------------------------------- ### Package Site for Download Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/userguide/README.md Creates a zip file containing all the generated HTML files. This is useful for distributing the site or attaching to releases. ```bash mvn package ``` -------------------------------- ### Async GET Request (no parameters) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Asynchronously invokes an HTTP GET request without specific parameters. The returned Future may throw ExecutionException wrapping ProcessingException. ```APIDOC ## GET /api/resource ### Description Invokes an HTTP GET method for the current request asynchronously. ### Method GET ### Endpoint [Resource Endpoint] ### Parameters #### Path Parameters None specified. #### Query Parameters None specified. #### Request Body None specified. ### Request Example None specified. ### Response #### Success Response (200) None specified. #### Response Example None specified. ### Error Handling Calling `java.util.concurrent.Future#get()` on the returned Future instance may throw `java.util.concurrent.ExecutionException` that wraps a `jakarta.ws.rs.ProcessingException` (invocation processing failure). If response processing fails, the wrapped exception will be of `ResponseProcessingException` type containing the `Response` instance. ``` -------------------------------- ### SeBootstrap.Configuration.baseUriBuilder Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Returns a UriBuilder that includes the application root path. ```APIDOC ## SeBootstrap.Configuration.baseUriBuilder ### Description Returns a UriBuilder that includes the application root path. ### Method `SeBootstrap.Configuration.baseUriBuilder` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (UriBuilder) - **UriBuilder** - A UriBuilder instance including the application root path. #### Response Example None ``` -------------------------------- ### Basic Java Hello World Program Source: https://github.com/jakartaee/rest/blob/main/jaxrs-spec/src/main/asciidoc/chapters/introduction/_conventions.adoc A standard Java program that prints 'Hello World' to the console. This serves as a basic example of Java syntax. ```java package com.example.hello; public class Hello { public static void main(String args[]) { System.out.println("Hello World"); } } ``` -------------------------------- ### Async GET Request (no type) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_3.1.0.html Asynchronously invokes an HTTP GET request without specifying a response type. The returned Future may throw ExecutionException wrapping ProcessingException. ```APIDOC ## GET /resource ### Description Asynchronously invokes an HTTP GET request for the current request without specifying a response type. ### Method GET ### Endpoint [Full endpoint path] ### Parameters #### Query Parameters - **callback** (InvocationCallback) - Required - The callback to handle the asynchronous response. ### Request Example ```java // Example of invoking a GET request asynchronously without a specific type Future future = asyncInvoker.get(callback); ``` ### Response #### Success Response (200) - **Future** (java.util.concurrent.Future) - A Future representing the result of the asynchronous operation. #### Response Example ```java // Example of handling the Future result try { Response response = future.get(); // Process the response } catch (ExecutionException e) { // Handle exceptions like ProcessingException Throwable cause = e.getCause(); if (cause instanceof ProcessingException) { // Handle processing failure } } ``` ``` -------------------------------- ### SeBootstrap API Source: https://context7.com/jakartaee/rest/llms.txt The SeBootstrap API allows starting JAX-RS applications in Java SE environments without requiring a full application server. It provides configuration options for protocol, host, port, and SSL settings. ```APIDOC ## SeBootstrap API ### Description The `SeBootstrap` API allows starting JAX-RS applications in Java SE environments without requiring a full application server. It provides configuration options for protocol, host, port, and SSL settings. ### Simple Bootstrap Example ```java import jakarta.ws.rs.*; import jakarta.ws.rs.core.Application; import java.net.URI; import java.util.Collections; import java.util.Set; @ApplicationPath("api") @Path("hello") public class HelloWorldApp extends Application { @Override public Set> getClasses() { return Collections.singleton(HelloWorldApp.class); } @GET @Produces("text/plain") public String sayHello() { return "Hello, World!"; } @GET @Path("{name}") @Produces("text/plain") public String sayHelloTo(@PathParam("name") String name) { return "Hello, " + name + "!"; } public static void main(String[] args) throws InterruptedException { SeBootstrap.start(HelloWorldApp.class).thenAccept(instance -> { URI uri = instance.configuration().baseUri(); System.out.println("Application started at: " + uri); instance.stopOnShutdown(stopResult -> System.out.println("Application stopped")); }); Thread.currentThread().join(); } } ``` ### Advanced Configuration Example ```java import jakarta.ws.rs.*; import jakarta.ws.rs.core.Application; import java.net.URI; import java.util.Collections; import java.util.Set; import java.util.concurrent.CompletionStage; class AdvancedBootstrapExample { public static void main(String[] args) throws Exception { SeBootstrap.Configuration config = SeBootstrap.Configuration.builder() .protocol("HTTP") .host("0.0.0.0") .port(8080) .rootPath("/api") .build(); CompletionStage startup = SeBootstrap.start(HelloWorldApp.class, config); startup.thenAccept(instance -> { SeBootstrap.Configuration actualConfig = instance.configuration(); System.out.println("Protocol: " + actualConfig.protocol()); System.out.println("Host: " + actualConfig.host()); System.out.println("Port: " + actualConfig.port()); System.out.println("Base URI: " + actualConfig.baseUri()); }); Thread.currentThread().join(); } } ``` ### HTTPS Configuration Example ```java import jakarta.ws.rs.*; import jakarta.ws.rs.core.Application; import java.net.URI; import java.util.Collections; import java.util.Set; import java.util.concurrent.CompletionStage; class HttpsBootstrapExample { public static void main(String[] args) throws Exception { javax.net.ssl.SSLContext sslContext = javax.net.ssl.SSLContext.getInstance("TLSv1.3"); // Initialize SSLContext with KeyManager and TrustManager... SeBootstrap.Configuration config = SeBootstrap.Configuration.builder() .protocol("HTTPS") .host("localhost") .port(8443) .sslContext(sslContext) .sslClientAuthentication(SeBootstrap.Configuration.SSLClientAuthentication.OPTIONAL) .build(); SeBootstrap.start(HelloWorldApp.class, config); Thread.currentThread().join(); } } ``` ``` -------------------------------- ### Async GET Request (with GenericType parameter) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Asynchronously invokes an HTTP GET request, expecting a response of a specific GenericType. The returned Future may throw ExecutionException wrapping ProcessingException or WebApplicationException. ```APIDOC ## GET /api/resource ### Description Invokes an HTTP GET method for the current request asynchronously, specifying the response type as a GenericType. ### Method GET ### Endpoint [Resource Endpoint] ### Parameters #### Path Parameters None specified. #### Query Parameters None specified. #### Request Body None specified. ### Request Example None specified. ### Response #### Success Response (200) None specified. #### Response Example None specified. ### Error Handling Calling `java.util.concurrent.Future#get()` on the returned Future instance may throw `java.util.concurrent.ExecutionException` that wraps either a `jakarta.ws.rs.ProcessingException` (invocation processing failure) or a `WebApplicationException` (or subclass) if the response status is not `SUCCESSFUL` and the specified response type is not `Response`. If response processing fails, the wrapped exception will be of `ResponseProcessingException` type containing the `Response` instance. ``` -------------------------------- ### Async GET Request (with Class parameter) Source: https://github.com/jakartaee/rest/blob/main/jaxrs-tck/docs/assertions/JAXRSJavadocAssertions_4.0.0.html Asynchronously invokes an HTTP GET request, expecting a response of a specific Class type. The returned Future may throw ExecutionException wrapping ProcessingException or WebApplicationException. ```APIDOC ## GET /api/resource ### Description Invokes an HTTP GET method for the current request asynchronously, specifying the response type as a Class. ### Method GET ### Endpoint [Resource Endpoint] ### Parameters #### Path Parameters None specified. #### Query Parameters None specified. #### Request Body None specified. ### Request Example None specified. ### Response #### Success Response (200) None specified. #### Response Example None specified. ### Error Handling Calling `java.util.concurrent.Future#get()` on the returned Future instance may throw `java.util.concurrent.ExecutionException` that wraps either a `jakarta.ws.rs.ProcessingException` (invocation processing failure) or a `WebApplicationException` (or subclass) if the response status is not `SUCCESSFUL` and the specified response type is not `Response`. If response processing fails, the wrapped exception will be of `ResponseProcessingException` type containing the `Response` instance. ``` -------------------------------- ### Run Full Build with Maven Source: https://github.com/jakartaee/rest/blob/main/jaxrs-spec/README.md Execute the full build process for the Jakarta RESTful Web Services Specification project using Maven. Ensure JDK 17+ and Maven 3.6.3+ are installed. ```bash mvn install ```