Skip to content

Commit

Permalink
Merge branch 'current' into issue-4212
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem authored Nov 17, 2024
2 parents 4e56abd + 1ce571c commit 5a69506
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
import cloud.piranha.core.api.WebApplication;
import cloud.piranha.core.api.WebApplicationExtension;
import java.lang.System.Logger;
import static java.lang.System.Logger.Level.DEBUG;
import static java.lang.System.Logger.Level.TRACE;

/**
* The WebApplicationExtension that adds the TempDirServletContainerInitializer.
* The WebApplicationExtension that configures the TEMPDIR functionality.
*
* @author Manfred Riem ([email protected])
*/
Expand All @@ -44,9 +44,18 @@ public class TempDirExtension implements WebApplicationExtension {
*/
private static final Logger LOGGER = System.getLogger(TempDirExtension.class.getName());

/**
* Constructor.
*/
public TempDirExtension() {
}

@Override
public void configure(WebApplication webApplication) {
LOGGER.log(DEBUG, "Adding the TempDirServletContainerInitializer");
webApplication.addInitializer(new TempDirServletContainerInitializer());
LOGGER.log(TRACE, "Configuring the TEMPDIR extension");

if (Boolean.parseBoolean(System.getProperty("cloud.piranha.extension.tempdir.TempDirExtension.enabled", "true"))) {
webApplication.addInitializer(new TempDirServletContainerInitializer());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ public class TempDirServletContainerInitializer implements ServletContainerIniti
*/
private static final Logger LOGGER = System.getLogger(TempDirServletContainerInitializer.class.getName());

/**
* Constructor.
*/
public TempDirServletContainerInitializer() {
}

@Override
public void onStartup(Set<Class<?>> classes, ServletContext servletContext) throws ServletException {
File baseDir = new File("tmp");
Expand Down
15 changes: 15 additions & 0 deletions extension/tempdir/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@
/**
* This module delivers the TEMPDIR extension.
*
* <p>
* The following property can be used to influence the workings of this module.
* </p>
* <table>
* <tr>
* <th>Property</th>
* <th>Notes</th>
* </tr>
* <tr>
* <td>cloud.piranha.extension.tempdir.TempDirExtension.enabled</td>
* <td>true to enable (default), false to disable</td>
* </tr>
* <caption>Configurable properties</caption>
* </table>
*
* @author Manfred Riem ([email protected])
*/
module cloud.piranha.extension.tempdir {
Expand Down

0 comments on commit 5a69506

Please sign in to comment.