@@ -29,15 +29,15 @@ asciidoctor {
|
|||||||
def ghTag = snapshotBuild ? 'master' : project.version
|
def ghTag = snapshotBuild ? 'master' : project.version
|
||||||
def ghUrl = "https://github.com/spring-projects/spring-session/tree/$ghTag"
|
def ghUrl = "https://github.com/spring-projects/spring-session/tree/$ghTag"
|
||||||
|
|
||||||
attributes 'docs-itest-dir': "$rootProject.projectDir.path/docs/src/integration-test/java/",
|
attributes 'docs-itest-dir': "$rootProject.projectDir.path/spring-session-docs/src/integration-test/java/",
|
||||||
'docs-test-dir': "$rootProject.projectDir.path/docs/src/test/java/",
|
'docs-test-dir': "$rootProject.projectDir.path/spring-session-docs/src/test/java/",
|
||||||
'docs-test-resources-dir': "$rootProject.projectDir.path/docs/src/test/resources/",
|
'docs-test-resources-dir': "$rootProject.projectDir.path/spring-session-docs/src/test/resources/",
|
||||||
'download-url': "https://github.com/spring-projects/spring-session/archive/${ghTag}.zip",
|
'download-url': "https://github.com/spring-projects/spring-session/archive/${ghTag}.zip",
|
||||||
'gh-samples-url': "$ghUrl/samples/",
|
'gh-samples-url': "$ghUrl/spring-session-samples/",
|
||||||
'gh-url': ghUrl,
|
'gh-url': ghUrl,
|
||||||
'hazelcast-version': versions['com.hazelcast:hazelcast'],
|
'hazelcast-version': versions['com.hazelcast:hazelcast'],
|
||||||
'lettuce-version': versions['io.lettuce:lettuce-core'],
|
'lettuce-version': versions['io.lettuce:lettuce-core'],
|
||||||
'samples-dir': "$rootProject.projectDir.path/samples/",
|
'samples-dir': "$rootProject.projectDir.path/spring-session-samples/",
|
||||||
'session-jdbc-main-resources-dir': "${project(':spring-session-jdbc').projectDir.path}/src/main/resources/",
|
'session-jdbc-main-resources-dir': "${project(':spring-session-jdbc').projectDir.path}/src/main/resources/",
|
||||||
'spring-boot-version': project.springBootVersion,
|
'spring-boot-version': project.springBootVersion,
|
||||||
'spring-data-redis-version': versions['org.springframework.data:spring-data-redis'],
|
'spring-data-redis-version': versions['org.springframework.data:spring-data-redis'],
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ For example, our sample application includes the location and access type of the
|
|||||||
====
|
====
|
||||||
[source,java,indent=0]
|
[source,java,indent=0]
|
||||||
----
|
----
|
||||||
include::{samples-dir}boot/findbyusername/src/main/java/sample/session/SessionDetails.java[tags=class]
|
include::{samples-dir}spring-session-sample-boot-findbyusername/src/main/java/sample/session/SessionDetails.java[tags=class]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ We then inject that information into the session on each HTTP request using a `S
|
|||||||
====
|
====
|
||||||
[source,java,indent=0]
|
[source,java,indent=0]
|
||||||
----
|
----
|
||||||
include::{samples-dir}boot/findbyusername/src/main/java/sample/session/SessionDetailsFilter.java[tags=dofilterinternal]
|
include::{samples-dir}spring-session-sample-boot-findbyusername/src/main/java/sample/session/SessionDetailsFilter.java[tags=dofilterinternal]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ The following example shows how to do so:
|
|||||||
====
|
====
|
||||||
[source,java,indent=0]
|
[source,java,indent=0]
|
||||||
----
|
----
|
||||||
include::{samples-dir}boot/findbyusername/src/main/java/sample/mvc/IndexController.java[tags=findbyusername]
|
include::{samples-dir}spring-session-sample-boot-findbyusername/src/main/java/sample/mvc/IndexController.java[tags=findbyusername]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ The following example shows how to do so:
|
|||||||
.src/main/java/samples/config/WebSocketConfig.java
|
.src/main/java/samples/config/WebSocketConfig.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}boot/websocket/src/main/java/sample/config/WebSocketConfig.java[tags=class]
|
include::{samples-dir}spring-session-sample-boot-websocket/src/main/java/sample/config/WebSocketConfig.java[tags=class]
|
||||||
----
|
----
|
||||||
|
|
||||||
To hook in the Spring Session support we only need to change two things:
|
To hook in the Spring Session support we only need to change two things:
|
||||||
|
|||||||
@@ -1,151 +0,0 @@
|
|||||||
= Spring Session - Grails
|
|
||||||
Eric Helgeson
|
|
||||||
:toc:
|
|
||||||
|
|
||||||
This guide describes how to use Spring Session to transparently leverage Redis to back a web application's `HttpSession` when you use Grails 3.1
|
|
||||||
|
|
||||||
NOTE: Grails 3.1 is based off spring boot 1.3, so much of the advanced configuration and options can be found in the Boot docs as well.
|
|
||||||
|
|
||||||
NOTE: You can find the completed guid in the <<grails3-sample, Grails 3 sample application>>.
|
|
||||||
|
|
||||||
== Updating Dependencies
|
|
||||||
|
|
||||||
Before you use Spring Session, you must update your dependencies.
|
|
||||||
We assume you are working with a working Grails 3.1 web profile.
|
|
||||||
You must add the following dependencies:
|
|
||||||
|
|
||||||
====
|
|
||||||
.build.gradle
|
|
||||||
[source,groovy]
|
|
||||||
[subs="verbatim,attributes"]
|
|
||||||
----
|
|
||||||
dependencies {
|
|
||||||
compile 'org.springframework.boot:spring-boot-starter-redis'
|
|
||||||
compile 'org.springframework.session:spring-session:{spring-session-version}'
|
|
||||||
}
|
|
||||||
----
|
|
||||||
====
|
|
||||||
|
|
||||||
ifeval::["{version-snapshot}" == "true"]
|
|
||||||
Since we use a SNAPSHOT version, we need to ensure to add the Spring Snapshot Maven Repository.
|
|
||||||
You must have the following in your build.gradle:
|
|
||||||
|
|
||||||
====
|
|
||||||
.build.gradle
|
|
||||||
[source,groovy]
|
|
||||||
----
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url 'https://repo.spring.io/libs-snapshot'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
----
|
|
||||||
====
|
|
||||||
endif::[]
|
|
||||||
|
|
||||||
ifeval::["{version-milestone}" == "true"]
|
|
||||||
Since we use a Milestone version, we need to add the Spring Milestone Maven Repository.
|
|
||||||
You must have the following in your build.gradle:
|
|
||||||
|
|
||||||
====
|
|
||||||
.build.gradle
|
|
||||||
[source,groovy]
|
|
||||||
----
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
url 'https://repo.spring.io/libs-milestone'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
----
|
|
||||||
====
|
|
||||||
endif::[]
|
|
||||||
|
|
||||||
[[grails3-redis-configuration]]
|
|
||||||
== Configuring the Redis Connection
|
|
||||||
|
|
||||||
Spring Boot automatically creates a `RedisConnectionFactory` that connects Spring Session to a Redis Server on localhost on port 6379 (default port).
|
|
||||||
In a production environment you need to ensure to update your configuration to point to your Redis server.
|
|
||||||
For example, you can include the following in your application.yml:
|
|
||||||
|
|
||||||
====
|
|
||||||
.grails-app/conf/application.yml
|
|
||||||
[source,yml]
|
|
||||||
----
|
|
||||||
spring:
|
|
||||||
redis:
|
|
||||||
host: localhost
|
|
||||||
password: secret
|
|
||||||
port: 6397
|
|
||||||
----
|
|
||||||
====
|
|
||||||
|
|
||||||
For more information, see the https://docs.spring.io/spring-boot/docs/{spring-boot-version}/reference/htmlsingle/#boot-features-connecting-to-redis[Connecting to Redis] portion of the Spring Boot documentation.
|
|
||||||
|
|
||||||
[[grails3-sample]]
|
|
||||||
== Grails 3 Sample Application
|
|
||||||
|
|
||||||
The Grails 3 Sample Application demonstrates how to use Spring Session to transparently leverage Redis to back a web application's `HttpSession` when using Grails.
|
|
||||||
|
|
||||||
[[grails3-running]]
|
|
||||||
=== Running the Grails 3 Sample Application
|
|
||||||
|
|
||||||
You can run the sample by obtaining the {download-url}[source code] and invoking the following command:
|
|
||||||
|
|
||||||
----
|
|
||||||
$ ./gradlew :spring-session-sample-misc-grails3:bootRun
|
|
||||||
----
|
|
||||||
|
|
||||||
NOTE:For the sample to work, you must https://redis.io/download[install Redis 2.8+] on localhost and run it with the default port (6379).
|
|
||||||
Alternatively, you can update the `RedisConnectionFactory` to point to a Redis server.
|
|
||||||
Another option is to use https://www.docker.com/[Docker] to run Redis on localhost.
|
|
||||||
See https://hub.docker.com/_/redis/[Docker Redis repository] for detailed instructions.
|
|
||||||
|
|
||||||
You should now be able to access the application at http://localhost:8080/test/index
|
|
||||||
|
|
||||||
[[grails3-explore]]
|
|
||||||
=== Exploring the `security` Sample Application
|
|
||||||
|
|
||||||
You can now try using the application. Enter the following to log in:
|
|
||||||
|
|
||||||
* *Username* _user_
|
|
||||||
* *Password* _password_
|
|
||||||
|
|
||||||
Now click the *Login* button.
|
|
||||||
You should now see a message indicating that your are logged in with the user entered previously.
|
|
||||||
The user's information is stored in Redis rather than Tomcat's `HttpSession` implementation.
|
|
||||||
|
|
||||||
[[grails3-how]]
|
|
||||||
=== How Does It Work?
|
|
||||||
|
|
||||||
Instead of using Tomcat's `HttpSession`, we persist the values in Redis.
|
|
||||||
Spring Session replaces the `HttpSession` with an implementation that is backed by Redis.
|
|
||||||
When Spring Security's `SecurityContextPersistenceFilter` saves the `SecurityContext` to the `HttpSession`, it is then persisted into Redis.
|
|
||||||
|
|
||||||
When a new `HttpSession` is created, Spring Session creates a cookie named `SESSION` in your browser.
|
|
||||||
That cookie contains the ID of your session.
|
|
||||||
You can view the cookies (with https://developers.google.com/web/tools/chrome-devtools/manage-data/cookies[Chrome] or https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector[Firefox]).
|
|
||||||
|
|
||||||
You can remove the session by using redis-cli.
|
|
||||||
For example, on a Linux based system you can type the following:
|
|
||||||
|
|
||||||
====
|
|
||||||
----
|
|
||||||
$ redis-cli keys '*' | xargs redis-cli del
|
|
||||||
----
|
|
||||||
====
|
|
||||||
|
|
||||||
TIP: The Redis documentation has instructions for https://redis.io/topics/quickstart[installing redis-cli].
|
|
||||||
|
|
||||||
Alternatively, you can also delete the explicit key.
|
|
||||||
To do so, enter the following into your terminal, being sure to replace `7e8383a4-082c-4ffe-a4bc-c40fd3363c5e` with the value of your `SESSION` cookie:
|
|
||||||
|
|
||||||
====
|
|
||||||
----
|
|
||||||
$ redis-cli del spring:session:sessions:7e8383a4-082c-4ffe-a4bc-c40fd3363c5e
|
|
||||||
----
|
|
||||||
====
|
|
||||||
|
|
||||||
Now you can visit the application at http://localhost:8080/test/index and see that we are no longer authenticated.
|
|
||||||
|
|
||||||
NOTE: Spring Session does not work with Grails flash scope without additional work.
|
|
||||||
See https://stackoverflow.com/a/43311427 for an explanation.
|
|
||||||
@@ -18,7 +18,7 @@ The following example shows how to customize Spring Session's cookie:
|
|||||||
====
|
====
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/custom-cookie/src/main/java/sample/Config.java[tags=cookie-serializer]
|
include::{samples-dir}spring-session-sample-javaconfig-custom-cookie/src/main/java/sample/Config.java[tags=cookie-serializer]
|
||||||
----
|
----
|
||||||
|
|
||||||
<1> We customize the name of the cookie to be `JSESSIONID`.
|
<1> We customize the name of the cookie to be `JSESSIONID`.
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ The following listing shows how to do so:
|
|||||||
.src/main/java/sample/SecurityInitializer.java
|
.src/main/java/sample/SecurityInitializer.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/hazelcast/src/main/java/sample/SecurityInitializer.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-hazelcast/src/main/java/sample/SecurityInitializer.java[tags=class]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ The following example shows how to do so:
|
|||||||
.src/main/java/sample/Initializer.java
|
.src/main/java/sample/Initializer.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/hazelcast/src/main/java/sample/Initializer.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-hazelcast/src/main/java/sample/Initializer.java[tags=class]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ To do so, add the following Spring Configuration:
|
|||||||
====
|
====
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/jdbc/src/main/java/sample/Config.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-jdbc/src/main/java/sample/Config.java[tags=class]
|
||||||
----
|
----
|
||||||
|
|
||||||
<1> The `@EnableJdbcHttpSession` annotation creates a Spring Bean with the name of `springSessionRepositoryFilter`.
|
<1> The `@EnableJdbcHttpSession` annotation creates a Spring Bean with the name of `springSessionRepositoryFilter`.
|
||||||
@@ -111,7 +111,7 @@ The following example shows how to do so:
|
|||||||
.src/main/java/sample/Initializer.java
|
.src/main/java/sample/Initializer.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/jdbc/src/main/java/sample/Initializer.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-jdbc/src/main/java/sample/Initializer.java[tags=class]
|
||||||
----
|
----
|
||||||
|
|
||||||
NOTE: The name of our class (Initializer) does not matter.
|
NOTE: The name of our class (Initializer) does not matter.
|
||||||
@@ -158,7 +158,7 @@ We interact with the standard `HttpSession` in the `SessionServlet` shown in the
|
|||||||
.src/main/java/sample/SessionServlet.java
|
.src/main/java/sample/SessionServlet.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/jdbc/src/main/java/sample/SessionServlet.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-jdbc/src/main/java/sample/SessionServlet.java[tags=class]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ To do so, add the following Spring Configuration:
|
|||||||
====
|
====
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/redis/src/main/java/sample/Config.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-redis/src/main/java/sample/Config.java[tags=class]
|
||||||
----
|
----
|
||||||
|
|
||||||
<1> The `@EnableRedisHttpSession` annotation creates a Spring Bean with the name of `springSessionRepositoryFilter` that implements `Filter`.
|
<1> The `@EnableRedisHttpSession` annotation creates a Spring Bean with the name of `springSessionRepositoryFilter` that implements `Filter`.
|
||||||
@@ -113,7 +113,7 @@ The following shows an example:
|
|||||||
.src/main/java/sample/Initializer.java
|
.src/main/java/sample/Initializer.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/redis/src/main/java/sample/Initializer.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-redis/src/main/java/sample/Initializer.java[tags=class]
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ We interact with the standard `HttpSession` in the `SessionServlet` shown in the
|
|||||||
.src/main/java/sample/SessionServlet.java
|
.src/main/java/sample/SessionServlet.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/redis/src/main/java/sample/SessionServlet.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-redis/src/main/java/sample/SessionServlet.java[tags=class]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ To do so, add the following Spring Configuration:
|
|||||||
====
|
====
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/rest/src/main/java/sample/HttpSessionConfig.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-rest/src/main/java/sample/HttpSessionConfig.java[tags=class]
|
||||||
----
|
----
|
||||||
|
|
||||||
<1> The `@EnableRedisHttpSession` annotation creates a Spring bean named `springSessionRepositoryFilter` that implements `Filter`.
|
<1> The `@EnableRedisHttpSession` annotation creates a Spring bean named `springSessionRepositoryFilter` that implements `Filter`.
|
||||||
@@ -112,7 +112,7 @@ We provide the configuration in our Spring `MvcInitializer`, as the following ex
|
|||||||
.src/main/java/sample/mvc/MvcInitializer.java
|
.src/main/java/sample/mvc/MvcInitializer.java
|
||||||
[source,java,indent=0]
|
[source,java,indent=0]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/rest/src/main/java/sample/mvc/MvcInitializer.java[tags=config]
|
include::{samples-dir}spring-session-sample-javaconfig-rest/src/main/java/sample/mvc/MvcInitializer.java[tags=config]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ Fortunately, Spring Session provides a utility class named `AbstractHttpSessionA
|
|||||||
.src/main/java/sample/Initializer.java
|
.src/main/java/sample/Initializer.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/rest/src/main/java/sample/Initializer.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-rest/src/main/java/sample/Initializer.java[tags=class]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ To do so, add the following Spring Configuration:
|
|||||||
====
|
====
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/security/src/main/java/sample/Config.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-security/src/main/java/sample/Config.java[tags=class]
|
||||||
----
|
----
|
||||||
|
|
||||||
<1> The `@EnableRedisHttpSession` annotation creates a Spring bean with the name of `springSessionRepositoryFilter` that implements `Filter`.
|
<1> The `@EnableRedisHttpSession` annotation creates a Spring bean with the name of `springSessionRepositoryFilter` that implements `Filter`.
|
||||||
@@ -110,7 +110,7 @@ The following example shows how to do so:
|
|||||||
.src/main/java/sample/SecurityInitializer.java
|
.src/main/java/sample/SecurityInitializer.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/security/src/main/java/sample/SecurityInitializer.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-security/src/main/java/sample/SecurityInitializer.java[tags=class]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ The following example shows how to do so:
|
|||||||
.src/main/java/sample/Initializer.java
|
.src/main/java/sample/Initializer.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}javaconfig/security/src/main/java/sample/Initializer.java[tags=class]
|
include::{samples-dir}spring-session-sample-javaconfig-security/src/main/java/sample/Initializer.java[tags=class]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ The following listing shows how to add the following Spring Configuration:
|
|||||||
.src/main/webapp/WEB-INF/spring/session.xml
|
.src/main/webapp/WEB-INF/spring/session.xml
|
||||||
[source,xml,indent=0]
|
[source,xml,indent=0]
|
||||||
----
|
----
|
||||||
include::{samples-dir}xml/jdbc/src/main/webapp/WEB-INF/spring/session.xml[tags=beans]
|
include::{samples-dir}spring-session-sample-xml-jdbc/src/main/webapp/WEB-INF/spring/session.xml[tags=beans]
|
||||||
----
|
----
|
||||||
|
|
||||||
<1> We use the combination of `<context:annotation-config/>` and `JdbcHttpSessionConfiguration` because Spring Session does not yet provide XML Namespace support (see https://github.com/spring-projects/spring-session/issues/104[gh-104]).
|
<1> We use the combination of `<context:annotation-config/>` and `JdbcHttpSessionConfiguration` because Spring Session does not yet provide XML Namespace support (see https://github.com/spring-projects/spring-session/issues/104[gh-104]).
|
||||||
@@ -111,8 +111,8 @@ We do so with the following configuration:
|
|||||||
.src/main/webapp/WEB-INF/web.xml
|
.src/main/webapp/WEB-INF/web.xml
|
||||||
[source,xml,indent=0]
|
[source,xml,indent=0]
|
||||||
----
|
----
|
||||||
include::{samples-dir}xml/jdbc/src/main/webapp/WEB-INF/web.xml[tags=context-param]
|
include::{samples-dir}spring-session-sample-xml-jdbc/src/main/webapp/WEB-INF/web.xml[tags=context-param]
|
||||||
include::{samples-dir}xml/jdbc/src/main/webapp/WEB-INF/web.xml[tags=listeners]
|
include::{samples-dir}spring-session-sample-xml-jdbc/src/main/webapp/WEB-INF/web.xml[tags=listeners]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ The following snippet performs this last step for us:
|
|||||||
.src/main/webapp/WEB-INF/web.xml
|
.src/main/webapp/WEB-INF/web.xml
|
||||||
[source,xml,indent=0]
|
[source,xml,indent=0]
|
||||||
----
|
----
|
||||||
include::{samples-dir}xml/jdbc/src/main/webapp/WEB-INF/web.xml[tags=springSessionRepositoryFilter]
|
include::{samples-dir}spring-session-sample-xml-jdbc/src/main/webapp/WEB-INF/web.xml[tags=springSessionRepositoryFilter]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ We interact with the standard `HttpSession` in the following `SessionServlet`:
|
|||||||
.src/main/java/sample/SessionServlet.java
|
.src/main/java/sample/SessionServlet.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}xml/jdbc/src/main/java/sample/SessionServlet.java[tags=class]
|
include::{samples-dir}spring-session-sample-xml-jdbc/src/main/java/sample/SessionServlet.java[tags=class]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ To do so, add the following Spring Configuration:
|
|||||||
.src/main/webapp/WEB-INF/spring/session.xml
|
.src/main/webapp/WEB-INF/spring/session.xml
|
||||||
[source,xml,indent=0]
|
[source,xml,indent=0]
|
||||||
----
|
----
|
||||||
include::{samples-dir}xml/redis/src/main/webapp/WEB-INF/spring/session.xml[tags=beans]
|
include::{samples-dir}spring-session-sample-xml-redis/src/main/webapp/WEB-INF/spring/session.xml[tags=beans]
|
||||||
----
|
----
|
||||||
|
|
||||||
<1> We use the combination of `<context:annotation-config/>` and `RedisHttpSessionConfiguration` because Spring Session does not yet provide XML Namespace support (see https://github.com/spring-projects/spring-session/issues/104[gh-104]).
|
<1> We use the combination of `<context:annotation-config/>` and `RedisHttpSessionConfiguration` because Spring Session does not yet provide XML Namespace support (see https://github.com/spring-projects/spring-session/issues/104[gh-104]).
|
||||||
@@ -112,8 +112,8 @@ We can do so with the following configuration:
|
|||||||
.src/main/webapp/WEB-INF/web.xml
|
.src/main/webapp/WEB-INF/web.xml
|
||||||
[source,xml,indent=0]
|
[source,xml,indent=0]
|
||||||
----
|
----
|
||||||
include::{samples-dir}xml/redis/src/main/webapp/WEB-INF/web.xml[tags=context-param]
|
include::{samples-dir}spring-session-sample-xml-redis/src/main/webapp/WEB-INF/web.xml[tags=context-param]
|
||||||
include::{samples-dir}xml/redis/src/main/webapp/WEB-INF/web.xml[tags=listeners]
|
include::{samples-dir}spring-session-sample-xml-redis/src/main/webapp/WEB-INF/web.xml[tags=listeners]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ The following snippet performs this last step for us:
|
|||||||
.src/main/webapp/WEB-INF/web.xml
|
.src/main/webapp/WEB-INF/web.xml
|
||||||
[source,xml,indent=0]
|
[source,xml,indent=0]
|
||||||
----
|
----
|
||||||
include::{samples-dir}xml/redis/src/main/webapp/WEB-INF/web.xml[tags=springSessionRepositoryFilter]
|
include::{samples-dir}spring-session-sample-xml-redis/src/main/webapp/WEB-INF/web.xml[tags=springSessionRepositoryFilter]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ We interact with the standard `HttpSession` in the `SessionServlet` shown in the
|
|||||||
.src/main/java/sample/SessionServlet.java
|
.src/main/java/sample/SessionServlet.java
|
||||||
[source,java]
|
[source,java]
|
||||||
----
|
----
|
||||||
include::{samples-dir}xml/redis/src/main/java/sample/SessionServlet.java[tags=class]
|
include::{samples-dir}spring-session-sample-xml-redis/src/main/java/sample/SessionServlet.java[tags=class]
|
||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|||||||
@@ -50,27 +50,27 @@ To get started with Spring Session, the best place to start is our Sample Applic
|
|||||||
|===
|
|===
|
||||||
| Source | Description | Guide
|
| Source | Description | Guide
|
||||||
|
|
||||||
| {gh-samples-url}boot/redis[HttpSession with Redis]
|
| {gh-samples-url}spring-session-sample-boot-redis[HttpSession with Redis]
|
||||||
| Demonstrates how to use Spring Session to replace the `HttpSession` with Redis.
|
| Demonstrates how to use Spring Session to replace the `HttpSession` with Redis.
|
||||||
| link:guides/boot-redis.html[HttpSession with Redis Guide]
|
| link:guides/boot-redis.html[HttpSession with Redis Guide]
|
||||||
|
|
||||||
| {gh-samples-url}boot/jdbc[HttpSession with JDBC]
|
| {gh-samples-url}spring-session-sample-boot-jdbc[HttpSession with JDBC]
|
||||||
| Demonstrates how to use Spring Session to replace the `HttpSession` with a relational database store.
|
| Demonstrates how to use Spring Session to replace the `HttpSession` with a relational database store.
|
||||||
| link:guides/boot-jdbc.html[HttpSession with JDBC Guide]
|
| link:guides/boot-jdbc.html[HttpSession with JDBC Guide]
|
||||||
|
|
||||||
| {gh-samples-url}boot/findbyusername[Find by Username]
|
| {gh-samples-url}spring-session-sample-boot-findbyusername[Find by Username]
|
||||||
| Demonstrates how to use Spring Session to find sessions by username.
|
| Demonstrates how to use Spring Session to find sessions by username.
|
||||||
| link:guides/boot-findbyusername.html[Find by Username Guide]
|
| link:guides/boot-findbyusername.html[Find by Username Guide]
|
||||||
|
|
||||||
| {gh-samples-url}boot/websocket[WebSockets]
|
| {gh-samples-url}spring-session-sample-boot-websocket[WebSockets]
|
||||||
| Demonstrates how to use Spring Session with WebSockets.
|
| Demonstrates how to use Spring Session with WebSockets.
|
||||||
| link:guides/boot-websocket.html[WebSockets Guide]
|
| link:guides/boot-websocket.html[WebSockets Guide]
|
||||||
|
|
||||||
| {gh-samples-url}boot/webflux[WebFlux]
|
| {gh-samples-url}spring-session-sample-boot-webflux[WebFlux]
|
||||||
| Demonstrates how to use Spring Session to replace the Spring WebFlux's `WebSession` with Redis.
|
| Demonstrates how to use Spring Session to replace the Spring WebFlux's `WebSession` with Redis.
|
||||||
|
|
|
|
||||||
|
|
||||||
| {gh-samples-url}boot/redis-json[HttpSession with Redis JSON serialization]
|
| {gh-samples-url}spring-session-sample-boot-redis-json[HttpSession with Redis JSON serialization]
|
||||||
| Demonstrates how to use Spring Session to replace the `HttpSession` with Redis using JSON serialization.
|
| Demonstrates how to use Spring Session to replace the `HttpSession` with Redis using JSON serialization.
|
||||||
|
|
|
|
||||||
|
|
||||||
@@ -80,27 +80,27 @@ To get started with Spring Session, the best place to start is our Sample Applic
|
|||||||
|===
|
|===
|
||||||
| Source | Description | Guide
|
| Source | Description | Guide
|
||||||
|
|
||||||
| {gh-samples-url}javaconfig/redis[HttpSession with Redis]
|
| {gh-samples-url}spring-session-sample-javaconfig-redis[HttpSession with Redis]
|
||||||
| Demonstrates how to use Spring Session to replace the `HttpSession` with Redis.
|
| Demonstrates how to use Spring Session to replace the `HttpSession` with Redis.
|
||||||
| link:guides/java-redis.html[HttpSession with Redis Guide]
|
| link:guides/java-redis.html[HttpSession with Redis Guide]
|
||||||
|
|
||||||
| {gh-samples-url}javaconfig/jdbc[HttpSession with JDBC]
|
| {gh-samples-url}spring-session-sample-javaconfig-jdbc[HttpSession with JDBC]
|
||||||
| Demonstrates how to use Spring Session to replace the `HttpSession` with a relational database store.
|
| Demonstrates how to use Spring Session to replace the `HttpSession` with a relational database store.
|
||||||
| link:guides/java-jdbc.html[HttpSession with JDBC Guide]
|
| link:guides/java-jdbc.html[HttpSession with JDBC Guide]
|
||||||
|
|
||||||
| {gh-samples-url}javaconfig/hazelcast[HttpSession with Hazelcast]
|
| {gh-samples-url}spring-session-sample-javaconfig-hazelcast[HttpSession with Hazelcast]
|
||||||
| Demonstrates how to use Spring Session to replace the `HttpSession` with Hazelcast.
|
| Demonstrates how to use Spring Session to replace the `HttpSession` with Hazelcast.
|
||||||
| link:guides/java-hazelcast.html[HttpSession with Hazelcast Guide]
|
| link:guides/java-hazelcast.html[HttpSession with Hazelcast Guide]
|
||||||
|
|
||||||
| {gh-samples-url}javaconfig/custom-cookie[Custom Cookie]
|
| {gh-samples-url}spring-session-sample-javaconfig-custom-cookie[Custom Cookie]
|
||||||
| Demonstrates how to use Spring Session and customize the cookie.
|
| Demonstrates how to use Spring Session and customize the cookie.
|
||||||
| link:guides/java-custom-cookie.html[Custom Cookie Guide]
|
| link:guides/java-custom-cookie.html[Custom Cookie Guide]
|
||||||
|
|
||||||
| {gh-samples-url}javaconfig/security[Spring Security]
|
| {gh-samples-url}spring-session-sample-javaconfig-security[Spring Security]
|
||||||
| Demonstrates how to use Spring Session with an existing Spring Security application.
|
| Demonstrates how to use Spring Session with an existing Spring Security application.
|
||||||
| link:guides/java-security.html[Spring Security Guide]
|
| link:guides/java-security.html[Spring Security Guide]
|
||||||
|
|
||||||
| {gh-samples-url}javaconfig/rest[REST]
|
| {gh-samples-url}spring-session-sample-javaconfig-rest[REST]
|
||||||
| Demonstrates how to use Spring Session in a REST application to support authenticating with a header.
|
| Demonstrates how to use Spring Session in a REST application to support authenticating with a header.
|
||||||
| link:guides/java-rest.html[REST Guide]
|
| link:guides/java-rest.html[REST Guide]
|
||||||
|
|
||||||
@@ -110,11 +110,11 @@ To get started with Spring Session, the best place to start is our Sample Applic
|
|||||||
|===
|
|===
|
||||||
| Source | Description | Guide
|
| Source | Description | Guide
|
||||||
|
|
||||||
| {gh-samples-url}xml/redis[HttpSession with Redis]
|
| {gh-samples-url}spring-session-sample-xml-redis[HttpSession with Redis]
|
||||||
| Demonstrates how to use Spring Session to replace the `HttpSession` with a Redis store.
|
| Demonstrates how to use Spring Session to replace the `HttpSession` with a Redis store.
|
||||||
| link:guides/xml-redis.html[HttpSession with Redis Guide]
|
| link:guides/xml-redis.html[HttpSession with Redis Guide]
|
||||||
|
|
||||||
| {gh-samples-url}xml/jdbc[HttpSession with JDBC]
|
| {gh-samples-url}spring-session-sample-xml-jdbc[HttpSession with JDBC]
|
||||||
| Demonstrates how to use Spring Session to replace the `HttpSession` with a relational database store.
|
| Demonstrates how to use Spring Session to replace the `HttpSession` with a relational database store.
|
||||||
| link:guides/xml-jdbc.html[HttpSession with JDBC Guide]
|
| link:guides/xml-jdbc.html[HttpSession with JDBC Guide]
|
||||||
|
|
||||||
@@ -124,13 +124,9 @@ To get started with Spring Session, the best place to start is our Sample Applic
|
|||||||
|===
|
|===
|
||||||
| Source | Description | Guide
|
| Source | Description | Guide
|
||||||
|
|
||||||
| {gh-samples-url}misc/grails3[Grails 3]
|
| {gh-samples-url}spring-session-sample-misc-hazelcast[Hazelcast]
|
||||||
| Demonstrates how to use Spring Session with Grails 3.
|
|
||||||
| link:guides/grails3.html[Grails 3 Guide]
|
|
||||||
|
|
||||||
| {gh-samples-url}misc/hazelcast[Hazelcast]
|
|
||||||
| Demonstrates how to use Spring Session with Hazelcast in a Java EE application.
|
| Demonstrates how to use Spring Session with Hazelcast in a Java EE application.
|
||||||
| TBD
|
|
|
||||||
|
|
||||||
|===
|
|===
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user