Skip to content

Commit

Permalink
Remove Unused HiddenHttpMethodFilter
Browse files Browse the repository at this point in the history
hello.

I have modified the hello-mvc-security example.

Remove Unused HiddenHttpMethodFilter
1. Remove Unused HiddenHttpMethodFilter
2. Gretty 4.x Requirement: Gretty 4.x requires the /src/main/webapp path.
   This prevents failure when running the example project with the appRun task.

* spring-projects#167
* gretty-gradle-plugin/gretty#298

thanks.
  • Loading branch information
mklinkj committed Dec 6, 2023
1 parent 6454f35 commit 0e6fc9c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
17 changes: 17 additions & 0 deletions servlet/java-configuration/hello-mvc-security/gradle/gretty.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ gretty {
integrationTestTask = 'integrationTest'
}

// In Gretty version 3.x, it was possible to run the appRun task without the /src/main/webapp directory.
// However, strangely, in version 4.x, this directory is required.
task createWebAppDir {
doLast {
def webAppDir = new File(project.projectDir, '/src/main/webapp')
if (!webAppDir.exists()) {
webAppDir.mkdirs()
}
}
}

project.afterEvaluate {
tasks.named('appRun').configure {
dependsOn createWebAppDir
}
}

Task prepareAppServerForIntegrationTests = project.tasks.create('prepareAppServerForIntegrationTests') {
group = 'Verification'
description = 'Prepares the app server for integration tests'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

package example;

import jakarta.servlet.Filter;

import org.springframework.web.filter.HiddenHttpMethodFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

public class MvcWebApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
Expand All @@ -37,10 +34,4 @@ protected Class<?>[] getServletConfigClasses() {
protected String[] getServletMappings() {
return new String[] { "/" };
}

@Override
protected Filter[] getServletFilters() {
return new Filter[] { new HiddenHttpMethodFilter() };
}

}

0 comments on commit 0e6fc9c

Please sign in to comment.