| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>Persistent Sessions: Google Cloud DataStore</title><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><meta name="keywords" content="jetty, servlet, servlet-api, cometd, http, websocket, eclipse, maven, java, server, software"><link rel="home" href="index.html" title="Jetty"><link rel="up" href="session-management.html" title="Chapter 10. Session Management"><link rel="prev" href="configuring-sessions-hazelcast.html" title="Persistent Sessions: Hazelcast"><link rel="next" href="session-configuration-memcachedsessiondatastore.html" title="Persistent Sessions: The L2 Session Data Cache"><link xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" rel="shortcut icon" href="images/favicon.ico"><link rel="stylesheet" href="css/highlighter/foundation.css"><script src="js/highlight.pack.js"></script><script> |
| hljs.initHighlightingOnLoad(); |
| </script><link type="text/css" rel="stylesheet" href="css/font-awesome/font-awesome.min.css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><tr><td style="width: 25%"><a href="http://www.eclipse.org/jetty"><img src="images/jetty-header-logo.png" alt="Jetty Logo"></a><br><span style="font-size: small"> |
| Version: 9.4.28-SNAPSHOT</span></td><td style="width: 50%"></td></tr></table><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Persistent Sessions: Google Cloud DataStore</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="configuring-sessions-hazelcast.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a> </td><th width="60%" align="center">Chapter 10. Session Management<br><a accesskey="p" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></th><td width="20%" align="right"> <a accesskey="n" href="session-configuration-memcachedsessiondatastore.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr></table><hr></div><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="jetty-callout"><h5 class="callout"><a href="http://www.webtide.com/">Contact the core Jetty developers at |
| <span class="website">www.webtide.com</span></a></h5><p> |
| private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... |
| scalability guidance for your apps and Ajax/Comet projects ... development services for sponsored feature development |
| </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="configuring-sessions-gcloud"></a>Persistent Sessions: Google Cloud DataStore</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="configuring-sessions-gcloud.html#_preparation">Preparation</a></span></dt><dt><span class="section"><a href="configuring-sessions-gcloud.html#_configuring_indexes_for_session_data">Configuring Indexes for Session Data</a></span></dt><dt><span class="section"><a href="configuring-sessions-gcloud.html#_enabling_the_google_cloud_datastore_module">Enabling the Google Cloud DataStore Module</a></span></dt><dt><span class="section"><a href="configuring-sessions-gcloud.html#_configuring_gcloud_session_properties">Configuring GCloud Session Properties</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_preparation"></a>Preparation</h3></div></div></div><p>You will first need to create a project and enable the Google Cloud api: <a class="link" href="https://cloud.google.com/docs/authentication#preparation" target="_top">https://cloud.google.com/docs/authentication#preparation</a>. |
| Take note of the project id that you create in this step as you need to supply it in later steps.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_communicating_with_gclouddatastore"></a>Communicating with GCloudDataStore</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_when_running_jetty_outside_of_google_infrastructure"></a>When running Jetty outside of google infrastructure</h5></div></div></div><p>Before running Jetty, you will need to choose one of the following methods to set up the local environment to enable remote GCloud DataStore communications.</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p class="simpara">Using the GCloud SDK:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Ensure you have the GCloud SDK installed: <a class="link" href="https://cloud.google.com/sdk/?hl=en" target="_top">https://cloud.google.com/sdk/?hl=en</a>.</li><li class="listitem">Use the GCloud tool to set up the project you created in the preparation step: <code class="literal">gcloud config set project PROJECT_ID</code></li><li class="listitem">Use the GCloud tool to authenticate a google account associated with the project created in the preparation step: <code class="literal">gcloud auth login ACCOUNT</code></li></ul></div></li><li class="listitem"><p class="simpara">Using environment variables</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Define the environment variable <code class="literal">GCLOUD_PROJECT</code> with the project id you created in the preparation step.</li><li class="listitem">Generate a JSON <a class="link" href="https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts" target="_top">service account key</a> and then define the environment variable <code class="literal">GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/key.json</code></li></ul></div></li></ol></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="_when_running_jetty_inside_of_google_infrastructure"></a>When Running Jetty Inside of Google Infrastructure</h5></div></div></div><p>The Google deployment tools will automatically configure the project and authentication information for you.</p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_configuring_indexes_for_session_data"></a>Configuring Indexes for Session Data</h3></div></div></div><p>Using some special, composite indexes can speed up session search operations, although it may make write operations slower. |
| By default, indexes will not be used. |
| In order to use them, you will need to manually upload a file that defines the indexes. |
| This file is named <code class="literal">index.yaml</code> and you can find it in your distribution in <code class="literal">${jetty.base}/etc/sessions/gcloud/index.yaml</code>.</p><p>Follow the instructions <a class="link" href="https://cloud.google.com/datastore/docs/tools/#the_development_workflow_using_gcloud" target="_top">here</a> to upload the pre-generated <code class="literal">index.yaml</code> file.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_communicating_with_the_gclouddatastore_emulator"></a>Communicating with the GCloudDataStore Emulator</h4></div></div></div><p>To enable communication using the GCloud Emulator:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Ensure you have the GCloud SDK installed: <a class="link" href="https://cloud.google.com/sdk/?hl=en" target="_top">https://cloud.google.com/sdk/?hl=en</a></li><li class="listitem">Follow the instructions <a class="link" href="https://cloud.google.com/datastore/docs/tools/datastore-emulator" target="_top">here</a> on how to start the GCloud datastore emulator, and how to propagate the environment variables that it creates to the terminal in which you run Jetty.</li></ul></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_enabling_the_google_cloud_datastore_module"></a>Enabling the Google Cloud DataStore Module</h3></div></div></div><p>When using the Jetty distribution, you will first need to enable the <code class="literal">session-store-gcloud</code> <a class="link" href="startup-modules.html" title="Managing Startup Modules">module</a> for your <a class="link" href="startup-base-and-home.html" title="Managing Jetty Base and Jetty Home">Jetty base</a> using the <code class="literal">--add-to-start</code> argument on the command line.</p><div class="screenexample"><pre class="screen">$ java -jar ../start.jar --create-startd |
| INFO : Base directory was modified |
| |
| $ java -jar ../start.jar --add-to-start=session-store-gcloud |
| |
| ALERT: There are enabled module(s) with licenses. |
| The following 2 module(s): |
| + contains software not provided by the Eclipse Foundation! |
| + contains software not covered by the Eclipse Public License! |
| + has not been audited for compliance with its license |
| |
| Module: gcloud |
| + GCloudDatastore is an open source project hosted on Github and released under the Apache 2.0 license. |
| + https://github.com/GoogleCloudPlatform/gcloud-java |
| + http://www.apache.org/licenses/LICENSE-2.0.html |
| |
| Module: slf4j-api |
| + SLF4J is distributed under the MIT License. |
| + Copyright (c) 2004-2013 QOS.ch |
| + All rights reserved. |
| + Permission is hereby granted, free of charge, to any person obtaining |
| + a copy of this software and associated documentation files (the |
| + "Software"), to deal in the Software without restriction, including |
| + without limitation the rights to use, copy, modify, merge, publish, |
| + distribute, sublicense, and/or sell copies of the Software, and to |
| + permit persons to whom the Software is furnished to do so, subject to |
| + the following conditions: |
| + The above copyright notice and this permission notice shall be |
| + included in all copies or substantial portions of the Software. |
| + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| |
| Proceed (y/N)? y |
| INFO : webapp transitively enabled, ini template available with --add-to-start=webapp |
| INFO : jul-impl transitively enabled |
| INFO : server transitively enabled, ini template available with --add-to-start=server |
| INFO : sessions transitively enabled, ini template available with --add-to-start=sessions |
| INFO : servlet transitively enabled |
| INFO : gcloud transitively enabled, ini template available with --add-to-start=gcloud |
| INFO : annotations transitively enabled |
| INFO : plus transitively enabled |
| INFO : slf4j-api transitively enabled |
| INFO : security transitively enabled |
| INFO : gcloud-datastore transitively enabled |
| INFO : jcl-slf4j transitively enabled |
| INFO : session-store-gcloud initialized in ${jetty.base}/start.d/session-store-gcloud.ini |
| INFO : jndi transitively enabled |
| MKDIR : ${jetty.base}/etc |
| COPY : ${jetty.home}/modules/jul-impl/etc/java-util-logging.properties to ${jetty.base}/etc/java-util-logging.properties |
| MKDIR : ${jetty.base}/lib/slf4j |
| DOWNLD: https://repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-api-1.7.21.jar |
| MKDIR : ${jetty.base}/lib/gcloud |
| COPY : /Users/admin/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar to ${jetty.base}/lib/gcloud/aopalliance-1.0.jar |
| COPY : /Users/admin/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.1.3/jackson-core-2.1.3.jar to ${jetty.base}/lib/gcloud/jackson-core-2.1.3.jar |
| COPY : /Users/admin/.m2/repository/com/google/api-client/google-api-client-appengine/1.21.0/google-api-client-appengine-1.21.0.jar to ${jetty.base}/lib/gcloud/google-api-client-appengine-1.21.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/api-client/google-api-client/1.20.0/google-api-client-1.20.0.jar to ${jetty.base}/lib/gcloud/google-api-client-1.20.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/api-client/google-api-client-servlet/1.21.0/google-api-client-servlet-1.21.0.jar to ${jetty.base}/lib/gcloud/google-api-client-servlet-1.21.0.jar |
| DOWNLD: https://repo1.maven.org/maven2/com/google/api/gax/0.0.21/gax-0.0.21.jar to ${jetty.base}/lib/gcloud/gax-0.0.21.jar |
| COPY : /Users/admin/.m2/repository/com/google/api/grpc/grpc-google-common-protos/0.1.0/grpc-google-common-protos-0.1.0.jar to ${jetty.base}/lib/gcloud/grpc-google-common-protos-0.1.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/api/grpc/grpc-google-iam-v1/0.1.0/grpc-google-iam-v1-0.1.0.jar to ${jetty.base}/lib/gcloud/grpc-google-iam-v1-0.1.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/auth/google-auth-library-credentials/0.3.1/google-auth-library-credentials-0.3.1.jar to ${jetty.base}/lib/gcloud/google-auth-library-credentials-0.3.1.jar |
| COPY : /Users/admin/.m2/repository/com/google/auth/google-auth-library-oauth2-http/0.3.1/google-auth-library-oauth2-http-0.3.1.jar to ${jetty.base}/lib/gcloud/google-auth-library-oauth2-http-0.3.1.jar |
| DOWNLD: https://repo1.maven.org/maven2/com/google/auto/value/auto-value/1.2/auto-value-1.2.jar to ${jetty.base}/lib/gcloud/auto-value-1.2.jar |
| DOWNLD: https://repo1.maven.org/maven2/com/google/cloud/datastore/datastore-v1-proto-client/1.3.0/datastore-v1-proto-client-1.3.0.jar to ${jetty.base}/lib/gcloud/datastore-v1-proto-client-1.3.0.jar |
| DOWNLD: https://repo1.maven.org/maven2/com/google/cloud/datastore/datastore-v1-protos/1.3.0/datastore-v1-protos-1.3.0.jar to ${jetty.base}/lib/gcloud/datastore-v1-protos-1.3.0.jar |
| DOWNLD: https://repo1.maven.org/maven2/com/google/cloud/google-cloud-core/0.5.1/google-cloud-core-0.5.1.jar to ${jetty.base}/lib/gcloud/google-cloud-core-0.5.0.jar |
| DOWNLD: https://repo1.maven.org/maven2/com/google/cloud/google-cloud-datastore/0.5.1/google-cloud-datastore-0.5.1.jar to ${jetty.base}/lib/gcloud/google-cloud-datastore-0.5.1.jar |
| COPY : /Users/admin/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar to ${jetty.base}/lib/gcloud/jsr305-1.3.9.jar |
| COPY : /Users/admin/.m2/repository/com/google/code/gson/gson/2.3/gson-2.3.jar to ${jetty.base}/lib/gcloud/gson-2.3.jar |
| COPY : /Users/admin/.m2/repository/com/google/guava/guava/19.0/guava-19.0.jar to ${jetty.base}/lib/gcloud/guava-19.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/http-client/google-http-client-appengine/1.21.0/google-http-client-appengine-1.21.0.jar to ${jetty.base}/lib/gcloud/google-http-client-appengine-1.21.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/http-client/google-http-client-jackson2/1.19.0/google-http-client-jackson2-1.19.0.jar to ${jetty.base}/lib/gcloud/google-http-client-jackson2-1.19.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/http-client/google-http-client-jackson/1.21.0/google-http-client-jackson-1.21.0.jar to ${jetty.base}/lib/gcloud/google-http-client-jackson-1.21.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/http-client/google-http-client/1.21.0/google-http-client-1.21.0.jar to ${jetty.base}/lib/gcloud/google-http-client-1.21.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/http-client/google-http-client-jdo/1.21.0/google-http-client-jdo-1.21.0.jar to ${jetty.base}/lib/gcloud/google-http-client-jdo-1.21.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/http-client/google-http-client-protobuf/1.20.0/google-http-client-protobuf-1.20.0.jar to ${jetty.base}/lib/gcloud/google-http-client-protobuf-1.20.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/inject/guice/4.0/guice-4.0.jar to ${jetty.base}/lib/gcloud/guice-4.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/oauth-client/google-oauth-client-appengine/1.21.0/google-oauth-client-appengine-1.21.0.jar to ${jetty.base}/lib/gcloud/google-oauth-client-appengine-1.21.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/oauth-client/google-oauth-client/1.21.0/google-oauth-client-1.21.0.jar to ${jetty.base}/lib/gcloud/google-oauth-client-1.21.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/oauth-client/google-oauth-client-servlet/1.21.0/google-oauth-client-servlet-1.21.0.jar to ${jetty.base}/lib/gcloud/google-oauth-client-servlet-1.21.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar to ${jetty.base}/lib/gcloud/protobuf-java-3.0.0.jar |
| COPY : /Users/admin/.m2/repository/com/google/protobuf/protobuf-java-util/3.0.0/protobuf-java-util-3.0.0.jar to ${jetty.base}/lib/gcloud/protobuf-java-util-3.0.0.jar |
| COPY : /Users/admin/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar to ${jetty.base}/lib/gcloud/commons-codec-1.3.jar |
| COPY : /Users/admin/.m2/repository/io/grpc/grpc-context/1.0.1/grpc-context-1.0.1.jar to ${jetty.base}/lib/gcloud/grpc-context-1.0.1.jar |
| COPY : /Users/admin/.m2/repository/io/grpc/grpc-core/1.0.1/grpc-core-1.0.1.jar to ${jetty.base}/lib/gcloud/grpc-core-1.0.1.jar |
| COPY : /Users/admin/.m2/repository/io/grpc/grpc-protobuf/1.0.1/grpc-protobuf-1.0.1.jar to ${jetty.base}/lib/gcloud/grpc-protobuf-1.0.1.jar |
| COPY : /Users/admin/.m2/repository/io/grpc/grpc-protobuf-lite/1.0.1/grpc-protobuf-lite-1.0.1.jar to ${jetty.base}/lib/gcloud/grpc-protobuf-lite-1.0.1.jar |
| COPY : /Users/admin/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar to ${jetty.base}/lib/gcloud/javax.inject-1.jar |
| COPY : /Users/admin/.m2/repository/javax/jdo/jdo2-api/2.3-eb/jdo2-api-2.3-eb.jar to ${jetty.base}/lib/gcloud/jdo2-api-2.3-eb.jar |
| COPY : /Users/admin/.m2/repository/javax/transaction/transaction-api/1.1/transaction-api-1.1.jar to ${jetty.base}/lib/gcloud/transaction-api-1.1.jar |
| COPY : /Users/admin/.m2/repository/joda-time/joda-time/2.9.2/joda-time-2.9.2.jar to ${jetty.base}/lib/gcloud/joda-time-2.9.2.jar |
| COPY : /Users/admin/.m2/repository/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar to ${jetty.base}/lib/gcloud/httpclient-4.0.1.jar |
| COPY : /Users/admin/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar to ${jetty.base}/lib/gcloud/httpcore-4.0.1.jar |
| COPY : /Users/admin/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.11/jackson-core-asl-1.9.11.jar to ${jetty.base}/lib/gcloud/jackson-core-asl-1.9.11.jar |
| COPY : /Users/admin/.m2/repository/org/json/json/20151123/json-20151123.jar to ${jetty.base}/lib/gcloud/json-20151123.jar |
| DOWNLD: https://repo1.maven.org/maven2/org/slf4j/jcl-over-slf4j/1.7.21/jcl-over-slf4j-1.7.21.jar to ${jetty.base}/lib/slf4j/jcl-over-slf4j-1.7.21.jar |
| COPY : ${jetty.home}/modules/gcloud/index.yaml to ${jetty.base}/etc/index.yaml |
| INFO : Base directory was modified |
| ERROR : Module jcl-slf4j requires a module providing slf4j-impl from one of [slf4j-simple-impl, slf4j-logback, slf4j-jul, slf4j-log4j2, slf4j-log4j] |
| |
| ERROR : Unsatisfied module dependencies: jcl-slf4j |
| |
| Usage: java -jar $JETTY_HOME/start.jar [options] [properties] [configs] |
| java -jar $JETTY_HOME/start.jar --help # for more information</pre></div><p>Doing this enables the GCloud Session module and any dependent session modules or files needed for it to run on the server. |
| The example above is using a fresh <code class="literal">${jetty.base}</code> with nothing else enabled. |
| Because the Google Cloud DataStore is not a technology provided by the Eclipse Foundation, users are prompted to assent to the licenses of the external vendor (Apache in this case).</p><p>You will notice, however, that the above output presented a warning: GCloud requires certain Java Commons Logging features to work correctly. |
| GCloud has a dependency on Java Commons Logging, and by default Jetty will route this through SLF4J. |
| Enabling the GCloud Sessions module will also enable the <code class="literal">jcl-slf4j</code> module, which sends JCL logging information to SLF4J. |
| It does <span class="strong"><strong>not</strong></span>, however, configure a SLF4J implementation for the users.</p><p>As such, you will also need to enable one of the SLF4J implementation modules listed. |
| In this example, we will enable the <code class="literal">slf4j-simple-impl</code> module to provide a SLF4J implementation.</p><div class="screenexample"><pre class="screen">$ java -jar ../start.jar --add-to-start=slf4j-simple-impl |
| INFO : slf4j-simple-impl initialized in ${jetty.base}/start.d/slf4j-simple-impl.ini |
| INFO : resources transitively enabled |
| DOWNLD: https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/1.7.21/slf4j-simple-1.7.21.jar to ${jetty.base}/lib/slf4j/slf4j-simple-1.7.21.jar |
| MKDIR : ${jetty.base}/resources |
| COPY : ${jetty.home}/modules/slf4j-simple-impl/resources/simplelogger.properties to ${jetty.base}/resources/simplelogger.properties |
| INFO : Base directory was modified</pre></div><p>When the <code class="literal">--add-to-start</code> argument was added to the command line the first time, it enabled the the <code class="literal">session-store-gcloud</code> module as well as several others, such as as <code class="literal">server</code>, <code class="literal">sessions</code>, <code class="literal">webapp</code> and others which are required for GCloud session management to operate; the <code class="literal">slf4j-simple-impl</code> and its dependent modules were added when the the command was run the second time.</p><p>In addition to adding these modules to the classpath of the server it also added the respective configuration files to the <code class="literal">${jetty.base}start.d</code> directory.</p><div class="blockquote"><blockquote class="blockquote"><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><i class="fa fa-asterisk" aria-hidden="true"></i> Note</h3><p>If you have updated versions of the jar files automatically downloaded by Jetty, you can place them in the associated <code class="literal">${jetty.base}/lib/</code> directory and use the <code class="literal">--skip-file-validation=<module name></code> command line option to prevent errors when starting your server.</p></div></blockquote></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_configuring_gcloud_session_properties"></a>Configuring GCloud Session Properties</h3></div></div></div><p>Opening the <code class="literal">start.d/session-store-gcloud.ini</code> will display a list of all the configurable properties for the Google Cloud DataStore module:</p><div class="screenexample"><pre class="screen"># --------------------------------------- |
| # Module: session-store-gcloud |
| # Enables GCloudDatastore session management. |
| # --------------------------------------- |
| --module=session-store-gcloud |
| |
| |
| ## GCloudDatastore Session config |
| #jetty.session.gracePeriod.seconds=3600 |
| #jetty.session.savePeriod.seconds=0 |
| #jetty.session.gcloud.maxRetries=5 |
| #jetty.session.gcloud.backoffMs=1000 |
| #jetty.session.gcloud.namespace= |
| #jetty.session.gcloud.model.kind=GCloudSession |
| #jetty.session.gcloud.model.id=id |
| #jetty.session.gcloud.model.contextPath=contextPath |
| #jetty.session.gcloud.model.vhost=vhost |
| #jetty.session.gcloud.model.accessed=accessed |
| #jetty.session.gcloud.model.lastAccessed=lastAccessed |
| #jetty.session.gcloud.model.createTime=createTime |
| #jetty.session.gcloud.model.cookieSetTime=cookieSetTime |
| #jetty.session.gcloud.model.lastNode=lastNode |
| #jetty.session.gcloud.model.expiry=expiry |
| #jetty.session.gcloud.model.maxInactive=maxInactive |
| #jetty.session.gcloud.model.attributes=attributes</pre></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">jetty.session.gracePeriod.seconds</span></dt><dd>Amount of time, in seconds, to wait for other nodes to be checked to verify an expired session is in fact expired throughout the cluster before closing it.</dd><dt><span class="term">jetty.session.savePeriod.seconds=0</span></dt><dd><p class="simpara">By default whenever the last concurrent request leaves a session, that session is always persisted via the <code class="literal">SessionDataStore</code>, even if the only thing that changed on the session is its updated last access time. |
| A non-zero value means that the <code class="literal">SessionDataStore</code> will skip persisting the session if only the access time changed, and it has been less than <code class="literal">savePeriod</code> seconds since the last time the session was written.</p><div class="blockquote"><blockquote class="blockquote"><div xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times" class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title"><i class="fa fa-asterisk" aria-hidden="true"></i> Note</h3><p>Configuring <code class="literal">savePeriod</code> is useful if your persistence technology is very slow/costly for writes. |
| In a clustered environment, there is a risk of the last access time of the session being out-of-date in the shared store for up to <code class="literal">savePeriod</code> seconds. |
| This allows the possibility that a node may prematurely expire the session, even though it is in use by another node. |
| Thorough consideration of the <code class="literal">maxIdleTime</code> of the session when setting the <code class="literal">savePeriod</code> is imperative - there is no point in setting a <code class="literal">savePeriod</code> that is larger than the <code class="literal">maxIdleTime</code>.</p></div></blockquote></div></dd><dt><span class="term">jetty.session.gcloud.maxRetries</span></dt><dd>Maxmium number of tries to connect to GCloud DataStore to write sessions.</dd><dt><span class="term">jetty.session.gcloud.backoffMs</span></dt><dd>Amount of time, in milliseconds, between attempts to connect to the GCloud DataStore to write sessions.</dd><dt><span class="term">jetty.session.gcloud.namespace</span></dt><dd>Optional. |
| Sets the namespace for GCloud Datastore to use. |
| If set, partitions the visibility of session data between webapps, which is helpful for multi-tenant deployments. |
| More information can be found <a class="link" href="https://cloud.google.com/datastore/docs/concepts/multitenancy" target="_top">here.</a></dd></dl></div><p>The other values listed are simply the names of properties that represent stored session data, and can be changed if needed.</p></div></div><script type="text/javascript"> |
| SyntaxHighlighter.all() |
| </script><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="configuring-sessions-hazelcast.html"><i class="fa fa-chevron-left" aria-hidden="true"></i> Previous</a> </td><td width="20%" align="center"><a accesskey="u" href="session-management.html"><i class="fa fa-chevron-up" aria-hidden="true"></i> Top</a></td><td width="40%" align="right"> <a accesskey="n" href="session-configuration-memcachedsessiondatastore.html">Next <i class="fa fa-chevron-right" aria-hidden="true"></i></a></td></tr><tr><td width="40%" align="left" valign="top">Persistent Sessions: Hazelcast </td><td width="20%" align="center"><a accesskey="h" href="index.html"><i class="fa fa-home" aria-hidden="true"></i> Home</a></td><td width="40%" align="right" valign="top"> Persistent Sessions: The L2 Session Data Cache</td></tr></table></div><p xmlns:jfetch="java:org.eclipse.jetty.xslt.tools.JavaSourceFetchExtension" xmlns:fetch="java:org.eclipse.jetty.xslt.tools.SourceFetchExtension" xmlns:d="http://docbook.org/ns/docbook" xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" xmlns:xslthl="http://xslthl.sf.net" xmlns:gcse="http://www.google.com" xmlns:date="http://exslt.org/dates-and-times"><div class="jetty-callout"> |
| See an error or something missing? |
| <span class="callout"><a href="http://github.com/eclipse/jetty.project">Contribute to this documentation at |
| <span class="website"><i class="fa fa-github" aria-hidden="true"></i> Github!</span></a></span><span style="float: right"><i>(Generated: 2020-03-10)</i></span></div></p></body></html> |