### Navigate to Producer Directory Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples005.adoc Change directory to the simple producer example. This is a setup step for running the producer client. ```shell cd tut-install/examples/jms/simple/producer/ ``` -------------------------------- ### Build Simple Examples with Maven Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples003.adoc Navigate to the simple directory and run 'mvn install' to build all the simple Jakarta Messaging examples. ```shell cd tut-install/jms/simple/ mvn install ``` -------------------------------- ### Navigate to Shared Consumer Directory Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples005.adoc Change directory to the shared consumer example. This is a setup step for running the shared consumer client. ```shell cd tut-install/examples/jms/shared/sharedconsumer/ ``` -------------------------------- ### Navigate to Producer Example Directory Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples003.adoc Change directory to the producer example's location within the tut-install directory. ```shell cd tut-install/jms/simple/producer ``` -------------------------------- ### Navigate to Durable Consumer Example Directory Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples004.adoc This shell command navigates the user to the directory containing the durable consumer example, which is a prerequisite for building and running the example. ```shell cd tut-install/jms/durablesubscriptionexample/durableconsumer ``` -------------------------------- ### Start Vendor Client Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples004.adoc Start the Vendor client using the appclient script. This command deploys and runs the client JAR. ```shell appclient -client target/vendor.jar ``` -------------------------------- ### Task-Oriented Step Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/batch-processing/batch-processing004.adoc Example of a task-oriented step configuration, including its ID, next step, batchlet, properties, and listeners. ```xml ... ... ``` -------------------------------- ### Navigate to Producer Example Directory Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples005.adoc Changes the current directory to the JMS simple producer example. ```shell cd tut-install/examples/jms/simple/producer ``` -------------------------------- ### Chunk-Oriented Step Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/batch-processing/batch-processing004.adoc Example of a chunk-oriented step configuration, including its ID, next step, properties, listeners, chunk settings, and end/stop/fail conditions. ```xml ... ... ... ... ``` -------------------------------- ### Start CPU Supplier Client Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples004.adoc Start the CPU supplier client using the appclient script. This command deploys and runs the client JAR. ```shell appclient -client target/genericsupplier.jar CPU ``` -------------------------------- ### Example Application Output Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples009.adoc This is an example of the expected output when running the clientmdbentity application. It shows messages being sent and processed by the message-driven beans and entity classes. ```text SENDER: Setting hire ID to 50, name Bill Tudor, position Programmer SENDER: Setting hire ID to 51, name Carol Jones, position Senior Programmer SENDER: Setting hire ID to 52, name Mark Wilson, position Manager SENDER: Setting hire ID to 53, name Polly Wren, position Senior Programmer SENDER: Setting hire ID to 54, name Joe Lawrence, position Director Waiting for 5 message(s) New hire event processed: Employee ID: 52 Name: Mark Wilson Equipment: Tablet Office number: 294 Waiting for 4 message(s) New hire event processed: Employee ID: 53 Name: Polly Wren Equipment: Laptop Office number: 186 Waiting for 3 message(s) New hire event processed: Employee ID: 54 Name: Joe Lawrence Equipment: Mobile Phone Office number: 135 Waiting for 2 message(s) New hire event processed: Employee ID: 50 Name: Bill Tudor Equipment: Desktop System Office number: 200 Waiting for 1 message(s) New hire event processed: Employee ID: 51 Name: Carol Jones Equipment: Laptop Office number: 262 ``` -------------------------------- ### HTTP GET Request for Subresource Method Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxrs-advanced/jaxrs-advanced003.adoc This is an example HTTP GET request that would be handled by the subresource method defined above. ```http GET /employeeinfo/employees/john.doe@example.com ``` -------------------------------- ### Producer Client Output Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples003.adoc Example output from running the producer client, showing the destination type and the messages being sent. This confirms the client is functioning as expected. ```shell Destination type is queue Sending message: This is message 1 from producer Sending message: This is message 2 from producer Sending message: This is message 3 from producer Text messages sent: 3 ``` -------------------------------- ### Navigate to Generic Supplier Directory Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples004.adoc Change directory to the genericsupplier example for resource creation. ```shell cd tut-install/jms/transactedexample/genericsupplier ``` -------------------------------- ### Roster Application Output Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/persistence-basicexamples/persistence-basicexamples003.adoc This is an example of the output generated by the roster application client after deployment. It shows lists of players, teams, and defenders. ```text List all players in team T2: P6 Ian Carlyle goalkeeper 555.0 P7 Rebecca Struthers midfielder 777.0 P8 Anne Anderson forward 65.0 P9 Jan Wesley defender 100.0 P10 Terry Smithson midfielder 100.0 List all teams in league L1: T1 Honey Bees Visalia T2 Gophers Manteca T5 Crows Orland List all defenders: P2 Alice Smith defender 505.0 P5 Barney Bold defender 100.0 P9 Jan Wesley defender 100.0 P22 Janice Walker defender 857.0 P25 Frank Fletcher defender 399.0 ``` -------------------------------- ### Example Certificate Information Output Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/security-advanced/security-advanced001.adoc This is an example of the information displayed by keytool after importing a certificate, showing details about the certificate's owner, issuer, validity, and fingerprints. ```text Owner: CN=localhost, OU=My Company, O=Software, L=Santa Clara, ST=CA, C=US Issuer: CN=localhost, OU=My Company, O=Software, L=Santa Clara, ST=CA, C=US Serial number: 3e932169 Valid from: Mon Nov 26 18:15:47 EST 2012 until: Sun Feb 24 18:15:47 EST 2013 Certificate fingerprints: MD5: 52:9F:49:68:ED:78:6F:39:87:F3:98:B3:6A:6B:0F:90 SHA1: EE:2E:2A:A6:9E:03:9A:3A:1C:17:4A:28:5E:97:20:78:3F: SHA256: 80:05:EC:7E:50:50:5D:AA:A3:53:F1:11:9B:19:EB:0D:20:67:C1:12: AF:42:EC:CD:66:8C:BD:99:AD:D9:76:95 Signature algorithm name: SHA256withRSA Version: 3 ... ``` -------------------------------- ### Example Job Definition File for WAR Package Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/batch-processing/batch-processing007.adoc This XML snippet shows an example of a job definition file. When packaging as a WAR file, this file should be placed in the 'WEB-INF/classes/META-INF/batch-jobs/' directory and named according to its job ID. ```xml ... ``` -------------------------------- ### Decision Transition Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/batch-processing/batch-processing.adoc Configures conditional transitions in a batch job based on exit status. This example transitions to 'step2' if 'step1' completes successfully. ```xml ``` -------------------------------- ### Start GlassFish Server using Command Line Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/usingexamples/usingexamples002.adoc Use this command to start the default GlassFish Server domain (domain1) with verbose logging enabled. The output will be displayed in the terminal and logged to the server log file. ```shell asadmin start-domain --verbose ``` -------------------------------- ### Start Hard Drive Supplier Client Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples004.adoc Start the Hard Drive supplier client using the appclient script. This command deploys and runs the client JAR. ```shell appclient -client target/genericsupplier.jar HD ``` -------------------------------- ### Start Derby Database via Command Line Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/usingexamples/usingexamples004.adoc Use this command to start the Apache Derby database server from the command line. Ensure you are in the GlassFish Server's `bin` directory. ```shell asadmin start-database ``` -------------------------------- ### Start a Batch Job with Parameters Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/batch-processing/batch-processing006.adoc Obtain a JobOperator and start a batch job named 'simplejob' with custom runtime parameters. The job name must match its definition file. ```java JobOperator jobOperator = BatchRuntime.getJobOperator(); Properties props = new Properties(); props.setProperty("parameter1", "value1"); ... long execID = jobOperator.start("simplejob", props); ``` -------------------------------- ### Vendor Client Output with Rollback Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples004.adoc Shows an example of the Vendor client output when a JMSException occurs, leading to a transaction rollback. This demonstrates error handling and rollback behavior in the messaging system. ```shell Vendor: JMSException occurred: jakarta.jms.JMSException: Simulated database concurrent access exception Vendor: Rolled back transaction 1 ``` -------------------------------- ### Programmatic Login and Logout Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/security-webtier/security-webtier003.adoc A complete servlet example demonstrating programmatic login, logout, and displaying user security information. It shows how to use Jakarta Security's login and logout methods within a servlet context. ```java package enterprise.programmatic_login; import java.io.*; import java.net.*; import jakarta.annotation.security.DeclareRoles; import jakarta.servlet.*; import jakarta.servlet.http.*; @DeclareRoles("jakartaeeuser") public class LoginServlet extends HttpServlet { ``` -------------------------------- ### Build Tutorial Site Locally Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/README.md Generates the tutorial site files locally. Ensure Maven and JDK8+ are installed. The output will be in the target/staging directory. ```bash mvn generate-resources ``` -------------------------------- ### HTTP GET Request for XML Content Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxrs-advanced/jaxrs-advanced006.adoc Example HTTP request specifying the desired media type as text/xml. ```http GET /employee Accept: text/xml ``` -------------------------------- ### Resource Injection Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/injection/injection.adoc Demonstrates injecting a DataSource resource using the @Resource annotation. ```java package com.example.injection; import javax.annotation.Resource; import javax.sql.DataSource; public class DataSourceUser { @Resource(name = "jdbc/myDataSource") private DataSource myDataSource; // ... methods to use myDataSource ... } ``` -------------------------------- ### HTTP GET Request for Text Content Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxrs-advanced/jaxrs-advanced006.adoc Example HTTP request specifying the desired media type as text/plain. ```http GET /employee Accept: text/plain ``` -------------------------------- ### Build a Client Instance Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxrs-client/jaxrs-client.adoc Demonstrates how to build a client instance using the builder pattern. This is the starting point for creating any client. ```java public class ClientBuilderExample { public static void main(String[] args) { // Build a client instance Client client = ClientBuilder.newClient(); // Use the client to invoke a REST service String response = client.target("http://localhost:8080/my-service/resource") .request(MediaType.TEXT_PLAIN) .get(String.class); System.out.println("Response from service: " + response); // Close the client when done client.close(); } } ``` -------------------------------- ### HTTP Request for Query Parameters Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxrs-advanced/jaxrs-advanced001.adoc An example HTTP GET request to query employees within a specified year range using query parameters. ```http GET /employees?maxyear=2013&minyear=2003 ``` -------------------------------- ### Run Example with Valid Credentials Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/security-api/security-api005.adoc Access the deployed application with valid user credentials to test authentication and authorization. ```http http://localhost:8080/custom-identity-store/servlet?name=Joe&password=secret1 ``` -------------------------------- ### Retrieving Component Data in encodeEnd Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/faces-custom/faces-custom006.adoc In the encodeEnd method, retrieve component data such as values from a bean bound to the component. This example shows how to get an ImageArea object. ```java ImageArea ia = (ImageArea)area.getValue(); ``` -------------------------------- ### Create and Invoke Basic Client Request Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxrs-client/jaxrs-client001.adoc Demonstrates creating a Client instance, setting a target URI, specifying the media type, and invoking a GET request to retrieve a String response. ```java Client client = ClientBuilder.newClient(); String name = client.target("http://example.com/webapi/hello") .request(MediaType.TEXT_PLAIN) .get(String.class); ``` -------------------------------- ### SynchConsumer Output for Topic (New Messages) Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples003.adoc Example output from the SynchConsumer client when receiving messages from a topic after it has been started. It shows the destination type and the content of received text messages. ```shell Destination type is topic Reading message: This is message 1 from producer Reading message: This is message 2 from producer Reading message: This is message 3 from producer Messages received: 3 ``` -------------------------------- ### Add JMS Resources using asadmin Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples004.adoc This shell command adds necessary JMS resources, such as connection factories and resources, to the GlassFish Server using the `asadmin add-resources` command. This is a setup step for the durable subscription example. ```shell asadmin add-resources src/main/setup/glassfish-resources.xml ``` -------------------------------- ### Extend Method Exclusions to Application Root Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/security-advanced/security-advanced004.adoc This example extends the HTTP method exclusions (GET, POST) to include the application root ('/') along with the '/company/*' path. This ensures a broader denial of unlisted methods across the application. ```xml Deny all HTTP methods except GET and POST /company/* / GET POST ``` -------------------------------- ### Example Message Received Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples006.adoc This is an example of the output when a message is received by the websimplemessage application. ```text Reading message: Message from producer: Hello, Duke ``` -------------------------------- ### Access hello2 Example URL Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/webapp/webapp004.adoc Access the deployed hello2 web application through this URL. Ensure the context root and URL pattern are correctly specified. ```shell http://localhost:8080/hello2/greeting ``` -------------------------------- ### Example Message Sent Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples006.adoc This is an example of the output when a message is sent through the websimplemessage application. ```text Sent message: Message from producer: Hello, Duke ``` -------------------------------- ### Maven Output for hello-appclient Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxws/jaxws002.adoc Example output from the Maven execution of the hello-appclient, showing the result of the web service call. ```text --- exec-maven-plugin:1.2.1:exec (run-appclient) @ hello-appclient -- Hello, world. ``` -------------------------------- ### Example Entity Class Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/persistence-criteria/persistence-criteria002.adoc This is an example of an entity class with four persistent fields: id, name, color, and owners. ```java package com.example; ... @Entity public class Pet { @Id protected Long id; protected String name; protected String color; @ManyToOne protected Set owners; ... } ``` -------------------------------- ### Access hello1-rlc Example Application Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/faces-facelets/faces-facelets008.adoc Access the deployed application through this URL in your web browser. Ensure the GlassFish Server is running and the application is deployed. ```shell http://localhost:8080/hello1-rlc ``` -------------------------------- ### CallRecord JSON Log Entry Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/batch-processing/batch-processing009.adoc An example of a single log entry for a call record in JSON format. ```json {"datetime":"03/01/2013 04:03","from":"555-0101", "to":"555-0114","length":"03:39"} ``` -------------------------------- ### AroundTimeout Interceptor Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/interceptors/interceptors002.adoc An example of an @AroundTimeout annotated method used to intercept timeout events. It receives an InvocationContext and can be protected. ```java @AroundTimeout protected void timeoutInterceptorMethod(InvocationContext ctx) { ... } ``` -------------------------------- ### PostConstruct Lifecycle Interceptor Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/interceptors/interceptors002.adoc An example of a @PostConstruct annotated method within a target class, used for initialization after construction. ```java @PostConstruct void initialize() { ... } ``` -------------------------------- ### Managed Bean Property Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/faces-custom/faces-custom013.adoc Example of an int property within a managed bean, including getter and setter methods. ```java protected int currentOption = null; public int getCurrentOption(){...} public void setCurrentOption(int option){...} ``` -------------------------------- ### Prepare Client Request with Media Type Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxrs-client/jaxrs-client001.adoc Shows how to initiate request building by specifying the desired media type for the response using MediaType constants. ```java Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/webapi/read"); Invocation.Builder builder = myResource.request(MediaType.TEXT_PLAIN); ``` -------------------------------- ### Deploy Tutorial Site to GitHub Pages Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/README.md Manually deploys the built site to the gh-pages branch. This command requires the 'publish-site' profile to be active. Avoid direct commits to the gh-pages branch. ```bash mvn deploy -Ppublish-site ``` -------------------------------- ### PreDestroy Lifecycle Interceptor Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/interceptors/interceptors002.adoc An example of a @PreDestroy annotated method in an interceptor class, used for cleanup before destruction. It utilizes the InvocationContext. ```java @PreDestroy void cleanup(InvocationContext ctx) { ... } ``` -------------------------------- ### Build and Deploy Application using Maven Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/batch-processing/batch-processing008.adoc Builds, packages, and deploys the webserverlog application using Maven. This command is executed from the project's root directory. ```shell mvn install ``` -------------------------------- ### CPU Supplier Client Output Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples004.adoc Displays the output from the CPU supplier client, indicating successful fulfillment of CPU orders. This output demonstrates a scenario where the supplier can meet all requested quantities. ```shell CPU Supplier: Vendor ordered 4 CPU(s) CPU Supplier: Sent 4 CPU(s) CPU Supplier: Committed transaction CPU Supplier: Vendor ordered 8 CPU(s) CPU Supplier: Sent 8 CPU(s) CPU Supplier: Committed transaction ``` -------------------------------- ### Run Example with Invalid Credentials Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/security-api/security-api005.adoc Access the deployed application with invalid user credentials to test the unauthorized response. ```http http://localhost:8080/custom-identity-store/servlet?name=Joe&password=secret3 ``` -------------------------------- ### Example @AroundInvoke Interceptor Method Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/interceptors/interceptors002.adoc A concrete example of an @AroundInvoke interceptor method. This method intercepts calls to the target method and can perform actions before or after execution. ```java @AroundInvoke public void interceptOrder(InvocationContext ctx) { ... } ``` -------------------------------- ### Run Cart Example Client with appclient Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/ejb-basicexamples/ejb-basicexamples002.adoc Execute the cart application client using the 'appclient' command to interact with the deployed enterprise bean. ```shell appclient -client cart-ear/target/cart-earClient.jar ``` -------------------------------- ### Example Output from Decorator Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/cdi-adv-examples/cdi-adv-examples006.adoc This is an example of the output generated by the decorator when encoding a string. It shows the original string, the encoded string, and the length of the original string. ```text "Java" becomes "Neze", 4 characters in length ``` -------------------------------- ### hello1-rlc Application Directory Structure Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/faces-facelets/faces-facelets008.adoc Outlines the directory structure for the 'hello1-rlc' example application, showing the placement of `faces-config.xml`, `web.xml`, and the 'hello' and 'reply' resource library contracts. ```text hello1-rlc pom.xml src/main/java/ee/jakarta/tutorial/hello1rlc/Hello.java src/main/webapp WEB-INF faces-config.xml web.xml contracts hello default.css duke.handsOnHips.gif template.xhtml reply default.css duke.thumbsup.gif template.xhtml reply response.xhtml greeting.xhtml ``` -------------------------------- ### Generate Client Keystore with Keytool Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/security-advanced/security-advanced002.adoc Use this command to generate a keystore file containing a client certificate alias. Ensure you replace `java-home` with your actual Java installation path. ```shell java-home/bin/keytool -genkey -alias client-alias -keyalg RSA -keypass changeit -storepass changeit -keystore client_keystore.jks ``` -------------------------------- ### Accessing Secure Introduction Page Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/security-intro/security-intro006.adoc Use this URL to test SSL support by connecting to the secure port defined in the server deployment descriptor. Modify 'localhost' and '8181' if your server or port differs. ```text https://localhost:8181/ ``` -------------------------------- ### Flow Start Page: Input Value Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/faces-configure/faces-configure004.adoc The `simple-flow.xhtml` page, acting as the flow's start node, prompts for a value and navigates to the next page. ```xml

