use of org.springframework.boot.system.ApplicationHome in project spring-boot by spring-projects.
the class AbstractServletWebServerFactoryTests method getValidSessionStoreWhenSessionStoreIsRelative.
@Test
void getValidSessionStoreWhenSessionStoreIsRelative() {
AbstractServletWebServerFactory factory = getFactory();
factory.getSession().setStoreDir(new File("sessions"));
File dir = factory.getValidSessionStoreDir(false);
assertThat(dir.getName()).isEqualTo("sessions");
assertThat(dir.getParentFile()).isEqualTo(new ApplicationHome().getDir());
}
use of org.springframework.boot.system.ApplicationHome in project spring-boot by spring-projects.
the class SessionStoreDirectory method getValidDirectory.
File getValidDirectory(boolean mkdirs) {
File dir = getDirectory();
if (dir == null) {
return new ApplicationTemp().getDir("servlet-sessions");
}
if (!dir.isAbsolute()) {
dir = new File(new ApplicationHome().getDir(), dir.getPath());
}
if (!dir.exists() && mkdirs) {
dir.mkdirs();
}
assertDirectory(mkdirs, dir);
return dir;
}
use of org.springframework.boot.system.ApplicationHome in project spring-boot by spring-projects.
the class StartupInfoLogger method appendContext.
private void appendContext(StringBuilder message) {
StringBuilder context = new StringBuilder();
ApplicationHome home = new ApplicationHome(this.sourceClass);
if (home.getSource() != null) {
context.append(home.getSource().getAbsolutePath());
}
append(context, "started by ", () -> System.getProperty("user.name"));
append(context, "in ", () -> System.getProperty("user.dir"));
if (context.length() > 0) {
message.append(" (");
message.append(context);
message.append(")");
}
}
Aggregations