Adapt Asciidoc documentation to new Spring styling and conventions applied by the Spring Build Conventions Gradle Plugin.

This commit is contained in:
John Blum
2020-05-18 19:37:28 -07:00
parent 1c0487f0f8
commit a610e2a867
9 changed files with 115 additions and 64 deletions

View File

@@ -4,11 +4,12 @@ John Blum
:stylesdir: ../
:highlightjsdir: ../js/highlight
:docinfodir: guides
:data-store-name: Apache Geode
:data-store-version: 16
:data-store-version: {master-data-store-version}
:data-store-name: {master-data-store-name}
:data-store-docs: https://geode.apache.org/docs/guide/{data-store-version}
:data-store-javadoc: https://geode.apache.org/releases/latest/javadoc
:data-store-website: https://geode.apache.org
:images-dir: ./images
:sdg-name: Spring Data for {data-store-name}
:sdg-docs: https://docs.spring.io/spring-data/geode/docs/current/reference/html
:sdg-javadoc: https://docs.spring.io/spring-data/geode/docs/current/api
@@ -353,7 +354,7 @@ and add session attributes. The page will refresh with a count of the number of
After 15 seconds, the HTTP session will expire and you will not longer see any session attributes. Additionally, your
HTTP request count will reset to 0.
image::../images/sample-boot-gemfire-with-gfsh-servers.png[]
image::{images-dir}/sample-boot-gemfire-with-gfsh-servers.png[]
While the application is running and before the HTTP session times out (again, the TTI expiration timeout is set to
15 seconds), you can issue queries in Gfsh to see the contents of the "_Sessions)" Region.

View File

@@ -4,6 +4,15 @@ John Blum
:stylesdir: ../
:highlightjsdir: ../js/highlight
:docinfodir: guides
:data-store-version: {master-data-store-version}
:data-store-name: {master-data-store-name}
:data-store-docs: https://geode.apache.org/docs/guide/{data-store-version}
:data-store-javadoc: https://geode.apache.org/releases/latest/javadoc
:data-store-website: https://geode.apache.org
:images-dir: ./images
:sdg-name: Spring Data for {data-store-name}
:sdg-docs: https://docs.spring.io/spring-data/geode/docs/current/reference/html
:sdg-javadoc: https://docs.spring.io/spring-data/geode/docs/current/api
This guide describes how to build a Spring Boot Web application configured with Spring Session to transparently
manage a Web application's `javax.servlet.http.HttpSession` using Apache Geode in a clustered (distributed)
@@ -265,7 +274,7 @@ You should now be able to access the application at http://localhost:8080/counts
When you access the Web application @ http://localhost:8080/counts, you will see a screen similar to...
image::../images/sample-boot-gemfire-with-scoped-proxies.png[]
image::{images-dir}/sample-boot-gemfire-with-scoped-proxies.png[]
The table shows 1 row with 3 columns of information.
@@ -287,9 +296,8 @@ annotation as we saw before (#3)...
@SpringBootApplication
@CacheServerApplication(name = "SpringSessionDataGeodeServerWithScopedProxiesBootSample")
@EnableGemFireHttpSession(maxInactiveIntervalInSeconds = 10) // <3>
...
public class GemFireServer {
...
// ...
}
----
@@ -306,14 +314,18 @@ Well, from our defined Web service endpoint in our Spring MVC `@Controller` clas
.src/main/java/sample/client/Application.java
[source, java]
----
@RequestMapping(method = RequestMethod.GET, path = "/counts")
public String requestAndSessionInstanceCount(HttpServletRequest request, HttpSession session, Model model) { // <7>
@Controller
class Controller {
model.addAttribute("sessionId", session.getId());
model.addAttribute("requestCount", this.requestBean.getCount());
model.addAttribute("sessionCount", this.sessionBean.getCount());
@RequestMapping(method = RequestMethod.GET, path = "/counts")
public String requestAndSessionInstanceCount(HttpServletRequest request, HttpSession session, Model model) { // <7>
return INDEX_TEMPLATE_VIEW_NAME;
model.addAttribute("sessionId", session.getId());
model.addAttribute("requestCount", this.requestBean.getCount());
model.addAttribute("sessionCount", this.sessionBean.getCount());
return INDEX_TEMPLATE_VIEW_NAME;
}
}
----
@@ -360,7 +372,7 @@ is also `java.io.Serializable`...
@Component
@SessionScope(proxyMode = ScopedProxyMode.TARGET_CLASS)
public class SessionScopedProxyBean implements Serializable {
...
// ...
}
----

View File

@@ -4,6 +4,14 @@ John Blum
:stylesdir: ../
:highlightjsdir: ../js/highlight
:docinfodir: guides
:data-store-version: {master-data-store-version}
:data-store-name: {master-data-store-name}
:data-store-docs: https://geode.apache.org/docs/guide/{data-store-version}
:data-store-javadoc: https://geode.apache.org/releases/latest/javadoc
:data-store-website: https://geode.apache.org
:sdg-name: Spring Data for {data-store-name}
:sdg-docs: https://docs.spring.io/spring-data/geode/docs/current/reference/html
:sdg-javadoc: https://docs.spring.io/spring-data/geode/docs/current/api
This guide describes how to build a Spring Boot application configured with Spring Session to transparently leverage
Apache Geode to manage a web application's `javax.servlet.http.HttpSession`.
@@ -213,15 +221,19 @@ shown here for convenience:
.src/main/java/sample/client/Application.java
[source,java]
----
@RequestMapping(method = RequestMethod.POST, path = "/session")
public String session(HttpSession session, ModelMap modelMap,
@Controller
class Controller {
@RequestMapping(method = RequestMethod.POST, path = "/session")
public String session(HttpSession session, ModelMap modelMap,
@RequestParam(name = "attributeName", required = false) String name,
@RequestParam(name = "attributeValue", required = false) String value) {
modelMap.addAttribute("sessionAttributes",
attributes(setAttribute(updateRequestCount(session), name, value)));
modelMap.addAttribute("sessionAttributes",
attributes(setAttribute(updateRequestCount(session), name, value)));
return INDEX_TEMPLATE_VIEW_NAME;
return INDEX_TEMPLATE_VIEW_NAME;
}
}
----

View File

@@ -1,3 +1,5 @@
:data-store-version: {master-data-store-version}
:data-store-docs: https://geode.apache.org/docs/guide/{data-store-version}
:stylesdir: ../
NOTE: The following instructions assume you have installed a local Apache Geode installation. For more information
@@ -12,7 +14,8 @@ For example, on a Linux-based system type the following at the command-line:
Then, enter the following commands in _Gfsh_, ensuring to replace `70002719-3c54-4c20-82c3-e7faa6b718f3` with the value
from your SESSION cookie, or the session id returned by the Apache Geode OQL query (which should match):
....
[source,text]
----
gfsh>connect --jmx-manager=localhost[1099]
gfsh>query --query='SELECT * FROM /ClusteredSpringSessions.keySet'
@@ -29,7 +32,7 @@ Result
NEXT_STEP_NAME : END
gfsh>remove --region=/ClusteredSpringSessions --key="70002719-3c54-4c20-82c3-e7faa6b718f3"
....
----
NOTE: The Apache Geode User Guide contains more detailed instructions on using
{data-store-docs}/tools_modules/gfsh/chapter_overview.html[gfsh].

View File

@@ -4,6 +4,14 @@ John Blum
:stylesdir: ../
:highlightjsdir: ../js/highlight
:docinfodir: guides
:data-store-version: {master-data-store-version}
:data-store-name: {master-data-store-name}
:data-store-docs: https://geode.apache.org/docs/guide/{data-store-version}
:data-store-javadoc: https://geode.apache.org/releases/latest/javadoc
:data-store-website: https://geode.apache.org
:sdg-name: Spring Data for {data-store-name}
:sdg-docs: https://docs.spring.io/spring-data/geode/docs/current/reference/html
:sdg-javadoc: https://docs.spring.io/spring-data/geode/docs/current/api
This guide describes how to configure Spring Session to transparently leverage Apache Geode to manage
a Web application's `javax.servlet.http.HttpSession` using Java Configuration.
@@ -14,6 +22,7 @@ NOTE: The completed guide can be found in the
[#index-link]
link:../index.html[Index]
[[spring-session-dependencies]]
== Updating Dependencies
Before using Spring Session, you must ensure that the required dependencies are included.
@@ -77,7 +86,7 @@ If you are using _Maven_, include the following `repository` declaration in your
endif::[]
// tag::config[]
[[httpsession-spring-java-configuration]]
[[httpsession-spring-java-configuration-clientserver]]
== Spring Java Configuration
After adding the required dependencies and repository declarations, we can create the Spring configuration.
@@ -157,10 +166,11 @@ containing with a `CacheServer` for cache clients to connect.
server-side `Region` (by default, "_ClusteredSpringSessions_") used to store `HttpSession` state. This step is
optional since the Session `Region` could be created manually, perhaps using external means.
Using `@EnableGemFireHttpSession` is convenient and quick.
// end::config[]
== Java Servlet Container Initialization
Our <<httpsession-spring-java-configuration,Spring Java Configuration>> created a Spring bean named `springSessionRepositoryFilter`
Our <<httpsession-spring-java-configuration-clientserver,Spring Java Configuration>> created a Spring bean named `springSessionRepositoryFilter`
that implements `javax.servlet.Filter`. The `springSessionRepositoryFilter` bean is responsible for replacing the
`javax.servlet.http.HttpSession` with a custom implementation backed by Spring Session and Apache Geode.

View File

@@ -4,15 +4,24 @@ John Blum
:stylesdir: ../
:highlightjsdir: ../js/highlight
:docinfodir: guides
:data-store-version: {master-data-store-version}
:data-store-name: {master-data-store-name}
:data-store-docs: https://geode.apache.org/docs/guide/{data-store-version}
:data-store-javadoc: https://geode.apache.org/releases/latest/javadoc
:data-store-website: https://geode.apache.org
:sdg-name: Spring Data for {data-store-name}
:sdg-docs: https://docs.spring.io/spring-data/geode/docs/current/reference/html
:sdg-javadoc: https://docs.spring.io/spring-data/geode/docs/current/api
This guide describes how to configure Apache Geode as a provider in Spring Session to transparently manage
a Web application's `javax.servlet.http.HttpSession` using Java configuration.
NOTE: The completed guide can be found in the <<spring-session-sample-java-gemfire-p2p,HttpSession with Apache Geode (P2P) Sample Application>>.
NOTE: The completed guide can be found in the <<spring-session-sample-java-geode-p2p,HttpSession with Apache Geode (P2P) Sample Application>>.
[#index-link]
link:../index.html[Index]
[[spring-session-dependencies]]
== Updating Dependencies
Before using Spring Session, you must ensure that the required dependencies are included.
@@ -76,7 +85,7 @@ If you are using _Maven_, include the following `repository` declaration in your
endif::[]
// tag::config[]
[[httpsession-spring-java-configuration-gemfire-p2p]]
[[httpsession-spring-java-configuration-p2p]]
== Spring Java Configuration
After adding the required dependencies and repository declarations, we can create the Spring configuration.
@@ -118,7 +127,7 @@ or when a P2P topology is employed.
== Java Servlet Container Initialization
Our <<[httpsession-spring-java-configuration-gemfire-p2p,Spring Java Configuration>> created a Spring bean named
Our <<[httpsession-spring-java-configuration-p2p,Spring Java Configuration>> created a Spring bean named
`springSessionRepositoryFilter` that implements `javax.servlet.Filter`. The `springSessionRepositoryFilter` bean
is responsible for replacing the `javax.servlet.http.HttpSession` with a custom implementation backed by
Spring Session and Apache Geode.
@@ -146,7 +155,7 @@ NOTE: The name of our class (`Initializer`) does not matter. What is important i
our `Config` class.
// end::config[]
[[spring-session-sample-java-gemfire-p2p]]
[[spring-session-sample-java-geode-p2p]]
== HttpSession with Apache Geode (P2P) Sample Application
=== Running the Apache Geode P2P Java Sample Application

View File

@@ -4,6 +4,14 @@ John Blum
:stylesdir: ../
:highlightjsdir: ../js/highlight
:docinfodir: guides
:data-store-version: {master-data-store-version}
:data-store-name: {master-data-store-name}
:data-store-docs: https://geode.apache.org/docs/guide/{data-store-version}
:data-store-javadoc: https://geode.apache.org/releases/latest/javadoc
:data-store-website: https://geode.apache.org
:sdg-name: Spring Data for {data-store-name}
:sdg-docs: https://docs.spring.io/spring-data/geode/docs/current/reference/html
:sdg-javadoc: https://docs.spring.io/spring-data/geode/docs/current/api
This guide describes how to configure Apache Geode as a provider in Spring Session to transparently manage
a Web application's `javax.servlet.http.HttpSession` using XML Configuration.
@@ -13,6 +21,7 @@ NOTE: The completed guide can be found in the <<spring-session-sample-xml-geode-
[#index-link]
link:../index.html[Index]
[[spring-session-dependencies]]
== Updating Dependencies
Before using Spring Session, you must ensure that the required dependencies are included.
@@ -76,7 +85,7 @@ If you are using _Maven_, include the following `repository` declaration in your
endif::[]
// tag::config[]
[[spring-session-sample-xml-geode-clientserver]]
[[httpsession-spring-xml-configuration-clientserver]]
== Spring XML Configuration
After adding the required dependencies and repository declarations, we can create the Spring configuration.
@@ -150,7 +159,7 @@ TIP: Rather than defining a simple Java class with a `main` method, you might co
== XML Servlet Container Initialization
Our <<httpsession-spring-xml-configuration,Spring XML Configuration>> created a Spring bean named `springSessionRepositoryFilter`
Our <<httpsession-spring-xml-configuration-clientserver,Spring XML Configuration>> created a Spring bean named `springSessionRepositoryFilter`
that implements `javax.servlet.Filter` interface. The `springSessionRepositoryFilter` bean is responsible for replacing
the `javax.servlet.http.HttpSession` with a custom implementation that is provided by Spring Session and Apache Geode.
@@ -185,7 +194,7 @@ will look up a bean by the name of `springSessionRepositoryFilter` and cast it t
the `DelegatingFilterProxy` is invoked, which delegates to the `springSessionRepositoryFilter`.
// end::config[]
[[httpsession-gemfire-clientserver-xml-sample-app]]
[[spring-session-sample-xml-geode-clientserver]]
== HttpSession with Apache Geode (Client/Server) using XML Sample Application

View File

@@ -4,16 +4,25 @@ John Blum
:stylesdir: ../
:highlightjsdir: ../js/highlight
:docinfodir: guides
:data-store-version: {master-data-store-version}
:data-store-name: {master-data-store-name}
:data-store-docs: https://geode.apache.org/docs/guide/{data-store-version}
:data-store-javadoc: https://geode.apache.org/releases/latest/javadoc
:data-store-website: https://geode.apache.org
:sdg-name: Spring Data for {data-store-name}
:sdg-docs: https://docs.spring.io/spring-data/geode/docs/current/reference/html
:sdg-javadoc: https://docs.spring.io/spring-data/geode/docs/current/api
This guide describes how to configure Apache Geode as a provider in Spring Session to transparently manage
a Web application's `javax.servlet.http.HttpSession` using XML configuration.
NOTE: The completed guide can be found in the
<<spring-session-sample-xml-gemfire-p2p,HttpSession with Apache Geode (P2P) using XML Sample Application>>.
<<spring-session-sample-xml-geode-p2p,HttpSession with Apache Geode (P2P) using XML Sample Application>>.
[#index-link]
link:../index.html[Index]
[[spring-session-dependencies]]
== Updating Dependencies
Before using Spring Session, you must ensure that the required dependencies are included.
@@ -77,7 +86,7 @@ If you are using _Maven_, include the following `repository` declaration in your
endif::[]
// tag::config[]
[[httpsession-spring-xml-configuration]]
[[httpsession-spring-xml-configuration-p2p]]
== Spring XML Configuration
After adding the required dependencies and repository declarations, we can create the Spring configuration.
@@ -104,7 +113,7 @@ NOTE: For more information on configuring Spring Data for Apache Geode, refer to
== XML Servlet Container Initialization
The <<httpsession-spring-xml-configuration,Spring XML Configuration>> created a Spring bean named `springSessionRepositoryFilter`
The <<httpsession-spring-xml-configuration-p2p,Spring XML Configuration>> created a Spring bean named `springSessionRepositoryFilter`
that implements `javax.servlet.Filter`. The `springSessionRepositoryFilter` bean is responsible for replacing the
`javax.servlet.http.HttpSession` with a custom implementation that is backed by Spring Session and Apache Geode.
@@ -138,7 +147,7 @@ will look up a bean by the name of `springSessionRepositoryFilter` and cast it t
the `DelegatingFilterProxy` is invoked, delegating to the `springSessionRepositoryFilter`.
// end::config[]
[[spring-session-sample-xml-gemfire-p2p]]
[[spring-session-sample-xml-geode-p2p]]
== HttpSession with Apache Geode (P2P) using XML Sample Application
=== Running the Apache Geode XML Sample Application

View File

@@ -1,15 +1,15 @@
= Spring Session
John Blum
:data-store-version: 16
:data-store-name: Apache Geode
:doctype: book
:toc: left
:data-store-version: {master-data-store-version}
:data-store-name: {master-data-store-name}
:data-store-docs: https://geode.apache.org/docs/guide/{data-store-version}
:data-store-javadoc: https://geode.apache.org/releases/latest/javadoc
:data-store-website: https://geode.apache.org
:sdg-name: Spring Data for {data-store-name}
:sdg-docs: https://docs.spring.io/spring-data/geode/docs/current/reference/html
:sdg-javadoc: https://docs.spring.io/spring-data/geode/docs/current/api
:doctype: book
:toc: left
[[abstract]]
@@ -291,7 +291,7 @@ as your provider by using properties, as follows:
@ClientCacheApplication
@EnableGemFireHttpSession(maxInactiveIntervalInSeconds = 900)
class MySpringSessionApplication {
...
// ...
}
----
@@ -366,7 +366,7 @@ class MySpringSessionConfiguration {
public int getMaxInactiveIntervalInSeconds() {
return 3600;
}
}
};
}
}
----
@@ -400,7 +400,7 @@ class MySpringSessionConfiguration {
public int getMaxInactiveIntervalInSeconds() {
return timeout;
}
}
};
}
}
----
@@ -446,7 +446,7 @@ By way of example, consider the following configuration:
@EnableGemFireHttpSession(
maxInactiveIntervalInSeconds = 3600,
poolName = "DEFAULT"
}
)
class MySpringSessionConfiguration {
@Bean
@@ -458,7 +458,7 @@ class MySpringSessionConfiguration {
public int getMaxInactiveIntervalInSeconds() {
return 300;
}
}
};
}
}
----
@@ -564,8 +564,6 @@ Then, in your application class, simple declare the following:
)
class MySpringSessionApplication {
...
@Bean
SessionExpirationPolicy expirationPolicy() {
return new MySessionExpirationPolicy();
@@ -672,8 +670,6 @@ To configure the `FixedTimeoutSessionExpirationPolicy`, do the following:
@EnableGemFireHttpSession(sessionExpirationPolicyBeanName = "fixedTimeoutExpirationPolicy")
class MySpringSessionApplication {
...
@Bean
SessionExpirationPolicy fixedTimeoutExpirationPolicy() {
return new FixedTimeoutSessionExpirationPolicy(Duration.ofMinutes(60L));
@@ -893,7 +889,7 @@ configuration class with:
----
@SpringBootApplication
@EnableGemFireHttpSession(sessionSerializerBeanName = "SessionPdxSerializer")
class MySpringSessionApplication { .. }
class MySpringSessionApplication { }
----
It is a simple matter to change the serialization strategy to _Data Serialization_ instead by setting the
@@ -903,7 +899,7 @@ It is a simple matter to change the serialization strategy to _Data Serializatio
----
@SpringBootApplication
@EnableGemFireHttpSession(sessionSerializerBeanName = "SessionDataSerializer")
class MySpringSessionApplication { .. }
class MySpringSessionApplication { }
----
Since these 2 values are so common, Spring Session for {data-store-name} provides constants for each value in the
@@ -917,7 +913,7 @@ import org.springframework.session.data.geode.config.annotation.web.http.GemFire
@SpringBootApplication
@EnableGemFireHttpSession(sessionSerializerBeanName = GemFireHttpSessionConfiguration.SESSION_PDX_SERIALIZER_BEAN_NAME)
class MySpringSessionApplication { .. }
class MySpringSessionApplication { }
----
With 1 attribute and 2 provided bean definitions out-of-the-box, you can specify which Serialization framework you wish
@@ -984,7 +980,7 @@ class MySpringSessionDataGemFireApplication {
@Bean("MyCustomSessionSerializer")
SessionSerializer<Session, ?, ?> myCustomSessionSerializer() {
...
// ...
}
}
----
@@ -1059,7 +1055,7 @@ class Application {
@Bean
SessionSerializer<Session, ?, ?> customSessionSerializer() {
...
// ...
}
}
----
@@ -1158,11 +1154,9 @@ Configuring the {data-store-name} server `classpath` with the appropriate depend
but generally, the following should work:
.CLASSPATH configuration
[source,txt]
[subs="verbatim,attributes"]
[source,text]
----
set variable --name=REPO_HOME --value=${USER_HOME}/.m2/repository
gfsh> set variable --name=REPO_HOME --value=${USER_HOME}/.m2/repository
gfsh> start server ... --classpath=\
${REPO_HOME}/org/springframework/spring-core/{spring-version}/spring-core-{spring-version}.jar\
@@ -1252,8 +1246,6 @@ class ApplicationConfiguration {
IsDirtyPredicate equalsDirtyPredicate() {
return EqualsDirtyPredicate.INSTANCE;
}
...
}
----
@@ -1277,8 +1269,6 @@ class ApplicationConfiguration {
return EqualsDirtyPredicate.INSTANCE
.orThen(DeltaAwareDirtyPredicate.INSTANCE);
}
...
}
----
@@ -1328,8 +1318,6 @@ class ApplicationConfiguration {
.andThen(new AccountDirtyPredicate())
.andThen(IsDirtyPredicate.ALWAYS_DIRTY);
}
...
}
----
@@ -1369,7 +1357,7 @@ attributes without having to define a separate type.
[source, java]
----
class MySession implements org.springframework.session.Session {
...
// ...
}
----
@@ -1408,8 +1396,6 @@ class MySessionSerializer extends AbstractDataSerializableSessionSerializer {
public Class<?>[] getSupportedClasses() {
return new Class[] { MySession.class };
}
...
}
----