Commit 1f828193 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #7462 from kuhnroyal:gh-7460

* pr/7462:
  Polish contribution
  Fix undertow session persistence with spring-boot-devtools
parents 65b6d8f4 4c61c9f2
/*
* Copyright 2012-2015 the original author or authors.
* Copyright 2012-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -30,10 +30,13 @@ import java.util.Map;
import io.undertow.servlet.UndertowServletLogger;
import io.undertow.servlet.api.SessionPersistenceManager;
import org.springframework.core.ConfigurableObjectInputStream;
/**
* {@link SessionPersistenceManager} that stores session information in a file.
*
* @author Phillip Webb
* @author Peter Leibiger
* @since 1.3.0
*/
public class FileSessionPersistence implements SessionPersistenceManager {
......@@ -82,7 +85,7 @@ public class FileSessionPersistence implements SessionPersistenceManager {
try {
File file = getSessionFile(deploymentName);
if (file.exists()) {
return load(file);
return load(file, classLoader);
}
}
catch (Exception ex) {
......@@ -91,9 +94,10 @@ public class FileSessionPersistence implements SessionPersistenceManager {
return null;
}
private Map<String, PersistentSession> load(File file)
private Map<String, PersistentSession> load(File file, ClassLoader classLoader)
throws IOException, ClassNotFoundException {
ObjectInputStream stream = new ObjectInputStream(new FileInputStream(file));
ObjectInputStream stream = new ConfigurableObjectInputStream(
new FileInputStream(file), classLoader);
try {
return load(stream);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment