Thanks
So the fix is [here](
https://github.com/ops4j/org.ops4j.pax.web/commit/5d5afb4d8da8e6528bc0c22c89c2488ba51df660
)
And here's the description:
* HttpServiceStarted **always** does:
```java
if (model.getFilter/Servlet/WelcomePage() != null &&
!isWebAppWebContainerContext(contextModel)) {
...
serverController.getContext(contextModel).start();
...
}
```
which means that if your registering _resources_ outside of
RegisterWebAppVisitorXX, then pax-web doesn't know when you stop adding new
servlets/filters/etc.
* ResourceModel.java has `equals()` method than prevents adding it more
than once
*when creating a handler, undertow's Context ensures that there's Servlet
created from ResourceModel - to simulate what both RegisterWebAppVisitorHC
and RegisterWebAppVisitorWS do - which is
`webContainer.registerResources("/", "default", httpContext);`
* pax-web-undertow **always** destroys handler if ... it's started and
you're adding new servlets/filters/welcome-pages - it'll be recreated on
new request
* when undertow.ServerControllerImpl creates
`org.ops4j.pax.web.service.undertow.internal.Context` for the first time -
it **always** adds there `ResourceModel` (*default servlet*) - even if
pax-web-extender-war installs new web application, overriden
`ResourceModel.equals()` will prevent double registration.
regards
Grzegorz Grzybek
2017-05-23 20:40 GMT+02:00 'Achim Nierbeck' via OPS4J <
[email protected]>:
> Hi Grzegorz,
>
> hmm taken into account that a std. container also does have a default
> servlet available it sounds good.
> Just need to make sure the current behaviour if no serviceable content is
> deployed the container remain silent ;)
>
> regards, Achim
>
>
> 2017-05-23 10:31 GMT+02:00 Grzegorz Grzybek <[email protected]>:
>
>> Hello
>>
>> I'm working on pax-web-undertow in particular, but I have general issue
>> with error pages, welcome files and similar resources.
>>
>> There's for example https://ops4j1.jira.com/browse/PAXWEB-1032 "Strange
>> handling of welcome files".
>>
>> It's better with pax-web-extender-war, because the unit of deployment is
>> analogous to web.xml file which, even if empty (no servlets, filters, error
>> pages, ...) is handled effectively by RegisterWebAppVisitorWC or
>> RegisterWebAppVisitorHS.
>> The first one does: webContainer.registerResources("/", "default",
>> httpContext);
>> The second one does: httpService.registerResources("/", "", httpContext);
>> Regardless of what is found in the deployment descriptor (or in
>> org.ops4j.pax.web.extender.war.internal.model.WebApp)
>>
>> What do you think if we change the implementation, so "default" servlet
>> is *always* registered?
>>
>> For example with Undertow, without default servlet there's no ... servlet
>> to handle the request where no path matches, so no *servlet resource*
>> can send 404 error, so error pages can't be invoked. There's simple
>> low-level HttpHandler that simply sends 404 without involving error pages
>> (and anything from servlet specs in general).
>>
>> I'll experiment with having *default servlet* by default.
>>
>> regards
>> Grzegorz Grzybek
>>
>> --
>> --
>> ------------------
>> 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].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> Apache Member
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> blog <http://notizblog.nierbeck.de/>
> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>
> Software Architect / Project Manager / Scrum Master
>
> --
> --
> ------------------
> OPS4J - http://www.ops4j.org - [email protected]
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "OPS4J" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ops4j/ZyvJGOf91-Q/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
--
------------------
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].
For more options, visit https://groups.google.com/d/optout.