You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "paulrutter (via GitHub)" <gi...@apache.org> on 2024/03/25 20:51:13 UTC
[PR] Update Felix HTTP documentation [felix-dev]
paulrutter opened a new pull request, #303:
URL: https://github.com/apache/felix-dev/pull/303
See https://issues.apache.org/jira/browse/FELIX-6694.
A short summary of the changes made:
- Removed cometd, last released version is from 2014 and nowadays, websockets should be used instead
- update bundle versions
- add jetty 12 and wrappers bundles
- update jetty properties
- update code examples
- update servlet, filter properties. Add OSGi reference links for full documentation.
I would need some help on the HTTP/2 part, as i'm not sure that information is still up-to-date / required.
The Jetty12 bundle seems to offer all relevant HTTP/2 dependencies already. That part of the documentation should be updated still.
Also, when https://github.com/apache/felix-dev/pull/298 is merged, the readme (and ideally the code examples) should be updated to reflect.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "paulrutter (via GitHub)" <gi...@apache.org>.
paulrutter commented on PR #303:
URL: https://github.com/apache/felix-dev/pull/303#issuecomment-2027195571
Ah thanks, i will update the docs to reflect.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "stbischof (via GitHub)" <gi...@apache.org>.
stbischof commented on PR #303:
URL: https://github.com/apache/felix-dev/pull/303#issuecomment-2051982482
LGTM,
When you are ready you may should ask Carsten.
I would not merge into things where he is the guru
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "paulrutter (via GitHub)" <gi...@apache.org>.
paulrutter commented on PR #303:
URL: https://github.com/apache/felix-dev/pull/303#issuecomment-2025468994
Then i would first need to know what the difference is with the full bundle; from the looks of it it's just exposing less package in the pom.xml, that's it.
I can add some information on this if that would be helpful though. Do you know what the light version is used for?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "stbischof (via GitHub)" <gi...@apache.org>.
stbischof commented on PR #303:
URL: https://github.com/apache/felix-dev/pull/303#issuecomment-2025249135
may you add some docs about the jetty12-light bundle? would be great.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "paulrutter (via GitHub)" <gi...@apache.org>.
paulrutter commented on PR #303:
URL: https://github.com/apache/felix-dev/pull/303#issuecomment-2053520422
@cziegeler can you review the changes to see if it makes sense and is correct?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "stbischof (via GitHub)" <gi...@apache.org>.
stbischof commented on PR #303:
URL: https://github.com/apache/felix-dev/pull/303#issuecomment-2027070132
It is Published on mavencentral!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "stbischof (via GitHub)" <gi...@apache.org>.
stbischof commented on code in PR #303:
URL: https://github.com/apache/felix-dev/pull/303#discussion_r1561367912
##########
http/README.md:
##########
@@ -58,48 +77,75 @@ of additional bundles to deploy [as described in the jetty documentation](https:
The OSGi whiteboard implementation simplifies the task of registering servlets, filters, resources, listeners, and servlet contexts. For a complete introduction, please refer to the OSGi R7 Compendium or Enterprise specification.
-For a short introduction: Such a whiteboard service can be registered by exporting it as a service, making it no longer necessary to track and use the `HttpService` directly. The
-whiteboard implementation detects all `javax.servlet.Servlet` and `javax.servlet.Filter` services with the right service properties. Let us illustrate the usage by registering a servlet:
+For a short introduction: Such a whiteboard service can be registered by exporting it as a service, making it no longer necessary to track and use the `HttpService` directly (or the `ExtHttpService` in legacy implementations, for registering filters). The
+whiteboard implementation detects all `jakarta.servlet.Servlet` and `jakarta.servlet.Filter` services with the right service properties. Let us illustrate the usage by registering a servlet and a filter:
```java
public class Activator implements BundleActivator {
- private ServiceRegistration registration;
+ private ServiceRegistration<Servlet> servletRegistration;
+ private ServiceRegistration<Filter> filterRegistration;
public void start(BundleContext context) throws Exception {
- Hashtable props = new Hashtable();
- props.put("osgi.http.whiteboard.servlet.pattern", "/hello");
- props.put("servlet.init.message", "Hello World!");
+ Hashtable propsServlet = new Hashtable();
+ propsServlet.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/hello");
+ propsServlet.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED, true);
+ propsServlet.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_INIT_PARAM_PREFIX + "message", "Hello World servlet!");
+
+ this.servletRegistration = context.registerService(Servlet.class.getName(), new HelloWorldServlet(), propsServlet);
+
+ Hashtable propsFilter = new Hashtable();
+ propsFilter.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_REGEX, ".*");
+ propsFilter.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_ASYNC_SUPPORTED, true);
+ propsFilter.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_INIT_PARAM_PREFIX + "message", "Hello World filter!");
- this.registration = context.registerService(Servlet.class.getName(), new HelloWorldServlet(), props);
+ this.filterRegistration = context.registerService(Filter.class.getName(), new HelloWorldFilter(), propsFilter);
}
public void stop(BundleContext context) throws Exception {
- this.registration.unregister();
+ this.servletRegistration.unregister();
+ this.filterRegistration.unregister();
}
}
```
+An implementation note for when using the Felix HTTP Jetty 12 bundle: only registering a filter without a servlet, will not work. Make sure that there is a servlet registered (on the same path as the filter) when registering a filter, even when that servlet is not hit eventually.
To ensure the HTTP whiteboard service picks up your servlet and filter correctly, your service
registration *must* provide several service properties.
### Servlet service properties
+See full reference in the [OSGi specification](https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#service.http.whiteboard-i21223311).
Review Comment:
https://docs.osgi.org/specification/osgi.cmpn/8.1.0/
we should look to 8.1 release
##########
http/README.md:
##########
@@ -58,48 +77,75 @@ of additional bundles to deploy [as described in the jetty documentation](https:
The OSGi whiteboard implementation simplifies the task of registering servlets, filters, resources, listeners, and servlet contexts. For a complete introduction, please refer to the OSGi R7 Compendium or Enterprise specification.
-For a short introduction: Such a whiteboard service can be registered by exporting it as a service, making it no longer necessary to track and use the `HttpService` directly. The
-whiteboard implementation detects all `javax.servlet.Servlet` and `javax.servlet.Filter` services with the right service properties. Let us illustrate the usage by registering a servlet:
+For a short introduction: Such a whiteboard service can be registered by exporting it as a service, making it no longer necessary to track and use the `HttpService` directly (or the `ExtHttpService` in legacy implementations, for registering filters). The
+whiteboard implementation detects all `jakarta.servlet.Servlet` and `jakarta.servlet.Filter` services with the right service properties. Let us illustrate the usage by registering a servlet and a filter:
```java
public class Activator implements BundleActivator {
- private ServiceRegistration registration;
+ private ServiceRegistration<Servlet> servletRegistration;
+ private ServiceRegistration<Filter> filterRegistration;
public void start(BundleContext context) throws Exception {
- Hashtable props = new Hashtable();
- props.put("osgi.http.whiteboard.servlet.pattern", "/hello");
- props.put("servlet.init.message", "Hello World!");
+ Hashtable propsServlet = new Hashtable();
+ propsServlet.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/hello");
+ propsServlet.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED, true);
+ propsServlet.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_INIT_PARAM_PREFIX + "message", "Hello World servlet!");
+
+ this.servletRegistration = context.registerService(Servlet.class.getName(), new HelloWorldServlet(), propsServlet);
+
+ Hashtable propsFilter = new Hashtable();
+ propsFilter.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_REGEX, ".*");
+ propsFilter.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_ASYNC_SUPPORTED, true);
+ propsFilter.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_INIT_PARAM_PREFIX + "message", "Hello World filter!");
- this.registration = context.registerService(Servlet.class.getName(), new HelloWorldServlet(), props);
+ this.filterRegistration = context.registerService(Filter.class.getName(), new HelloWorldFilter(), propsFilter);
}
public void stop(BundleContext context) throws Exception {
- this.registration.unregister();
+ this.servletRegistration.unregister();
+ this.filterRegistration.unregister();
}
}
```
+An implementation note for when using the Felix HTTP Jetty 12 bundle: only registering a filter without a servlet, will not work. Make sure that there is a servlet registered (on the same path as the filter) when registering a filter, even when that servlet is not hit eventually.
To ensure the HTTP whiteboard service picks up your servlet and filter correctly, your service
registration *must* provide several service properties.
### Servlet service properties
+See full reference in the [OSGi specification](https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#service.http.whiteboard-i21223311).
+The most important properties are:
+
* `osgi.http.whiteboard.servlet.pattern` - defines the servlet pattern to register the servlet under, should be a path as defined in the Servlet specification.
* `osgi.http.whiteboard.context.select` - Filter expression to select the servlet context (optional).
+ * `osgi.http.whiteboard.servlet.asyncSupported` - Declares whether the servlet supports the asynchronous operation mode. Allowed values are true and false independent of case. Defaults to false. (optional)
+ * `osgi.http.whiteboard.servlet.multipart.enable` - Enables support for multipart configuration on the servlet. Allowed values are true and false independent of case. Defaults to false. (optional)
* `servlet.init.*` - these properties (sans the `servlet.init.` prefix) are made available throught the `ServletConfig` object of your servlet. This allows you to supply your servlet initialization parameters as you would normally do in the web descriptor (web.xml).
### Filter service properties
+See full reference in the [OSGi specification](https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e121055).
Review Comment:
https://docs.osgi.org/specification/osgi.cmpn/8.1.0/
we should look to 8.1 release
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "stbischof (via GitHub)" <gi...@apache.org>.
stbischof commented on code in PR #303:
URL: https://github.com/apache/felix-dev/pull/303#discussion_r1561374629
##########
http/README.md:
##########
@@ -1,44 +1,63 @@
# Apache Felix HTTP Service
-This is an implementation of the [HTTP Whiteboard Service as described in chapter 140](https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html) of the OSGi Compendium (R7) in combination with an implementation of the [HTTP Service Specification as described in chapter 102](https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.html) of the OSGi Compendium. The goal is to provide a standard and simplified way to register servlets, listeners, filters, and resources in a servlet container, to managed them in servlet contexts, and to associate them with URIs. Complete set of features:
+This is an implementation of the [R8.1 Whiteboard Specification for Jakarta Servlet](https://docs.osgi.org/specification/osgi.cmpn/8.1.0/service.servlet.html), [HTTP Whiteboard Service as described in chapter 140](https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html) of the OSGi Compendium (R7) in combination with an implementation of the [HTTP Service Specification as described in chapter 102](https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.html) of the OSGi Compendium. The goal is to provide a standard and simplified way to register servlets, listeners, filters, and resources in a servlet container, to managed them in servlet contexts, and to associate them with URIs. Complete set of features:
* Standard OSGi Http Service implementation
* Standard OSGi Http Whiteboard implementation
- * Run either with Jetty or inside your own application server using the servlet bridge
+ * Run either with Jetty (version 11 or 12) bundle or inside your own application server using the servlet bridge
+ * [Felix HTTP Jetty 12](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty12) is the preferred bundle of choice as it supports JavaEE 8 and JakartaEE 8 with the `javax` namespace, JakartaEE 9/10/11/future versions with the `jakarta` namespace.
+ * [Jetty WebSocket support](https://github.com/apache/felix-dev/pull/298)
+ * [Felix HTTP Jetty 11](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty) is the predecessor of the Jetty 12 bundle, which shipped with [Jetty 9.4.x](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty/4.2.26) in the 4.x range, [Jetty 11.x](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty/5.1.10) in the 5.x range.
* Correctly versioned Servlet API.
## Installing
The Apache Felix HTTP Service project includes several bundles.
- * `org.apache.felix.http.servlet-api` - Provides the Servlet API (versions 2.6, 3.0, and 3.1 of the Servlet specification)
- * `org.apache.felix.http.api` - Provides the OSGi APIs for the Http Whiteboard and Http Service.
- * `org.apache.felix.http.jetty` - Implementation that is embedding Jetty server (currently Jetty 9, requiring Java 8). This bundle includes the http.api bundle.
- * `org.apache.felix.http.sslfilter` - Servlet filter for handling SSL termination.
- * `org.apache.felix.http.bridge` - Implementation that uses the host application server (bridged mode). Must be used with the proxy (see below)
- * `org.apache.felix.http.cometd` - Adds Comet/Ajax Push functionality to the HTTP Service implementation.
- * `org.apache.felix.http.proxy` - Proxy that is needed inside WAR when deployed inside an application server.
+ * [`org.apache.felix.http.servlet-api`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.servlet-api) - Provides the Servlet API (versions 2.6, 3.0, 3.1, 4.0, 5.0 and 6.0 of the Servlet specification)
+ * [`org.apache.felix.http.api`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.api) - Provides the OSGi APIs for the Http Whiteboard and Http Service.
+ * [`org.apache.felix.http.jetty12`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty12) - Implementation that is embedding Jetty server (currently Jetty 12.x, requiring Java 17). This bundle includes the http.api bundle. It's the the preferred Felix Jetty bundle to use, as Jetty 11 will be [EoL in 2025](https://github.com/jetty/jetty.project/issues/10485).
+ * [`org.apache.felix.http.jetty`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty) - Predecessor implementation that is embedding Jetty server (currently Jetty 11.x, requiring Java 11). This bundle includes the http.api bundle.
+ * [`org.apache.felix.http.sslfilter`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.sslfilter) - Servlet filter for handling SSL termination.
+ * [`org.apache.felix.http.bridge`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.bridge) - Implementation that uses the host application server (bridged mode). Must be used with the proxy (see below)
+ * [`org.apache.felix.http.proxy`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.proxy) - Proxy that is needed inside WAR when deployed inside an application server.
+ * [`org.apache.felix.http.wrappers`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.wrappers) offers wrapper classes that can be used when transitioning to the `jakarta` namespace, while having libraries that don't offer a jakartified version yet.
Note that as of version **3.x**, the Servlet APIs are **no longer** packaged with the implementation bundles! If you are migrating from lower versions, be sure to add the
`org.apache.felix.http.servlet-api` (or any other compatible Serlvet API bundle) to your
classpath and deployment!
+### Light bundle
+If you would like to use your own Jetty jar instead of the one packaged with the Felix Jetty bundles, you can use the `light` variant.
+When building the Felix Jetty bundle with Maven (`mvn clean install`), the `light` bundle will be created in the `target` directory, postfixed with `-light.jar`.
+This jar can be deployed to your Felix OSGi environment, along with a compatible Jetty jar.
Review Comment:
could you add this
```
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.jetty12</artifactId>
<version>1.0.2</version>
<classifier>light</classifier>
<scope>runtime</scope>
</dependency>
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "paulrutter (via GitHub)" <gi...@apache.org>.
paulrutter commented on PR #303:
URL: https://github.com/apache/felix-dev/pull/303#issuecomment-2024792144
I looked into enabling HTTP/2 support with the Jetty12 bundle, and make some changes to the documentation to reflect this.
HTTP/2 is now up and running for me with Jetty 12.
BTW: It seems that `jetty-alpn-server` makes no sense to have in the Jetty12 bundle (as dependency), as it only works when having that bundle started separatly after the ServiceLoader bundles have been started.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "stbischof (via GitHub)" <gi...@apache.org>.
stbischof commented on PR #303:
URL: https://github.com/apache/felix-dev/pull/303#issuecomment-2026818487
The light version does not package jettty in the jar. This way you can add jetty as a normal dependency..
Hoped you are in contact with someone else who knows more
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "stbischof (via GitHub)" <gi...@apache.org>.
stbischof commented on code in PR #303:
URL: https://github.com/apache/felix-dev/pull/303#discussion_r1561368301
##########
http/README.md:
##########
@@ -58,48 +77,75 @@ of additional bundles to deploy [as described in the jetty documentation](https:
The OSGi whiteboard implementation simplifies the task of registering servlets, filters, resources, listeners, and servlet contexts. For a complete introduction, please refer to the OSGi R7 Compendium or Enterprise specification.
-For a short introduction: Such a whiteboard service can be registered by exporting it as a service, making it no longer necessary to track and use the `HttpService` directly. The
-whiteboard implementation detects all `javax.servlet.Servlet` and `javax.servlet.Filter` services with the right service properties. Let us illustrate the usage by registering a servlet:
+For a short introduction: Such a whiteboard service can be registered by exporting it as a service, making it no longer necessary to track and use the `HttpService` directly (or the `ExtHttpService` in legacy implementations, for registering filters). The
+whiteboard implementation detects all `jakarta.servlet.Servlet` and `jakarta.servlet.Filter` services with the right service properties. Let us illustrate the usage by registering a servlet and a filter:
```java
public class Activator implements BundleActivator {
- private ServiceRegistration registration;
+ private ServiceRegistration<Servlet> servletRegistration;
+ private ServiceRegistration<Filter> filterRegistration;
public void start(BundleContext context) throws Exception {
- Hashtable props = new Hashtable();
- props.put("osgi.http.whiteboard.servlet.pattern", "/hello");
- props.put("servlet.init.message", "Hello World!");
+ Hashtable propsServlet = new Hashtable();
+ propsServlet.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN, "/hello");
+ propsServlet.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ASYNC_SUPPORTED, true);
+ propsServlet.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_INIT_PARAM_PREFIX + "message", "Hello World servlet!");
+
+ this.servletRegistration = context.registerService(Servlet.class.getName(), new HelloWorldServlet(), propsServlet);
+
+ Hashtable propsFilter = new Hashtable();
+ propsFilter.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_REGEX, ".*");
+ propsFilter.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_ASYNC_SUPPORTED, true);
+ propsFilter.put(HttpWhiteboardConstants.HTTP_WHITEBOARD_FILTER_INIT_PARAM_PREFIX + "message", "Hello World filter!");
- this.registration = context.registerService(Servlet.class.getName(), new HelloWorldServlet(), props);
+ this.filterRegistration = context.registerService(Filter.class.getName(), new HelloWorldFilter(), propsFilter);
}
public void stop(BundleContext context) throws Exception {
- this.registration.unregister();
+ this.servletRegistration.unregister();
+ this.filterRegistration.unregister();
}
}
```
+An implementation note for when using the Felix HTTP Jetty 12 bundle: only registering a filter without a servlet, will not work. Make sure that there is a servlet registered (on the same path as the filter) when registering a filter, even when that servlet is not hit eventually.
To ensure the HTTP whiteboard service picks up your servlet and filter correctly, your service
registration *must* provide several service properties.
### Servlet service properties
+See full reference in the [OSGi specification](https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#service.http.whiteboard-i21223311).
+The most important properties are:
+
* `osgi.http.whiteboard.servlet.pattern` - defines the servlet pattern to register the servlet under, should be a path as defined in the Servlet specification.
* `osgi.http.whiteboard.context.select` - Filter expression to select the servlet context (optional).
+ * `osgi.http.whiteboard.servlet.asyncSupported` - Declares whether the servlet supports the asynchronous operation mode. Allowed values are true and false independent of case. Defaults to false. (optional)
+ * `osgi.http.whiteboard.servlet.multipart.enable` - Enables support for multipart configuration on the servlet. Allowed values are true and false independent of case. Defaults to false. (optional)
* `servlet.init.*` - these properties (sans the `servlet.init.` prefix) are made available throught the `ServletConfig` object of your servlet. This allows you to supply your servlet initialization parameters as you would normally do in the web descriptor (web.xml).
### Filter service properties
+See full reference in the [OSGi specification](https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e121055).
+The most important properties are:
+
* `osgi.http.whiteboard.filter.regex` - The regular expression pattern to register filter with.
* `osgi.http.whiteboard.context.select` - Filter expression to select the servlet context (optional).
- * `service.ranking` - an integer value that allows you to specify where in the filter chain the filter should be registered. Higher rankings will be placed first in the chain, that is, filter chains are sorted in descending order. If omitted, a ranking of zero (0) is used.
+ * `osgi.http.whiteboard.filter.pattern` - Apply this servlet filter to the specified URL path patterns. The format of the patterns is specified in the servlet specification.
+ * `osgi.http.whiteboard.filter.asyncSupported` - Declares whether the servlet filter supports asynchronous operation mode. Allowed values are true and false independent of case. Defaults to false. (optional)
* `filter.init.*` - these properties (sans the `filter.init.` prefix) are made available throught the `FilterConfig` object of your filter. This allows you to supply your filter initialization parameters as you would normally do in the web descriptor (web.xml).
+The order of filters is no longer managed by the `service.ranking` property, but by implementing the `compareTo` method.
+Multiple servlet filters can process the same servlet request/response. If more than one Filter matches, they are processed in ranking order, as specified in `ServiceReference.compareTo`. The servlet filter with the highest ranking is processed first in the filter chain, while the servlet filter with the lowest ranking is processed last, before the Servlet.service method is called. After the servlet completes its service method the filter chain is unwound in reverse order.
+
### ServletContextHelper service properties
+See full reference in the [OSGi specification](https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#service.http.whiteboard.servletcontext).
Review Comment:
https://docs.osgi.org/specification/osgi.cmpn/8.1.0/
we should look to 8.1 release
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "stbischof (via GitHub)" <gi...@apache.org>.
stbischof commented on code in PR #303:
URL: https://github.com/apache/felix-dev/pull/303#discussion_r1561374629
##########
http/README.md:
##########
@@ -1,44 +1,63 @@
# Apache Felix HTTP Service
-This is an implementation of the [HTTP Whiteboard Service as described in chapter 140](https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html) of the OSGi Compendium (R7) in combination with an implementation of the [HTTP Service Specification as described in chapter 102](https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.html) of the OSGi Compendium. The goal is to provide a standard and simplified way to register servlets, listeners, filters, and resources in a servlet container, to managed them in servlet contexts, and to associate them with URIs. Complete set of features:
+This is an implementation of the [R8.1 Whiteboard Specification for Jakarta Servlet](https://docs.osgi.org/specification/osgi.cmpn/8.1.0/service.servlet.html), [HTTP Whiteboard Service as described in chapter 140](https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html) of the OSGi Compendium (R7) in combination with an implementation of the [HTTP Service Specification as described in chapter 102](https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.html) of the OSGi Compendium. The goal is to provide a standard and simplified way to register servlets, listeners, filters, and resources in a servlet container, to managed them in servlet contexts, and to associate them with URIs. Complete set of features:
* Standard OSGi Http Service implementation
* Standard OSGi Http Whiteboard implementation
- * Run either with Jetty or inside your own application server using the servlet bridge
+ * Run either with Jetty (version 11 or 12) bundle or inside your own application server using the servlet bridge
+ * [Felix HTTP Jetty 12](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty12) is the preferred bundle of choice as it supports JavaEE 8 and JakartaEE 8 with the `javax` namespace, JakartaEE 9/10/11/future versions with the `jakarta` namespace.
+ * [Jetty WebSocket support](https://github.com/apache/felix-dev/pull/298)
+ * [Felix HTTP Jetty 11](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty) is the predecessor of the Jetty 12 bundle, which shipped with [Jetty 9.4.x](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty/4.2.26) in the 4.x range, [Jetty 11.x](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty/5.1.10) in the 5.x range.
* Correctly versioned Servlet API.
## Installing
The Apache Felix HTTP Service project includes several bundles.
- * `org.apache.felix.http.servlet-api` - Provides the Servlet API (versions 2.6, 3.0, and 3.1 of the Servlet specification)
- * `org.apache.felix.http.api` - Provides the OSGi APIs for the Http Whiteboard and Http Service.
- * `org.apache.felix.http.jetty` - Implementation that is embedding Jetty server (currently Jetty 9, requiring Java 8). This bundle includes the http.api bundle.
- * `org.apache.felix.http.sslfilter` - Servlet filter for handling SSL termination.
- * `org.apache.felix.http.bridge` - Implementation that uses the host application server (bridged mode). Must be used with the proxy (see below)
- * `org.apache.felix.http.cometd` - Adds Comet/Ajax Push functionality to the HTTP Service implementation.
- * `org.apache.felix.http.proxy` - Proxy that is needed inside WAR when deployed inside an application server.
+ * [`org.apache.felix.http.servlet-api`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.servlet-api) - Provides the Servlet API (versions 2.6, 3.0, 3.1, 4.0, 5.0 and 6.0 of the Servlet specification)
+ * [`org.apache.felix.http.api`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.api) - Provides the OSGi APIs for the Http Whiteboard and Http Service.
+ * [`org.apache.felix.http.jetty12`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty12) - Implementation that is embedding Jetty server (currently Jetty 12.x, requiring Java 17). This bundle includes the http.api bundle. It's the the preferred Felix Jetty bundle to use, as Jetty 11 will be [EoL in 2025](https://github.com/jetty/jetty.project/issues/10485).
+ * [`org.apache.felix.http.jetty`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.jetty) - Predecessor implementation that is embedding Jetty server (currently Jetty 11.x, requiring Java 11). This bundle includes the http.api bundle.
+ * [`org.apache.felix.http.sslfilter`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.sslfilter) - Servlet filter for handling SSL termination.
+ * [`org.apache.felix.http.bridge`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.bridge) - Implementation that uses the host application server (bridged mode). Must be used with the proxy (see below)
+ * [`org.apache.felix.http.proxy`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.proxy) - Proxy that is needed inside WAR when deployed inside an application server.
+ * [`org.apache.felix.http.wrappers`](https://mvnrepository.com/artifact/org.apache.felix/org.apache.felix.http.wrappers) offers wrapper classes that can be used when transitioning to the `jakarta` namespace, while having libraries that don't offer a jakartified version yet.
Note that as of version **3.x**, the Servlet APIs are **no longer** packaged with the implementation bundles! If you are migrating from lower versions, be sure to add the
`org.apache.felix.http.servlet-api` (or any other compatible Serlvet API bundle) to your
classpath and deployment!
+### Light bundle
+If you would like to use your own Jetty jar instead of the one packaged with the Felix Jetty bundles, you can use the `light` variant.
+When building the Felix Jetty bundle with Maven (`mvn clean install`), the `light` bundle will be created in the `target` directory, postfixed with `-light.jar`.
+This jar can be deployed to your Felix OSGi environment, along with a compatible Jetty jar.
Review Comment:
could you add this
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.jetty12</artifactId>
<version>1.0.2</version>
<classifier>light</classifier>
<scope>runtime</scope>
</dependency>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "paulrutter (via GitHub)" <gi...@apache.org>.
paulrutter commented on PR #303:
URL: https://github.com/apache/felix-dev/pull/303#issuecomment-2026824021
@stbischof i'm not in contact, but i see how this could work.
Although i doubt this should be documented as the bundle is not even published to maven central, i will add a short description for it in the README.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "cziegeler (via GitHub)" <gi...@apache.org>.
cziegeler commented on PR #303:
URL: https://github.com/apache/felix-dev/pull/303#issuecomment-2054062082
Thanks @paulrutter - I applied your changes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update Felix HTTP documentation [felix-dev]
Posted by "cziegeler (via GitHub)" <gi...@apache.org>.
cziegeler merged PR #303:
URL: https://github.com/apache/felix-dev/pull/303
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@felix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org