Polish and fix up the :spring-session-sample-xml-gemfire-clientserver example module.
This commit is contained in:
@@ -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[]
|
||||
@@ -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[]
|
||||
|
||||
Reference in New Issue
Block a user