11/*
2- * Copyright 2012-2015 the original author or authors.
2+ * Copyright 2012-2016 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
3030import io .undertow .servlet .UndertowServletLogger ;
3131import io .undertow .servlet .api .SessionPersistenceManager ;
3232
33+ import org .springframework .core .ConfigurableObjectInputStream ;
34+
3335/**
3436 * {@link SessionPersistenceManager} that stores session information in a file.
3537 *
3638 * @author Phillip Webb
39+ * @author Peter Leibiger
3740 * @since 1.3.0
3841 */
3942public class FileSessionPersistence implements SessionPersistenceManager {
@@ -82,7 +85,7 @@ public Map<String, PersistentSession> loadSessionAttributes(String deploymentNam
8285 try {
8386 File file = getSessionFile (deploymentName );
8487 if (file .exists ()) {
85- return load (file );
88+ return load (file , classLoader );
8689 }
8790 }
8891 catch (Exception ex ) {
@@ -91,9 +94,10 @@ public Map<String, PersistentSession> loadSessionAttributes(String deploymentNam
9194 return null ;
9295 }
9396
94- private Map <String , PersistentSession > load (File file )
97+ private Map <String , PersistentSession > load (File file , ClassLoader classLoader )
9598 throws IOException , ClassNotFoundException {
96- ObjectInputStream stream = new ObjectInputStream (new FileInputStream (file ));
99+ ObjectInputStream stream = new ConfigurableObjectInputStream (
100+ new FileInputStream (file ), classLoader );
97101 try {
98102 return load (stream );
99103 }
0 commit comments