Polish and fix up the :spring-session-sample-xml-gemfire-clientserver example module.

This commit is contained in:
John Blum
2017-06-07 09:45:48 -07:00
parent fddcd116c4
commit 415511aab2
4 changed files with 10 additions and 8 deletions

View File

@@ -24,10 +24,10 @@ import org.springframework.context.annotation.ImportResource;
// tag::class[]
@Configuration // <1>
@ImportResource("META-INF/spring/session-server.xml") // <2>
public class Application {
public class ServerConfig {
public static void main(String[] args) {
new AnnotationConfigApplicationContext(Application.class).registerShutdownHook();
new AnnotationConfigApplicationContext(ServerConfig.class).registerShutdownHook();
}
}
// tag::end[]

View File

@@ -26,15 +26,17 @@ import javax.servlet.http.HttpServletResponse;
// tag::class[]
public class SessionServlet extends HttpServlet {
private static final long serialVersionUID = 2878267318695777395L;
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String attributeName = request.getParameter("attributeName");
String attributeValue = request.getParameter("attributeValue");
request.getSession().setAttribute(attributeName, attributeValue);
response.sendRedirect(request.getContextPath() + "/");
}
private static final long serialVersionUID = 2878267318695777395L;
}
// tag::end[]