Value:

``` -------------------------------- ### Job Start and End Logging Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/batch-processing/batch-processing008.adoc Implements a simple listener that logs messages when a batch job starts and ends. Requires the @Dependent and @Named annotations. ```java @Dependent @Named("InfoJobListener") public class InfoJobListener implements JobListener { ... @Override public void beforeJob() throws Exception { logger.log(Level.INFO, "The job is starting"); } @Override public void afterJob() throws Exception { ... } } ``` -------------------------------- ### Retailer Client Output Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples004.adoc Illustrates the expected output from the Retailer client, showing successful and unsuccessful order fulfillment. This output helps in understanding the client's transactional behavior. ```shell Retailer: Quantity to be ordered is 4 Retailer: Ordered 4 computer(s) Retailer: Order filled Retailer: Placing another order Retailer: Ordered 8 computer(s) Retailer: Order not filled ``` -------------------------------- ### Example Global JNDI Name for a Bean in a WAR Module Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/ejb-intro/ejb-intro004.adoc This example shows an equivalent JNDI name for `MyBean` in `myApp.war` using the `java:global` namespace. ```text java:global/myApp/MyBean ``` -------------------------------- ### Database Identity Store Setup Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/security-api/security-api004.adoc This Java code snippet shows how to initialize the `DatabaseIdentityStore` by defining users, passwords, and group memberships. It uses a singleton enterprise bean with `@Startup` annotation to execute during application startup, populating the database with caller information and group assignments. ```java import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; import jakarta.annotation.Resource; import jakarta.annotation.sql.DataSourceDefinition; import jakarta.ejb.Singleton; import jakarta.ejb.Startup; import jakarta.sql.DataSource; @Singleton @Startup public class DatabaseSetup { // The default datasource that is bundled with GlassFish is used to store // credentials. @Resource(lookup="java:comp/DefaultDataSource") private DataSource dataSource; @PostConstruct public void init() { // ... executeUpdate(dataSource, "INSERT INTO caller VALUES('Joe', '" + passwordHash.generate("secret1".toCharArray()) + "')"); // ... executeUpdate(dataSource, "INSERT INTO caller_groups VALUES('Joe', 'foo')"); executeUpdate(dataSource, "INSERT INTO caller_groups VALUES('Joe', 'bar')"); // ... } @PreDestroy public void destroy() { // ... } private void executeUpdate(DataSource dataSource, String query) { // ... } } ``` -------------------------------- ### Invoking GET Request Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxrs-client/jaxrs-client001.adoc Perform an HTTP GET request to a REST resource and retrieve the response as a String. Ensure the client and target resource are properly initialized. ```java Client client = ClientBuilder.newClient(); WebTarget myResource = client.target("http://example.com/webapi/read"); String response = myResource.request(MediaType.TEXT_PLAIN) .get(String.class); ``` -------------------------------- ### Navigate to AsynchConsumer Directory Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jms-examples/jms-examples003.adoc This shell command changes the current directory to the asynchconsumer example's build output directory. This is a prerequisite for running the client. ```shell cd tut-install/jms/simple/asynchconsumer ``` -------------------------------- ### Maven Command to Clean and Install Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/cdi-adv-examples/cdi-adv-examples002.adoc This shell command cleans the project, builds it, and installs the artifact. It is used after making changes to configuration files like beans.xml. ```shell mvn clean install ``` -------------------------------- ### JPQL IN Expression Example Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/persistence-querylanguage/persistence-querylanguage006.adoc Illustrates the JPQL IN expression to check if a string or numeric value is present within a set of literals. The example shows a condition for country codes. ```sql o.country IN ('UK', 'US', 'France') ``` -------------------------------- ### Default Resource Bundle Properties Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/webi18n/webi18n002.adoc Example lines from a default resource bundle properties file, defining key-value pairs for localized strings. ```properties TitleShoppingCart=Shopping Cart TitleReceipt=Receipt TitleBookCatalog=Book Catalog TitleCashier=Cashier TitleBookDescription=Book Description Visitor=You are visitor number What=What We\'re Reading ``` -------------------------------- ### Configure Client Properties Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxrs-client/jaxrs-client.adoc Shows how to configure client properties, such as connection timeouts, when building a client instance. This allows for fine-tuning client behavior. ```java public class ClientBuilderWithPropertiesExample { public static void main(String[] args) { // Build a client instance with custom properties Client client = ClientBuilder.newBuilder() .property(ClientProperties.CONNECT_TIMEOUT, 5000) // 5 seconds .property(ClientProperties.READ_TIMEOUT, 10000) // 10 seconds .build(); // Use the client to invoke a REST service String response = client.target("http://localhost:8080/my-service/resource") .request(MediaType.TEXT_PLAIN) .get(String.class); System.out.println("Response from service: " + response); // Close the client when done client.close(); } } ``` -------------------------------- ### Example Amount Input for Bill Payment Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/cdi-adv-examples/cdi-adv-examples005.adoc This is an example of a valid amount that can be entered in the Amount field. The amount can contain up to 10 digits and include up to two decimal places. ```plaintext 9876.54 ``` -------------------------------- ### Launch Update Tool via Command Line Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/usingexamples/usingexamples008.adoc Use this command to open the Update Tool from the terminal to manage tutorial updates. ```bash updatetool ``` -------------------------------- ### Set Path and Query Parameters for Client Request Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxrs-client/jaxrs-client001.adoc Illustrates setting path parameters using resolveTemplate and adding query parameters using queryParam to construct a target URI for a client request. ```java WebTarget myResource = client.target("http://example.com/webapi/read") .path("{userName}") .resolveTemplate("userName", "janedoe") .queryParam("chapter", "1"); // http://example.com/webapi/read/janedoe?chapter=1 Response response = myResource.request(...).get(); ``` -------------------------------- ### Invoking GET Request for a Collection Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/jaxrs-client/jaxrs-client001.adoc Retrieve a collection of objects (e.g., List) from a REST resource using a GET request. Use GenericType for collection response types. ```java List orders = client.target("http://example.com/webapi/read") .path("allOrders") .request(MediaType.APPLICATION_XML) .get(new GenericType>() {}); ``` -------------------------------- ### Example cURL Request for Unauthorized Access Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/security-api/security-api005.adoc Demonstrates a cURL command to test the custom identity store example, showing an unauthorized access attempt and the resulting HTTP response headers. ```shell curl -I -u Joe http://localhost:8080/custom-identity-store/servlet Enter host password for user 'Joe': HTTP/1.1 401 Unauthorized Server: Eclipse GlassFish 6.0.0 X-Powered-By: Servlet/5.0 JSP/3.0(Eclipse GlassFish 6.0.0 Java/AdoptOpenJDK/1.8) WWW-Authenticate: Basic realm="file" Content-Length: 1056 Content-Language: Content-Type: text/html ``` -------------------------------- ### Running dukeetf2 with NetBeans IDE Source: https://github.com/eclipse-ee4j/jakartaee-tutorial/blob/master/src/main/asciidoc/websocket/websocket011.adoc Builds and deploys the dukeetf2 application, then launches a browser to the application URL. Open the same URL in another tab to observe simultaneous updates. ```shell http://localhost:8080/dukeetf2/ ```