This is an automated email from the ASF dual-hosted git repository.
robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git
The following commit(s) were added to refs/heads/master by this push:
new 3006bdaf73 update spring boot demo code for jakarta and Wildfly 32
3006bdaf73 is described below
commit 3006bdaf732920780d46e7a6ccb7aa41c4db8df6
Author: Robert Lazarski <[email protected]>
AuthorDate: Thu Aug 1 20:47:46 2024 -1000
update spring boot demo code for jakarta and Wildfly 32
---
.../userguide/src/userguide/springbootdemo/pom.xml | 123 ++++++++++++---------
.../springbootdemo/resources-axis2/conf/axis2.xml | 9 ++
.../userguide/springboot/Axis2Application.java | 51 ++++-----
.../configuration/Axis2WebAppInitializer.java | 4 +-
.../security/webservices/BadRequestMatcher.java | 4 +-
.../webservices/HTTPPostOnlyRejectionFilter.java | 8 +-
.../webservices/JWTAuthenticationFilter.java | 8 +-
.../JWTAuthenticationSuccessHandler.java | 4 +-
.../RequestAndResponseValidatorFilter.java | 37 +++----
.../webservices/RestAuthenticationEntryPoint.java | 4 +-
.../security/webservices/WSLoginFilter.java | 12 +-
.../webservices/secure/LoginService.java | 2 +-
.../main/resources/esapi-java-logging.properties | 6 -
.../webapp/WEB-INF/jboss-deployment-structure.xml | 11 +-
.../apache/axis2/transport/http/AxisServlet.java | 2 +-
src/site/xdoc/docs/json-springboot-userguide.xml | 5 +-
16 files changed, 157 insertions(+), 133 deletions(-)
diff --git a/modules/samples/userguide/src/userguide/springbootdemo/pom.xml
b/modules/samples/userguide/src/userguide/springbootdemo/pom.xml
index 8b8a5238f6..00027132ad 100644
--- a/modules/samples/userguide/src/userguide/springbootdemo/pom.xml
+++ b/modules/samples/userguide/src/userguide/springbootdemo/pom.xml
@@ -33,15 +33,15 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
- <version>2.7.0</version>
+ <version>3.3.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <java.version>1.8</java.version>
- <spring-boot.version>2.6.4</spring-boot.version>
+ <java.version>17</java.version>
+ <spring-boot.version>3.3.2</spring-boot.version>
</properties>
<dependencies>
@@ -61,27 +61,32 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
- <version>3.12.0</version>
- </dependency>
- <dependency>
- <groupId>com.sun.mail</groupId>
- <artifactId>jakarta.mail</artifactId>
- <version>1.6.7</version>
+ <version>3.15.0</version>
</dependency>
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
- <version>1.2.1</version>
+ <version>2.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.angus</groupId>
+ <artifactId>angus-activation</artifactId>
+ <version>2.0.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
- <version>2.3.6</version>
+ <version>4.0.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jaxb</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ <version>4.0.3</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
- <version>2.3.3</version>
+ <version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -90,7 +95,7 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jul</artifactId>
- <version>2.17.2</version>
+ <version>2.23.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -129,17 +134,18 @@
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
- <version>6.0.0</version>
+ <version>6.1.0</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
- <version>2.7.0</version>
+ <version>3.3.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>2.11.0</version>
+ <version>2.16.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
@@ -157,10 +163,15 @@
<version>1.7</version>
</dependency>
<!-- axis2 -->
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-fileupload2-core</artifactId>
+ <version>2.0.0-M2</version>
+ </dependency>
<dependency>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- <version>1.5</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-fileupload2-jakarta-servlet6</artifactId>
+ <version>2.0.0-M2</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
@@ -175,52 +186,52 @@
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
- <version>1.8.1</version>
+ <version>1.8.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
- <version>1.8.1</version>
+ <version>1.8.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
- <version>1.8.1</version>
+ <version>1.8.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-json</artifactId>
- <version>1.8.1</version>
+ <version>1.8.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-ant-plugin</artifactId>
- <version>1.8.1</version>
+ <version>1.8.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
- <version>1.8.1</version>
+ <version>1.8.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-java2wsdl</artifactId>
- <version>1.8.1</version>
+ <version>1.8.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-metadata</artifactId>
- <version>1.8.1</version>
+ <version>1.8.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-spring</artifactId>
- <version>1.8.1</version>
+ <version>1.8.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-jaxws</artifactId>
- <version>1.8.1</version>
+ <version>1.8.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.neethi</groupId>
@@ -247,30 +258,35 @@
<artifactId>stax2-api</artifactId>
<version>4.2.1</version>
</dependency>
- <dependency>
- <groupId>jaxen</groupId>
- <artifactId>jaxen</artifactId>
- <version>1.2.0</version>
- </dependency>
<dependency>
<groupId>org.apache.woden</groupId>
<artifactId>woden-core</artifactId>
<version>1.0M10</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <version>1.4.0</version>
+ <artifactId>axiom-impl</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-dom</artifactId>
- <version>1.4.0</version>
+ <version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.4.0</version>
+ <artifactId>axiom-jakarta-activation</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-legacy-attachments</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-jakarta-jaxb</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
@@ -280,17 +296,18 @@
<dependency>
<groupId>org.owasp.esapi</groupId>
<artifactId>esapi</artifactId>
- <version>2.5.2.0</version>
+ <version>2.5.4.0</version>
+ <classifier>jakarta</classifier>
</dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.5.13</version>
+ <dependency>
+ <groupId>org.apache.httpcomponents.core5</groupId>
+ <artifactId>httpcore5</artifactId>
+ <version>5.3-beta1</version>
</dependency>
<dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpcore</artifactId>
- <version>4.4.15</version>
+ <groupId>org.apache.httpcomponents.client5</groupId>
+ <artifactId>httpclient5</artifactId>
+ <version>5.3.1</version>
</dependency>
</dependencies>
<build>
@@ -298,7 +315,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
- <version>3.3.0</version>
+ <version>3.7.1</version>
<executions>
<execution>
<id>unpack</id>
@@ -330,13 +347,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
- <version>1.8</version>
+ <version>3.1.0</version>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<configuration>
- <tasks>
+ <target>
<jar
jarfile="${project.build.directory}/deploy/axis2-json-api.war/WEB-INF/services/Login.aar">
<metainf
file="resources-axis2/login_resources/services.xml"/>
</jar>
@@ -360,7 +377,7 @@
<include name="axis2.xml"/>
</fileset>
</copy>
- </tasks>
+ </target>
</configuration>
<goals>
<goal>run</goal>
@@ -371,7 +388,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
- <version>3.3.2</version>
+ <version>3.4.0</version>
<configuration>
<webResources>
<resource>
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/resources-axis2/conf/axis2.xml
b/modules/samples/userguide/src/userguide/springbootdemo/resources-axis2/conf/axis2.xml
index 201b2926ee..1d404bc543 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/resources-axis2/conf/axis2.xml
+++
b/modules/samples/userguide/src/userguide/springbootdemo/resources-axis2/conf/axis2.xml
@@ -25,6 +25,7 @@
<parameter name="hotupdate">false</parameter>
<parameter name="enableMTOM">false</parameter>
<parameter name="enableSwA">false</parameter>
+ <parameter name="enableJSONOnly">true</parameter>
<!--Uncomment if you want to enable file caching for attachments -->
<!--parameter name="cacheAttachments">true</parameter>
@@ -435,6 +436,14 @@
<phaseOrder type="InFlow">
<!-- System predefined phases -->
<phase name="Transport">
+ <handler name="RequestURIBasedDispatcher"
+
class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="SOAPActionBasedDispatcher"
+
class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
<handler name="JSONMessageHandler"
class="org.apache.axis2.json.moshi.JSONMessageHandler">
<order phase="Transport"/>
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/Axis2Application.java
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/Axis2Application.java
index 7aefd003f0..73cb30c642 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/Axis2Application.java
+++
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/Axis2Application.java
@@ -19,10 +19,10 @@
*/
package userguide.springboot;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.Filter;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import jakarta.servlet.Filter;
import java.io.PrintWriter;
import java.io.IOException;
@@ -83,7 +83,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.filter.DelegatingFilterProxy;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
-import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.password.NoOpPasswordEncoder;
import static org.springframework.http.HttpStatus.FORBIDDEN;
@@ -107,13 +106,10 @@ public class Axis2Application extends
SpringBootServletInitializer {
@EnableWebSecurity
@Order(1)
@PropertySource("classpath:application.properties")
- public static class SecurityConfigurationTokenWebServices extends
WebSecurityConfigurerAdapter {
+ public static class SecurityConfigurationTokenWebServices {
private static final Logger logger =
LogManager.getLogger(SecurityConfigurationTokenWebServices.class);
public SecurityConfigurationTokenWebServices() {
- super(true);
- String logPrefix = "SecurityConfigurationTokenWebServices , ";
- logger.debug(logPrefix + "inside constructor, defaults disabled
via super(true) ...");
}
class AnonRequestMatcher implements RequestMatcher {
@@ -255,12 +251,6 @@ public class Axis2Application extends
SpringBootServletInitializer {
auth.authenticationProvider(jwtAuthenticationProvider);
}
- @Override
- protected void configure(final HttpSecurity http) throws Exception {
- String logPrefix =
"StatelessSecurityContextRepository.configure(final HttpSecurity http) , ";
- logger.debug(logPrefix + "inside Spring Boot filter config ...");
- }
-
@Bean
WSLoginFilter wsLoginFilter() throws Exception {
final WSLoginFilter filter = new WSLoginFilter();
@@ -308,7 +298,10 @@ public class Axis2Application extends
SpringBootServletInitializer {
public GenericAccessDecisionManager genericAccessDecisionManager() {
return new GenericAccessDecisionManager();
}
-
+
+ // Note: This nethod is invoked only on token validation after a
successful login
+ // See
https://docs.spring.io/spring-security/reference/servlet/authorization/authorize-http-requests.html
+ // AuthorizationFilter supersedes FilterSecurityInterceptor. To remain
backward compatible, FilterSecurityInterceptor remains the default.
public FilterSecurityInterceptor filterSecurityInterceptor() throws
Exception {
final FilterSecurityInterceptor filterSecurityInterceptor = new
FilterSecurityInterceptor();
filterSecurityInterceptor.setAuthenticationManager(authenticationManager());
@@ -348,22 +341,28 @@ public class Axis2Application extends
SpringBootServletInitializer {
return headerFilter;
}
- @Bean(name = "springSecurityFilterChain")
- public FilterChainProxy springSecurityFilterChain() throws
ServletException, Exception {
+ // these two chains are a binary choice.
+ // A login url will match, otherwise invoke jwtAuthenticationFilter
+
+ @Bean(name = "springSecurityFilterChainLogin")
+ @Order(1)
+ public SecurityFilterChain springSecurityFilterChainLogin() throws
ServletException, Exception {
String logPrefix =
"GenericAccessDecisionManager.springSecurityFilterChain , ";
logger.debug(logPrefix + "inside main filter config ...");
- final List<SecurityFilterChain> listOfFilterChains = new
ArrayList<SecurityFilterChain>();
+ SecurityFilterChain securityFilterChain1 = new
DefaultSecurityFilterChain(new AnonRequestMatcher(), headerWriterFilter(),
httpPostOnlyRejectionFilter(), requestAndResponseValidatorFilter(),
wsLoginFilter(), sessionManagementFilter());
- // these two chains are a binary choice.
- // A login url will match, otherwise invoke jwtAuthenticationFilter
- listOfFilterChains.add(new DefaultSecurityFilterChain(new
AnonRequestMatcher(), headerWriterFilter(), httpPostOnlyRejectionFilter(),
requestAndResponseValidatorFilter(), wsLoginFilter(),
sessionManagementFilter()));
+ return securityFilterChain1;
+ }
- listOfFilterChains.add(new DefaultSecurityFilterChain(new
NegatedRequestMatcher(new AnonRequestMatcher()), headerWriterFilter(),
httpPostOnlyRejectionFilter(), requestAndResponseValidatorFilter(),
jwtAuthenticationFilter(), sessionManagementFilter(),
exceptionTranslationFilter(), filterSecurityInterceptor()));
+ @Bean(name = "springSecurityFilterChainToken")
+ public SecurityFilterChain springSecurityFilterChainToken() throws
ServletException, Exception {
+ String logPrefix =
"GenericAccessDecisionManager.springSecurityFilterChain , ";
+ logger.debug(logPrefix + "inside main filter config ...");
- final FilterChainProxy filterChainProxy = new
FilterChainProxy(listOfFilterChains);
+ SecurityFilterChain securityFilterChain2 = new
DefaultSecurityFilterChain(new NegatedRequestMatcher(new AnonRequestMatcher()),
headerWriterFilter(), httpPostOnlyRejectionFilter(),
requestAndResponseValidatorFilter(), jwtAuthenticationFilter(),
sessionManagementFilter(), exceptionTranslationFilter(),
filterSecurityInterceptor());
- return filterChainProxy;
+ return securityFilterChain2;
}
/**
@@ -420,6 +419,7 @@ public class Axis2Application extends
SpringBootServletInitializer {
return filter;
}
+ /*
@Bean()
FilterRegistrationBean FilterRegistrationBean() {
final FilterRegistrationBean filterRegistrationBean = new
FilterRegistrationBean();
@@ -429,6 +429,7 @@ public class Axis2Application extends
SpringBootServletInitializer {
filterRegistrationBean.addUrlPatterns("/*");
return filterRegistrationBean;
}
+ */
@Bean
AuthenticationEntryPoint forbiddenEntryPoint() {
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/configuration/Axis2WebAppInitializer.java
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/configuration/Axis2WebAppInitializer.java
index 0d3acce633..38e998b5d5 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/configuration/Axis2WebAppInitializer.java
+++
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/configuration/Axis2WebAppInitializer.java
@@ -33,8 +33,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import
org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletRegistration;
+import jakarta.servlet.ServletContext;
+import jakarta.servlet.ServletRegistration;
import java.util.Set;
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/BadRequestMatcher.java
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/BadRequestMatcher.java
index 8adb2a1494..1be1bd72e7 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/BadRequestMatcher.java
+++
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/BadRequestMatcher.java
@@ -22,8 +22,8 @@ package userguide.springboot.security.webservices;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.web.util.matcher.RequestMatcher;
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/HTTPPostOnlyRejectionFilter.java
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/HTTPPostOnlyRejectionFilter.java
index 9b9dd586bc..ba74dbc1e4 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/HTTPPostOnlyRejectionFilter.java
+++
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/HTTPPostOnlyRejectionFilter.java
@@ -28,10 +28,10 @@ import
org.springframework.web.util.ContentCachingResponseWrapper;
import org.springframework.web.util.WebUtils;
import org.springframework.security.web.RedirectStrategy;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/JWTAuthenticationFilter.java
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/JWTAuthenticationFilter.java
index e46c9c718e..4b6e818a9a 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/JWTAuthenticationFilter.java
+++
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/JWTAuthenticationFilter.java
@@ -22,10 +22,10 @@ package userguide.springboot.security.webservices;
import java.io.IOException;
import java.util.UUID;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/JWTAuthenticationSuccessHandler.java
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/JWTAuthenticationSuccessHandler.java
index ae0a6cded1..637f3b851a 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/JWTAuthenticationSuccessHandler.java
+++
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/JWTAuthenticationSuccessHandler.java
@@ -19,8 +19,8 @@
*/
package userguide.springboot.security.webservices;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.Authentication;
import
org.springframework.security.web.authentication.AuthenticationSuccessHandler;
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/RequestAndResponseValidatorFilter.java
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/RequestAndResponseValidatorFilter.java
index 95a2e47cfd..ceafc7a990 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/RequestAndResponseValidatorFilter.java
+++
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/RequestAndResponseValidatorFilter.java
@@ -21,7 +21,6 @@ package userguide.springboot.security.webservices;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.web.filter.OncePerRequestFilter;
import org.springframework.web.util.ContentCachingRequestWrapper;
import org.springframework.web.util.ContentCachingResponseWrapper;
@@ -31,10 +30,10 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import
org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@@ -84,27 +83,21 @@ public class RequestAndResponseValidatorFilter extends
OncePerRequestFilter {
requestBeginTime.set(System.currentTimeMillis());
- String currentUserIPAddress = null;
- if (requestToUse.getHeader("X-Forwarded-For") != null) {
- currentUserIPAddress = requestToUse.getHeader("X-Forwarded-For");
- } else {
- logger.warn(logPrefix + "cannot find X-Forwarded-For header, this
field is required for proper IP auditing");
- logger.warn(logPrefix + "Because no X-Forwarded-For header was
found, setting 'currentUserIPAddress = requestToUse.getRemoteAddr()' which is
typically an internal address");
- currentUserIPAddress = requestToUse.getRemoteAddr();
- }
-
- if (currentUserIPAddress == null || currentUserIPAddress.length() == 0
|| "unknown".equalsIgnoreCase(currentUserIPAddress)) {
- logger.warn(logPrefix + "cannot find valid currentUserIPAddress");
- } else {
- logger.warn(logPrefix + "proceeding on currentUserIPAddress: " +
currentUserIPAddress);
- // rate limiting and extra validation can go here
- }
-
try {
filterChain.doFilter(requestToUse, responseToUse);
} finally {
logRequest(createRequestMessage(requestToUse,uuid));
- logRequest(createResponseMessage(responseToUse,uuid));
+
+ ContentCachingResponseWrapper responseWrapper =
WebUtils.getNativeResponse(responseToUse, ContentCachingResponseWrapper.class);
+ if (responseWrapper != null) {
+ if (isFirstRequest) {
+ try {
+ responseWrapper.copyBodyToResponse();
+ } catch (IOException e) {
+ logger.error("Fail to write response body back", e);
+ }
+ }
+ }
}
}
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/RestAuthenticationEntryPoint.java
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/RestAuthenticationEntryPoint.java
index c7c3e689b8..57a5a71e09 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/RestAuthenticationEntryPoint.java
+++
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/RestAuthenticationEntryPoint.java
@@ -21,8 +21,8 @@ package userguide.springboot.security.webservices;
import java.io.IOException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/WSLoginFilter.java
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/WSLoginFilter.java
index c1df12ebe6..30dcae7ed7 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/WSLoginFilter.java
+++
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/security/webservices/WSLoginFilter.java
@@ -22,12 +22,12 @@ package userguide.springboot.security.webservices;
import java.io.IOException;
import java.util.Enumeration;
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.filter.GenericFilterBean;
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/webservices/secure/LoginService.java
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/webservices/secure/LoginService.java
index 12447c6c27..69ec195eb2 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/webservices/secure/LoginService.java
+++
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/java/userguide/springboot/webservices/secure/LoginService.java
@@ -38,7 +38,7 @@ import userguide.springboot.security.webservices.LoginDTO;
import
userguide.springboot.security.webservices.RequestAndResponseValidatorFilter;
import userguide.springboot.hibernate.dao.SpringSecurityDAOImpl;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.kernel.http.HTTPConstants;
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/resources/esapi-java-logging.properties
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/resources/esapi-java-logging.properties
deleted file mode 100644
index c5f619b9d9..0000000000
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/resources/esapi-java-logging.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-handlers= java.util.logging.ConsoleHandler
-.level= INFO
-java.util.logging.ConsoleHandler.level = INFO
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] [%3$-7s] %5$s %n
-#https://www.logicbig.com/tutorials/core-java-tutorial/logging/customizing-default-format.html
diff --git
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
index 6840eea86c..c09b2c9b73 100644
---
a/modules/samples/userguide/src/userguide/springbootdemo/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
+++
b/modules/samples/userguide/src/userguide/springbootdemo/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
@@ -2,9 +2,18 @@
<deployment>
<exclude-subsystems>
<subsystem name="jaxrs" />
+ <!-- SLF4J conflict, Wildfly 32 and up doesn't play nice with
log4j2 -->
+ <subsystem name="logging" />
</exclude-subsystems>
<exclusions>
- <module name="org.apache.log4j" /> <module
name="org.apache.commons.logging" />
+ <module name="org.apache.log4j" />
+ <module name="org.apache.commons.logging" />
+ <module name="org.jboss.logging" />
+ <module name="org.jboss.logging.jul-to-slf4j-stub" />
+ <module name="org.jboss.logmanager" />
+ <module name="org.jboss.logmanager.log4j" />
+ <module name="org.slf4j" />
+ <module name="org.slf4j.impl" />
</exclusions>
<dependencies>
<module name="jdk.unsupported" slot="main" export="true" />
diff --git
a/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
b/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
index 9af4d508e6..46cc407cc3 100644
---
a/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
+++
b/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
@@ -417,7 +417,7 @@ public class AxisServlet extends HttpServlet {
String status =
(String)
msgContext.getProperty(Constants.HTTP_RESPONSE_STATE);
if (status == null) {
- log.error("processAxisFault() found a null HTTP status
from the MessageContext instance, setting HttpServletResponse status to: " +
Constants.HTTP_RESPONSE_STATE);
+ log.error("processAxisFault() on error message: " +
e.getMessage() + " , found a null HTTP status from the MessageContext instance,
setting HttpServletResponse status to
HttpServletResponse.SC_INTERNAL_SERVER_ERROR");
res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} else {
log.error("processAxisFault() found an HTTP status from
the MessageContext instance, setting HttpServletResponse status to: " + status);
diff --git a/src/site/xdoc/docs/json-springboot-userguide.xml
b/src/site/xdoc/docs/json-springboot-userguide.xml
index be360fe5dc..02167e282d 100644
--- a/src/site/xdoc/docs/json-springboot-userguide.xml
+++ b/src/site/xdoc/docs/json-springboot-userguide.xml
@@ -81,7 +81,7 @@ This quide supplies a pom.xml for building an exploded WAR
with Spring Boot -
however this WAR does not have an embedded web server such as Tomcat.
</p>
<p>
-The testing was carried out on Wildfly, by installing the WAR in its app
server.
+The testing was carried out on Wildfly 32, by installing the WAR in its app
server.
</p>
<p>Please deploy the result of the maven build via 'mvn clean install',
axis2-json-api.war, into your servlet container and ensure that it installs
without any errors.</p>
@@ -121,7 +121,8 @@ The intent of this guide is to show a place that the JWT
and JWE standards can b
implemented.
</p>
<p>
-Axis2 JSON support is via POJO Objects. LoginRequest and LoginResponse are
coded in the LoginService as the names would indicate.
+Axis2 JSON support is via POJO Objects. LoginRequest and LoginResponse are
coded in the LoginService as the names would indicate. A flag in the suupplied
axis2.xml file, enableJSONOnly,
+disables Axis2 functionality not required for JSON and sets up the server to
expect JSON.
</p>
<p>
Also provided is a test service, TestwsService. It includes two POJO Objects
as would