Merge pull request #7462 from kuhnroyal:gh-7460
* pr/7462: Polish contribution Fix undertow session persistence with spring-boot-devtools
This commit is contained in:
commit
1f8281931d
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.UndertowServletLogger;
|
||||||
import io.undertow.servlet.api.SessionPersistenceManager;
|
import io.undertow.servlet.api.SessionPersistenceManager;
|
||||||
|
|
||||||
|
import org.springframework.core.ConfigurableObjectInputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link SessionPersistenceManager} that stores session information in a file.
|
* {@link SessionPersistenceManager} that stores session information in a file.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
|
* @author Peter Leibiger
|
||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
*/
|
*/
|
||||||
public class FileSessionPersistence implements SessionPersistenceManager {
|
public class FileSessionPersistence implements SessionPersistenceManager {
|
||||||
|
|
@ -82,7 +85,7 @@ public class FileSessionPersistence implements SessionPersistenceManager {
|
||||||
try {
|
try {
|
||||||
File file = getSessionFile(deploymentName);
|
File file = getSessionFile(deploymentName);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
return load(file);
|
return load(file, classLoader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
|
@ -91,9 +94,10 @@ public class FileSessionPersistence implements SessionPersistenceManager {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, PersistentSession> load(File file)
|
private Map<String, PersistentSession> load(File file, ClassLoader classLoader)
|
||||||
throws IOException, ClassNotFoundException {
|
throws IOException, ClassNotFoundException {
|
||||||
ObjectInputStream stream = new ObjectInputStream(new FileInputStream(file));
|
ObjectInputStream stream = new ConfigurableObjectInputStream(
|
||||||
|
new FileInputStream(file), classLoader);
|
||||||
try {
|
try {
|
||||||
return load(stream);
|
return load(stream);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue