This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/master by this push:
new 5d3ed71b7c FELIX-6710 : Ability to configure URI Compliance mode
5d3ed71b7c is described below
commit 5d3ed71b7c70080d4cfb4c1797bf21e1f4268862
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Mon Jun 10 15:57:30 2024 +0200
FELIX-6710 : Ability to configure URI Compliance mode
---
.../felix/http/jetty/internal/ConfigMetaTypeProvider.java | 6 ++++++
.../org/apache/felix/http/jetty/internal/JettyConfig.java | 3 +++
.../org/apache/felix/http/jetty/internal/JettyService.java | 13 ++++++++++++-
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git
a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
index 23881465a8..1f57be2fae 100644
---
a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
+++
b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/ConfigMetaTypeProvider.java
@@ -284,6 +284,12 @@ class ConfigMetaTypeProvider implements MetaTypeProvider
false,
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_SESSION_COOKIE_SECURE)));
+ adList.add(new
AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_URI_COMPLIANCE_MODE,
+ "Jetty URI compliance mode",
+ "Jetty URI compliance mode (if not set, Jetty will configure a
default)",
+ null,
+
bundle.getBundleContext().getProperty(JettyConfig.FELIX_JETTY_URI_COMPLIANCE_MODE)));
+
adList.add(new
AttributeDefinitionImpl(JettyConfig.FELIX_JETTY_SERVLET_SESSION_ID_PATH_PARAMETER_NAME,
"Session Id path parameter",
"Defaults to jsessionid. If set to null or \"none\" no URL
rewriting will be done.",
diff --git
a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
index bb94561c84..f4c4b439f2 100644
---
a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
+++
b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyConfig.java
@@ -166,6 +166,9 @@ public final class JettyConfig
/** Felix specific property to configure session max age */
public static final String FELIX_JETTY_SERVLET_SESSION_MAX_AGE =
"org.eclipse.jetty.servlet.MaxAge";
+ /** Felix specific property to configure the uri compliance mode
(https://jetty.org/docs/jetty/11/programming-guide/server/compliance.html#uri)
*/
+ public static final String FELIX_JETTY_URI_COMPLIANCE_MODE =
"org.eclipse.jetty.UriComplianceMode";
+
/** Felix specific property to configure session scavenging interval in
Seconds */
public static final String FELIX_JETTY_SESSION_SCAVENGING_INTERVAL =
"org.eclipse.jetty.servlet.SessionScavengingInterval";
diff --git
a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
index 123deefc2e..b62f218fa2 100644
---
a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
+++
b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
@@ -32,6 +32,7 @@ import
org.apache.felix.http.base.internal.HttpServiceController;
import org.apache.felix.http.base.internal.logger.SystemLogger;
import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory;
import org.eclipse.jetty.http.HttpVersion;
+import org.eclipse.jetty.http.UriCompliance;
import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
import org.eclipse.jetty.io.ConnectionStatistics;
import org.eclipse.jetty.security.HashLoginService;
@@ -49,6 +50,7 @@ import org.eclipse.jetty.server.handler.gzip.GzipHandler;
import org.eclipse.jetty.server.session.HouseKeeper;
import org.eclipse.jetty.server.session.SessionHandler;
import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
@@ -671,11 +673,20 @@ public final class JettyService
private void configureHttpConnectionFactory(HttpConnectionFactory
connFactory)
{
- HttpConfiguration config = connFactory.getHttpConfiguration();
+ final HttpConfiguration config = connFactory.getHttpConfiguration();
config.setRequestHeaderSize(this.config.getHeaderSize());
config.setResponseHeaderSize(this.config.getHeaderSize());
config.setOutputBufferSize(this.config.getResponseBufferSize());
+ final String uriComplianceMode =
this.config.getProperty(JettyConfig.FELIX_JETTY_URI_COMPLIANCE_MODE, null);
+ if (uriComplianceMode != null) {
+ try {
+
config.setUriCompliance(UriCompliance.valueOf(uriComplianceMode));
+ } catch (IllegalArgumentException e) {
+ SystemLogger.LOGGER.warn("Invalid URI compliance mode: {}",
uriComplianceMode);
+ }
+ }
+
// HTTP/1.1 requires Date header if possible (it is)
config.setSendDateHeader(true);
config.setSendServerVersion(this.config.isSendServerHeader());