I randomly chose the Tomcat implementation to figure out how it works and I 
did some progress, but unfortunately, I stumble with errors. Thought the 
most critical issue is that it seems to start a new Tomcat Server instance 
listening to the 8080 (default) port. This is not compatible with the 
Servlet Bridge since there is already a Tomcat server instance listening to 
a port (2990 in my particular case).

Then I'll try by using the Jetty implementation as it is based on Jetty 8 
which supports nested connections. So my guess is that it will possible to 
modify the Pax Web sources where the Jetty server is started to do it in 
nested mode instead and reuse the current HttpServletRequest and 
HttpServletResponse from the Servlet Bridge without opening any new TCP 
port.

On Thursday, May 6, 2021 at 7:10:24 AM UTC+2 [email protected] wrote:

> Hello
>
> You did correct analysis - in `if (!initialConfigSet)` block, 
> pax-web-runtime bundle registers a tracker for 
> `ServerControllerFactory.class` OSGi services and there are three bundles 
> that actually register them: pax-web-jetty, pax-web-tomcat and 
> pax-web-undertow.
> That's the architecture of Pax Web - it always revolved around reusing 
> real servlet container instead of registering kind of "dispatcher servlet" 
> to single runtime that implemented everything.
>
> if you want JSPs the best way is to simply use entire Pax Web...
>
> regards
> Grzegorz Grzybek
>
> śr., 5 maj 2021 o 22:38 Pablo Beltran <[email protected]> napisał(a):
>
>> Hi,
>>
>> I'm following this example to register a JSP file.
>>
>>
>> https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/helloworld-jsp/src/main/java/org/ops4j/pax/web/samples/helloworld/jsp/internal/Activator.java
>>
>> However, the org.ops4j.pax.web.service.WebContainer service is not 
>> initialized.
>>
>> The initialization of that service happens in the Activator of the 
>> Pax-web-Runtime bundle.
>>
>> In particular, within this method:
>>
>>
>>
>> protected void updateController(Dictionary<String, ?> dictionary,
>> ServerControllerFactory controllerFactory)
>>
>> But the code is a bit weird.
>>
>> When the bundle is activated and the activator started the method is 
>> invoked:
>>
>> At this time, the local variable *initialConfigSet* value is false
>> ========
>> if (!initialConfigSet) {
>> initialConfigSet = true;
>> this.config = dictionary;
>> this.factory = controllerFactory;
>> dynamicsServiceTracker = new ServiceTracker<>(
>> bundleContext, ServerControllerFactory.class,
>> new DynamicsServiceTrackerCustomizer());
>> dynamicsServiceTracker.open();
>> *return*;
>> =========
>> }
>> so, the code inside the block runs, and the method returns.
>>
>> It seems this method is designed to be invoked twice. But the second call 
>> never happens and the code that initializes the WebContainer service is 
>> never executed:
>>
>> ===============
>> httpServiceFactoryReg = bundleContext.registerService(
>> new String[] { HttpService.class.getName(), *WebContainer.class.getName*() 
>> },
>> *new HttpServiceFactoryImpl*() {
>> @Override
>> HttpService createService(final Bundle bundle) {
>> return new HttpServiceProxy(new HttpServiceStarted(
>> bundle, serverController, serverModel,
>> servletEventDispatcher, configuration.get(PROPERTY_SHOW_STACKS)));
>> }
>> }, props);
>> ==============
>>
>> In my environment, Eclipse Equinox, PAX web is tied to the Servlet Bridge 
>> (HttpService). 
>>
>> Any idea?
>>
>> Pablo
>>
>>
>> -- 
>> -- 
>> ------------------
>> OPS4J - http://www.ops4j.org - [email protected]
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ops4j/d59ba9ea-e579-4025-8bdf-7d2938000e8en%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ops4j/d59ba9ea-e579-4025-8bdf-7d2938000e8en%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ops4j/3722dea6-ecf4-46a8-8ffe-69424d238766n%40googlegroups.com.

Reply via email to