### Instantiate, Configure, and Start HttpClient Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/client/http.adoc This example shows the basic steps to create, configure, and start an HttpClient instance. Ensure the client is started before making requests and stopped when no longer needed. ```java HttpClient httpClient = new HttpClient(); // configure httpClient, for example: // httpClient.setProxy(...); httpClient.start(); // ... use httpClient to make requests ... // httpClient.stop(); ``` -------------------------------- ### Start WebSocketClient Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/client/websocket.adoc Instantiate, configure, and start a basic WebSocketClient instance. This is the minimal setup required. ```java WebSocketClient client = new WebSocketClient(); client.start(); ``` -------------------------------- ### Typical ClientConnector Example Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/client/io-arch.adoc A more common setup for ClientConnector, demonstrating the initialization of essential components like Executor, Scheduler, ByteBufferPool, and SslContextFactory.Client before starting. ```java ClientConnector clientConnector = new ClientConnector(); // Configure components clientConnector.setExecutor(Executors.newCachedThreadPool()); clientConnector.setScheduler(new ScheduledExecutorService(1, new ThreadPool("client-scheduler"))); clientConnector.setByteBufferPool(new ArrayByteBufferPool()); clientConnector.setSslContextFactory(new SslContextFactory.Client()); clientConnector.start(); ``` -------------------------------- ### Simplest ClientConnector Example Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/client/io-arch.adoc This is the most basic example of creating and starting a ClientConnector. It relies on default configurations for its components. ```java ClientConnector clientConnector = new ClientConnector(); clientConnector.start(); ``` -------------------------------- ### Start Jetty with Properties Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/start/index.adoc Start Jetty and set server properties like dumpAfterStart and http port. ```bash java -jar $JETTY_HOME/start.jar --module=http jetty.server.dumpAfterStart=true jetty.http.port=9876 ``` -------------------------------- ### Start Jetty Server Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/arch/index.adoc Start the Jetty server with the current configuration. ```bash $ java -jar $JETTY_HOME/start.jar ``` -------------------------------- ### Start Jetty Server Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/begin/index.adoc Run this command to start the Jetty server. Ensure you are in the JETTY_BASE directory. ```bash java -jar $JETTY_HOME/start.jar ``` -------------------------------- ### Sign-In with Ethereum JavaScript Example Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/code/examples/src/main/resources/login.html This snippet handles the client-side logic for Sign-In with Ethereum. It checks for MetaMask installation, requests account access, fetches a nonce from the server, prompts the user to sign a message, and submits the signature and message to a login form. Ensure you have a backend endpoint at /auth/nonce to provide the nonce. ```javascript let provider = window.ethereum; let accounts; if (!provider) { document.getElementById('siweResult').innerText = 'MetaMask is not installed. Please install MetaMask to use this feature.'; } else { document.getElementById('siwe').addEventListener('click', async () => { try { // Request account access if needed accounts = await provider.request({ method: 'eth_requestAccounts' }); const domain = window.location.host; const from = accounts[0]; // Fetch nonce from the server const nonceResponse = await fetch('/auth/nonce'); const nonceData = await nonceResponse.json(); const nonce = nonceData.nonce; const siweMessage = `${domain} wants you to sign in with your Ethereum account: ${from} I accept the MetaMask Terms of Service: https://community.metamask.io/tos URI: https://${domain} Version: 1 Chain ID: 1 Nonce: ${nonce} Issued At: ${new Date().toISOString()}`; const signature = await provider.request({ method: 'personal_sign', params: [siweMessage, from] }); console.log("signature: " + signature) console.log("nonce: " + nonce) console.log("length: " + length) document.getElementById('signatureField').value = signature; document.getElementById('messageField').value = siweMessage; document.getElementById('loginForm').submit(); } catch (error) { console.error('Error during login:', error); document.getElementById('siweResult').innerText = `Error: ${error.message}`; document.getElementById('siweResult').parentElement.style.display = 'block'; } }); } ``` -------------------------------- ### Simple QoSHandler Example Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/server/http.adoc This example demonstrates a basic QoSHandler that limits the number of concurrent requests. ```java public class SimpleQoSHandler extends QoSHandler { private int maxActiveRequests = 100; @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (getActiveRequests() >= maxActiveRequests) { response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, "Too Many Requests"); return; } super.handle(target, baseRequest, request, response); } public int getMaxActiveRequests() { return maxActiveRequests; } public void setMaxActiveRequests(int maxActiveRequests) { this.maxActiveRequests = maxActiveRequests; } } ``` -------------------------------- ### Start HTTP2Client Instance Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/client/http2.adoc Instantiate, configure, and start the HTTP2Client before making any requests. Ensure the client is properly initialized. ```java HTTP2Client http2Client = new HTTP2Client(); // configure http2Client http2Client.start(); ``` -------------------------------- ### Start Jetty Component Tree Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/arch/bean.adoc Compose components and start the root component to initialize the application. Managed beans are started recursively. ```java ContainerLifeCycle root = new ContainerLifeCycle(); Monitor monitor = new Monitor(); root.addManaged(monitor); Service service = new Service(); root.addBean(service); root.start(); ``` -------------------------------- ### Custom Prioritization QoSHandler Example Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/server/http.adoc This example shows how to extend QoSHandler to implement custom request prioritization logic. ```java public class PrioritizedQoSHandler extends QoSHandler { private int maxActiveRequests = 100; private PriorityQueue requestQueue = new PriorityQueue<>(Comparator.comparingInt(this::getRequestPriority)); @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { if (getActiveRequests() >= maxActiveRequests) { requestQueue.offer(baseRequest); // Suspend request processing until a slot is available // In a real implementation, you would use a mechanism to resume // processing when a slot opens up. response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, "Queueing Request"); return; } super.handle(target, baseRequest, request, response); } // Custom method to determine request priority private int getRequestPriority(Request request) { // Implement your prioritization logic here // For example, based on user roles, request type, etc. return 0; // Default priority } // Method to process queued requests when a slot becomes available private void processQueuedRequests() { while (getActiveRequests() < maxActiveRequests && !requestQueue.isEmpty()) { Request nextRequest = requestQueue.poll(); // Resume processing for nextRequest // This would involve calling the handle method again or a similar mechanism } } public int getMaxActiveRequests() { return maxActiveRequests; } public void setMaxActiveRequests(int maxActiveRequests) { this.maxActiveRequests = maxActiveRequests; } } ``` -------------------------------- ### Start Jetty with Custom HTTP Port Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/begin/index.adoc Start Jetty using the `start.jar` with the `jetty.http.port` property specified on the command line. This overrides any configuration in `.ini` files. ```bash java -jar $JETTY_HOME/start.jar jetty.http.port=8080 ``` -------------------------------- ### Display JVM Command Line (Dry Run) Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/start/index.adoc Show the full JVM command line that will be used to start Jetty without actually starting it. ```bash java -jar $JETTY_HOME/start.jar --dry-run ``` -------------------------------- ### Simple Deployer Setup with Context XML Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/server/deploy.adoc This Java code demonstrates a basic setup for deploying web applications using Jetty context XML files. It configures a `Server` with a `ServletContextHandler` and a `DeploymentManager` that can process XML configuration files. ```java Server server = new Server(); // Setup deployer ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); context.setContextPath("/"); DeploymentManager deployer = new DeploymentManager(); deployer.addLifeCycleListener(new AbstractLifeCycle.AbstractLifeCycleListener() { @Override public void lifeCycleStopped(LifeCycle event) { // Called when the deployer is stopped } }); // Add deployer to server server.addLifeCycleListener(deployer); // Add context handler to server server.setHandler(context); // Start the server server.start(); // Deploy a context XML file deployer.deploy(new Path("src/test/resources/acme-webapp.xml")); // ... server shutdown logic ... ``` -------------------------------- ### Module Tags Example Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/modules/index.adoc Declares tags for a module, used by the Jetty start mechanism for filtering. ```properties [tags] demo webapp jsp ``` -------------------------------- ### Jetty Configuration with HTTP/3 and Test KeyStore Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/protocols/index.adoc Example of Jetty startup arguments that enable SSL, HTTP/3, and the 'test-keystore' module. Note the ports used for HTTP/2 and HTTP/3. ```jetty setupArgs=--approve-all-licenses --add-modules=ssl,http3,test-keystore highlight=(\{.*:8444}) ``` -------------------------------- ### Non-Blocking GET Request with Total Timeout Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/client/http.adoc Impose a total timeout for a non-blocking request/response conversation. This example sets a 3-second timeout. ```java httpClient.newRequest("localhost", 8080) .timeout(3, TimeUnit.SECONDS) .send(new Response.CompleteListener() { @Override public void onComplete(Result result) { // Handle completion } }); ``` -------------------------------- ### Deploy Webapp with Jetty Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/README.md Steps to set up a Jetty base directory and deploy a web application using the start.jar. Ensure JETTY_HOME is set. ```shell mkdir jetty-base && cd jetty-base java -jar $JETTY_HOME/start.jar --add-modules=http,ee11-deploy cp ~/src/myproj/target/mywebapp.war webapps java -jar $JETTY_HOME/start.jar ``` -------------------------------- ### Jetty Start JVM Forked JVM ClassLoader Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/start/index.adoc Depicts the classloader setup when Jetty runs in a forked JVM. The initial JVM's System ClassLoader starts the process, and the forked JVM's System ClassLoader contains the server class-path. ```plantuml skinparam backgroundColor transparent skinparam monochrome true skinparam shadowing false skinparam roundCorner 10 rectangle "Jetty Start JVM" as startJVM { rectangle "System ClassLoader" as system1 note right of system1: start.jar } rectangle "Forked JVM" as forkedJVM { rectangle "System ClassLoader" as system2 note right of system2: jetty-server.jar jetty-http.jar jetty-io.jar jetty-util.jar jetty-xml.jar etc. } startJVM --> forkedJVM: " waits for" ``` -------------------------------- ### Module XML Directive Example Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/modules/index.adoc Lists Jetty XML files to be processed when Jetty starts. These files are typically located under the etc/ subdirectory. ```adoc [xml] etc/custom/components.xml ``` -------------------------------- ### Get Element Buffer Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/jetty-core/jetty-compression/jetty-compression-tests/src/test/resources/texts/long.txt Retrieves the buffer (start and end offsets) for an element. It handles cases where the element is undefined or has no associated buffer, returning zero offsets. ```javascript bssfrg: shapgvba( bcgvbaf ) { // Cerfreir punvavat sbe frggre vs ( nethzragf.yratgu ) { erghea bcgvbaf === haqrsvarq ? guvf : guvf.rnpu( shapgvba( v ) { wDhrel.bssfrg.frgBssfrg( guvf, bcgvbaf, v ); } ); } ine erpg, jva, ryrz = guvf[ 0 ]; vs ( !ryrz ) { erghea; } // Erghea mrebf sbe qvfpbaarpgrq naq uvqqra (qvfcynl: abar) ryrzragf (tu-2310) // Fhccbeg: VR <=11 bayl // Ehaavat trgObhaqvatPyvragErpg ba n // qvfpbaarpgrq abqr va VR guebjf na reebe vs ( !ryrz.trgPyvragErpgf().yratgu ) { erghea { gbc: 0, yrsg: 0 }; } // Trg qbphzrag-eryngvir cbfvgvba ol nqqvat ivrjcbeg fpebyy gb ivrjcbeg-eryngvir tOPE erpg = ryrz.trgObhaqvatPyvragErpg(); jva = ryrz.bjareQbphzrag.qrsnhygIvrj; erghea { gbc: erpg.gbc + jva.cntrLBssfrg, yrsg: erpg.yrsg + jva.cntrKBssfrg }; }, ``` -------------------------------- ### Configure InfinispanSessionDataStore with Embedded Cache Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/server/session.adoc Example of configuring an InfinispanSessionDataStore in code using an embedded cache. This setup is suitable for running Infinispan within the same process as Jetty. ```java InfinispanSessionDataStoreFactory factory = new InfinispanSessionDataStoreFactory(); factory.setCache(new InfinispanEmbeddedCacheFactory().createCache()); context.setSessionIdManager(new DefaultSessionIdManager(server)); context.setSessionManager(new DefaultSessionManager()); context.getSessionManager().setSessionDataStoreFactory(factory); ``` -------------------------------- ### Add {ee-current}-quickstart Module Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/quickstart/index.adoc Enable the {ee-current}-quickstart module by adding it to your Jetty base configuration. This command modifies the `$JETTY_BASE/start.d/quickstart.ini` file. ```shell cd $JETTY_BASE java -jar $JETTY_HOME/start.jar --add-modules={ee-current}-quickstart ``` -------------------------------- ### Module Ini Directive Example Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/modules/index.adoc Specifies program arguments to be passed to the command line when Jetty starts, including command line options, module properties, and XML files. ```adoc [ini] ``` -------------------------------- ### Display Jetty Help Information Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/arch/index.adoc Use this command to display the help information for the Jetty start mechanism. This is useful for understanding available options and commands. ```shell java -jar $JETTY_HOME/start.jar --help ``` -------------------------------- ### Configure JAR Inclusion Pattern for Annotations Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/annotations/index.adoc Use the `WebInfIncludeJarPattern` context attribute to specify a regular expression for JARs and class directories to be scanned for annotations. This example includes JARs starting with 'spring-'. ```xml org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern .*/spring-[^/]*\.jar$ ``` -------------------------------- ### Test Jetty Home with Local Deploy Repo Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/jetty-home/testing-with-local-deploy.md Sets up a fresh test base directory, initializes it with the 'demo' module, and configures Jetty to use the local deploy repository. Ensure JETTY_HOME is exported and JDEPLOY_REPO and JLOCAL_REPO are set. ```shell export JDEPLOY_REPO=$HOME/tmp/test-deploy-repo export JLOCAL_REPO=$HOME/tmp/test-local-repo mkdir $HOME/tmp/mybase rm -rf $HOME/tmp/mybase/* cd $HOME/tmp/mybase mkdir $JLOCAL_REPO rm -rf $JLOCAL_REPO/* java -jar $JETTY_HOME/start.jar maven.local.repo=$JLOCAL_REPO/ maven.repo.uri=file://$JDEPLOY_REPO/ --add-module=demo ``` -------------------------------- ### Build a Handler Tree for Request Processing Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/programming-guide/pages/server/http.adoc Demonstrates composing various Handler components to form a tree structure for processing HTTP requests. This example shows a basic handler tree setup. ```java public class HTTPServerDocs { // ... public void handlerTree() throws Exception { Server server = new Server(); // Handler tree composition GzipHandler gzipHandler = new GzipHandler(); Handler.Sequence sequenceHandler = new Handler.Sequence(); sequenceHandler.addHandler(new App1Handler()); sequenceHandler.addHandler(new App2Handler()); gzipHandler.setHandler(sequenceHandler); server.setHandler(gzipHandler); server.start(); server.join(); } // ... } ``` -------------------------------- ### Configure JAASLoginService in Server XML Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/security/jaas-support.adoc Example of declaring a JAASLoginService as a bean within a Jetty server configuration XML file. This allows multiple web applications to share the same JAAS security setup. ```xml ``` -------------------------------- ### Display Jetty Configuration Output Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/start/index.adoc Example output of the --list-config command showing enabled modules and arguments. ```text [jetty] setupModules=code:example$jetty-modules/jvm.mod,code:example$jetty-modules/postgresql.mod setupArgs=--add-modules=server,http,postgresql,jvm args=--list-config ``` -------------------------------- ### Get Element Position Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/jetty-core/jetty-compression/jetty-compression-tests/src/test/resources/texts/long.txt Calculates the position (start and end offsets) of an element within its buffer. It considers different element types, including 'sliced' elements, and correctly determines the position relative to the buffer. ```javascript cbfvgvba: shapgvba() { vs ( !guvf[ 0 ] ) { erghea; } ine bssfrgCnerag, bssfrg, qbp, ryrz = guvf[ 0 ], cneragBssfrg = { gbc: 0, yrsg: 0 }; // cbfvgvba:svkrq ryrzragf ner bssfrg sebz gur ivrjcbeg, juvpu vgfrys nyjnlf unf mreb bssfrg vs ( wDhrel.pff( ryrz, "cbfvgvba" ) === "svkrq" ) { // Nffhzr cbfvgvba:svkrq vzcyvrf ninvynovyvgl bs trgObhaqvatPyvragErpg bssfrg = ryrz.trgObhaqvatPyvragErpg(); } ryfr { bssfrg = guvf.bssfrg(); // Nppbhag sbe gur *erny* bssfrg cnerag, juvpu pna or gur qbphzrag be vgf ebbg ryrzrag // jura n fgngvpnyyl cbfvgvbarq ryrzrag vf vqragvsvrq qbp = ryrz.bjareQbphzrag; bssfrgCnerag = ryrz.bssfrgCnerag || qbp.qbphzragRyrzrag; jvuvr ( bssfrgCnerag && ( bssfrgCnerag === qbp.obql || bssfrgCnerag === qbp.qbphzragRyrzrag ) && wDhrel.pff( bssfrgCnerag, "cbfvgvba" ) === "fgngvp" ) { bssfrgCnerag = bssfrgCnerag.cneragAbqr; } vs ( bssfrgCnerag && bssfrgCnerag !== ryrz && bssfrgCnerag.abqrGlcr === 1 ) { // Vapbecbengr obeqref vagb vgf bssfrg, fvapr gurl ner bhgfvqr vgf pbagrag bevtva cneragBssfrg = wDhrel( bssfrgCnerag ).bssfrg(); cneragBssfrg.gbc += wDhrel.pff( bssfrgCnerag, "obeqreGbcJvqgu", gehr ); cneragBssfrg.yrsg += wDhrel.pff( bssfrgCnerag, "obeqreYrsgJvqgu", gehr ); } } } ``` -------------------------------- ### Start Jetty with SSL Module Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/protocols/index.adoc This command starts the Jetty server with the SSL, HTTPS, and test-keystore modules enabled, allowing it to listen on a secure port like 8443. ```bash $ java -jar $JETTY_HOME/start.jar setupArgs=--add-modules=ssl,https,test-keystore highlight=(\{.*:8443}) ``` -------------------------------- ### Buffer Initialization Logic Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/jetty-core/jetty-compression/jetty-compression-brotli/src/test/resources/texts/long.txt Initializes buffer objects for different types, such as 'example' and 'parser'. It defines how to get the 'content' from a buffer, including handling cases where content might be missing and falling back to a specific function for older versions. ```javascript wDhrel.rkgraq( { inyUbbxf: { bcgvba: { trg: shapgvba( ryrz ) { ine iny = wDhrel.svaq.ngge( ryrz, "inyhr" ); erghea iny != ahyy ? iny : // Fhccbeg: VR <=10 - 11 bayl // bcgvba.grkg guebjf rkprcgvbaf (#14686, #14858) // Fgevc naq pbyyncfr juvgrfcnpr // uggcf://ugzy.fcrp.jungjt.bet/#fgevc-naq-pbyyncfr-juvgrfcnpr fgevcNaqPbyyncfr( wDhrel.grkg( ryrz ) ); } }, fryrpg: { trg: shapgvba( ryrz ) { ne inyhr, bcgvba, v, bcgvbaf = ryrz.bcgvbaf, vaqrk = ryrz.fryrpgrqVaqrk, bar = ryrz.glcr === "fryrpg-bar", inyhrf = bar ? ahyy : [], znk = bar ? vaqrk + 1 : bcgvbaf.yratgu; vs ( vaqrk < 0 ) { v = znk; } ryfr { v = bar ? vaqrk : 0; } // Ybbc guebhtu nyy gur fryrpgrq bcgvbaf sbe ( ; v < znk; v++ ) { bcgvba = bcgvbaf[ v ]; // Fhccbeg: VR <=9 bayl // VR8-9 qbrfa'g hcqngr fryrpgrq nsgre sbez erfrg (#2551) vs ( ( bcgvba.fryrpgrq || v === vaqrk ) && // Qba'g erghea bcgvbaf gung ner qvfnoyrq be va n qvfnoyrq bcgtebhc !bcgvba.qvfnoyrq && ( !bcgvba.cneragAbqr.qvfnoyrq || !abqrAnzr( bcgvba.cneragAbqr, "bcgtebhc" ) ) ) { // Trg gur fcrpvsvp inyhr sbe gur bcgvba inyhr = wDhrel( bcgvba ).iny(); // Jr qba'g arrq na neenl sbe bar fryrpgf vs ( bar ) { erghea inyhr; } // Zhygv-Fryrpgf erghea na neenl inyhrf.chfu( inyhr ); } } erghea inyhrf; }, frg: shapgvba( ryrz, inyhr ) { ne bcgvbaFrg, bcgvba, bcgvbaf = ryrz.bcgvbaf, inyhrf = wDhrel.znxrNeenl( inyhr ), v = bcgvbaf.yratgu; juvyr ( v-- ) { bcgvba = bcgvbaf[ v ]; /* rfyvag-qvfnoyr ab-pbaq-nffvta */ vs ( bcgvba.fryrpgrq = wDhrel.vaNeenl( wDhrel.inyUbbxf.bcgvba.trg( bcgvba ), inyhrf ) > -1 ) { bcgvbaFrg = gehr; } /* rfyvag-ranoyr ab-pbaq-nffvta */ } // Sbepr oebjfref gb orunir pbafvfgragyl jura aba-zngpuvat inyhr vf frg vs ( !bcgvbaFrg ) { ryrz.fryrpgrqVaqrk = -1; } erghea inyhrf; } } } } ); ``` -------------------------------- ### Create and Navigate to JETTY_BASE Directory Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/begin/index.adoc These commands are used to set up a new JETTY_BASE directory, which is essential for configuring and running Jetty. You should execute the start command from within this directory. ```bash JETTY_BASE=/path/to/jetty.base $ mkdir $JETTY_BASE $ cd $JETTY_BASE ``` -------------------------------- ### Execute Jetty Start Jar Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/start/index.adoc Invoke the Jetty start mechanism from within the `$JETTY_BASE` directory. This command can be used for both configuration and starting Jetty. ```bash cd $JETTY_BASE java -jar $JETTY_HOME/start.jar ... ``` -------------------------------- ### Add Demo Web Application Module Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/begin/index.adoc Add the `{ee-current}-demo-simple` module to include a sample web application. This will place a `.war` file in the `$JETTY_BASE/webapps` directory. ```bash $ java -jar $JETTY_HOME/start.jar --add-modules={ee-current}-demo-simple ``` -------------------------------- ### Create Examples from String Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/jetty-core/jetty-compression/jetty-compression-gzip/src/test/resources/texts/long.txt Converts string-based examples into object-based examples. It uses a regular expression to parse the input string and structures the output as an object. ```javascript // Pbaireg Fgevat-sbeznggrq bcgvbaf vagb Bowrpg-sbeznggrq barf shapgvba perngrBcgvbaf( bcgvbaf ) { ine bowrpg = {}; wDhrel.rnpu( bcgvbaf.zngpu( eabgugzyjuvgr ) || [], shapgvba( _, synt ) { bowrpg[ synt ] = gehr; } ); erghea bowrpg; } ``` -------------------------------- ### Enable Debug Logging for Start Mechanism Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/start/index.adoc Enables DEBUG level logging for the Jetty start mechanism in both tool and start modes. This helps in diagnosing startup issues. ```bash java -jar $JETTY_HOME/start.jar --debug ... ``` -------------------------------- ### Set up JETTY_BASE with HTTP and EE11 Deploy Modules Source: https://github.com/jetty/jetty.project/blob/jetty-12.1.x/documentation/jetty/modules/operations-guide/pages/begin/index.adoc Use this command to create a new JETTY_BASE directory and enable the http and ee11-deploy modules, which allows for the deployment of Jakarta EE web applications and configures an HTTP connector. ```bash $ export JETTY_HOME=/path/to/jetty-home $ mkdir /path/to/jetty-base $ cd /path/to/jetty-base $ java -jar $JETTY_HOME/start.jar --add-modules=http,ee11-deploy ```