You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Thomas Driessen <th...@gmail.com> on 2018/02/12 15:22:20 UTC

Replace ResourceServlet

Hi,

I'm currently trying to get Vaadin to work within OSGi and for this 
purpose I'm using felix http as webserver.

My current setup looks like this:
I have a ResourceTracker that tracks all themes/widgetsets/resources and 
registers them according to the Vaadin scheme as resources via:

		 		http.registerResources("/vaadin-8.2.1/VAADIN/path/to/resource", 
"/VAADIN/path/to/resource", new MySpecialContext());

This works fine for production mode where all scss files are compiled to 
css.

The problem is in debug mode, where Vaadin offers an on-the-fly 
compilation from scss to css. For this purpose Vaadin states one should 
register a VaadinServlet under "/VAADIN/*" (or "/vaadin-8.2.1/VAADIN/*" 
in an OSGi context) that takes care of compiling scss files on the fly 
if the corresponding css files can not be found.

The problem is:

When I register a Vaadin servlet under "/vaadin-8.2.1/VAADIN/*" then 
this servlet is never used. Requests to 
"localhost:8080/vaadin-8.2.1/VAADIN/path/to/resource" are still handled 
by a ResourceServlet (DefaultServlet?) which, of course, is not able to 
find the non-existent css files.

Is there a way to tell felix http to  use a custom servlet instead of 
its default resource servlet?

Kind regards,
Thomas

Re: Replace ResourceServlet

Posted by Paul F Fraser <pa...@a2zliving.com>.
On 14/02/2018 1:58 AM, Raymond Auge wrote:
> And here's a permalink [1] directly into the shiny new HTML version of the
> specs!
>
> :D
>
> - Ray
>
> [1]
> https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e121454
>
>
Well now, what a surprise.

The presentation of the specification, as per the link from Ray, should go a long way to put the 
specification at the front of the list of references checked when questions arise.
The pdf version was just too hard :-)
The html format is much easier to read and understand. The examples especially are much easier to 
find in the text.
Well done by all concerned.

Paul Fraser


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Re[2]: Replace ResourceServlet

Posted by Raymond Auge <ra...@liferay.com>.
And here's a permalink [1] directly into the shiny new HTML version of the
specs!

:D

- Ray

[1]
https://osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html#d0e121454


On Tue, Feb 13, 2018 at 6:57 AM, Neil Bartlett <nj...@gmail.com> wrote:

> On Tue, Feb 13, 2018 at 11:32 AM, Thomas Driessen <
> thomas.driessen.td@gmail.com> wrote:
>
> > Hi,
> >
> > @Karl: I tried this but it didn't work. Still the resource servlet got
> all
> > requests for .css files.
> >
> > @Ray: I am already using the whiteboard for servlets. Is there a way to
> > use the whiteboard for resources as well?
> >
>
>
> See OSGi Compendium R6 Specification, section 140.6 "Registering
> Resources".
>
>
>
> >
> > My current solution now involves a service that listens if there is any
> UI
> > in debug mode, if so unregisters all resources and registers a
> > VaadinServlet under /<vaadinversion>/VAADIN/*
> >
> > I still would have thought that there is an easier way to replace this
> > default resource servlet.
> >
> > Kind regards,
> > Thomas
> >
> > ------ Originalnachricht ------
> > Von: "Raymond Auge" <ra...@liferay.com>
> > An: "felix users" <us...@felix.apache.org>
> > Cc: "Thomas Driessen" <th...@gmail.com>
> > Gesendet: 12.02.2018 22:51:01
> > Betreff: Re: Replace ResourceServlet
> >
> >
> > I feel like you'd be having way more fun if you bumped up to using Http
> >> Whiteboard.
> >>
> >> Sincerely,
> >> - Ray
> >>
> >> On Mon, Feb 12, 2018 at 4:41 PM, Karl Pauls <ka...@gmail.com>
> wrote:
> >>
> >> On Mon, Feb 12, 2018 at 4:22 PM, Thomas Driessen
> >>> <th...@gmail.com> wrote:
> >>> > Hi,
> >>> >
> >>> > I'm currently trying to get Vaadin to work within OSGi and for this
> >>> purpose
> >>> > I'm using felix http as webserver.
> >>> >
> >>> > My current setup looks like this:
> >>> > I have a ResourceTracker that tracks all themes/widgetsets/resources
> >>> and
> >>> > registers them according to the Vaadin scheme as resources via:
> >>> >
> >>> >
> >>> > http.registerResources("/vaadin-8.2.1/VAADIN/path/to/resource",
> >>> > "/VAADIN/path/to/resource", new MySpecialContext());
> >>> >
> >>> > This works fine for production mode where all scss files are compiled
> >>> to
> >>> > css.
> >>> >
> >>> > The problem is in debug mode, where Vaadin offers an on-the-fly
> >>> compilation
> >>> > from scss to css. For this purpose Vaadin states one should register
> a
> >>> > VaadinServlet under "/VAADIN/*" (or "/vaadin-8.2.1/VAADIN/*" in an
> OSGi
> >>> > context) that takes care of compiling scss files on the fly if the
> >>> > corresponding css files can not be found.
> >>> >
> >>> > The problem is:
> >>> >
> >>> > When I register a Vaadin servlet under "/vaadin-8.2.1/VAADIN/*" then
> >>> this
> >>> > servlet is never used.
> >>>
> >>> I might not remember correctly but IIRC, you are not supposed to put a
> >>> "/*" at the end of the alias. Can you try to register the servlet with
> >>> an alias of: "/vaadin-8.2.1/VAADIN" and see if that works?
> >>>
> >>> regards,
> >>>
> >>> Karl
> >>>
> >>> > Requests to
> >>> > "localhost:8080/vaadin-8.2.1/VAADIN/path/to/resource" are still
> >>> handled
> >>> by a
> >>> > ResourceServlet (DefaultServlet?) which, of course, is not able to
> find
> >>> the
> >>> > non-existent css files.
> >>> >
> >>> > Is there a way to tell felix http to  use a custom servlet instead of
> >>> its
> >>> > default resource servlet?
> >>> >
> >>> > Kind regards,
> >>> > Thomas
> >>>
> >>>
> >>>
> >>> --
> >>> Karl Pauls
> >>> karlpauls@gmail.com
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> >>> For additional commands, e-mail: users-help@felix.apache.org
> >>>
> >>>
> >>>
> >>
> >> --
> >> *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
> >> (@rotty3000)
> >> Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
> >> (@Liferay)
> >> Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org>
> >> (@OSGiAlliance)
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
>



-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

Re: Re[2]: Replace ResourceServlet

Posted by Neil Bartlett <nj...@gmail.com>.
On Tue, Feb 13, 2018 at 11:32 AM, Thomas Driessen <
thomas.driessen.td@gmail.com> wrote:

> Hi,
>
> @Karl: I tried this but it didn't work. Still the resource servlet got all
> requests for .css files.
>
> @Ray: I am already using the whiteboard for servlets. Is there a way to
> use the whiteboard for resources as well?
>


See OSGi Compendium R6 Specification, section 140.6 "Registering Resources".



>
> My current solution now involves a service that listens if there is any UI
> in debug mode, if so unregisters all resources and registers a
> VaadinServlet under /<vaadinversion>/VAADIN/*
>
> I still would have thought that there is an easier way to replace this
> default resource servlet.
>
> Kind regards,
> Thomas
>
> ------ Originalnachricht ------
> Von: "Raymond Auge" <ra...@liferay.com>
> An: "felix users" <us...@felix.apache.org>
> Cc: "Thomas Driessen" <th...@gmail.com>
> Gesendet: 12.02.2018 22:51:01
> Betreff: Re: Replace ResourceServlet
>
>
> I feel like you'd be having way more fun if you bumped up to using Http
>> Whiteboard.
>>
>> Sincerely,
>> - Ray
>>
>> On Mon, Feb 12, 2018 at 4:41 PM, Karl Pauls <ka...@gmail.com> wrote:
>>
>> On Mon, Feb 12, 2018 at 4:22 PM, Thomas Driessen
>>> <th...@gmail.com> wrote:
>>> > Hi,
>>> >
>>> > I'm currently trying to get Vaadin to work within OSGi and for this
>>> purpose
>>> > I'm using felix http as webserver.
>>> >
>>> > My current setup looks like this:
>>> > I have a ResourceTracker that tracks all themes/widgetsets/resources
>>> and
>>> > registers them according to the Vaadin scheme as resources via:
>>> >
>>> >
>>> > http.registerResources("/vaadin-8.2.1/VAADIN/path/to/resource",
>>> > "/VAADIN/path/to/resource", new MySpecialContext());
>>> >
>>> > This works fine for production mode where all scss files are compiled
>>> to
>>> > css.
>>> >
>>> > The problem is in debug mode, where Vaadin offers an on-the-fly
>>> compilation
>>> > from scss to css. For this purpose Vaadin states one should register a
>>> > VaadinServlet under "/VAADIN/*" (or "/vaadin-8.2.1/VAADIN/*" in an OSGi
>>> > context) that takes care of compiling scss files on the fly if the
>>> > corresponding css files can not be found.
>>> >
>>> > The problem is:
>>> >
>>> > When I register a Vaadin servlet under "/vaadin-8.2.1/VAADIN/*" then
>>> this
>>> > servlet is never used.
>>>
>>> I might not remember correctly but IIRC, you are not supposed to put a
>>> "/*" at the end of the alias. Can you try to register the servlet with
>>> an alias of: "/vaadin-8.2.1/VAADIN" and see if that works?
>>>
>>> regards,
>>>
>>> Karl
>>>
>>> > Requests to
>>> > "localhost:8080/vaadin-8.2.1/VAADIN/path/to/resource" are still
>>> handled
>>> by a
>>> > ResourceServlet (DefaultServlet?) which, of course, is not able to find
>>> the
>>> > non-existent css files.
>>> >
>>> > Is there a way to tell felix http to  use a custom servlet instead of
>>> its
>>> > default resource servlet?
>>> >
>>> > Kind regards,
>>> > Thomas
>>>
>>>
>>>
>>> --
>>> Karl Pauls
>>> karlpauls@gmail.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>
>>
>> --
>> *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
>> (@rotty3000)
>> Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
>> (@Liferay)
>> Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org>
>> (@OSGiAlliance)
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Re[2]: Replace ResourceServlet

Posted by Thomas Driessen <th...@gmail.com>.
Hi,

@Karl: I tried this but it didn't work. Still the resource servlet got 
all requests for .css files.

@Ray: I am already using the whiteboard for servlets. Is there a way to 
use the whiteboard for resources as well?

My current solution now involves a service that listens if there is any 
UI in debug mode, if so unregisters all resources and registers a 
VaadinServlet under /<vaadinversion>/VAADIN/*

I still would have thought that there is an easier way to replace this 
default resource servlet.

Kind regards,
Thomas

------ Originalnachricht ------
Von: "Raymond Auge" <ra...@liferay.com>
An: "felix users" <us...@felix.apache.org>
Cc: "Thomas Driessen" <th...@gmail.com>
Gesendet: 12.02.2018 22:51:01
Betreff: Re: Replace ResourceServlet

>I feel like you'd be having way more fun if you bumped up to using Http
>Whiteboard.
>
>Sincerely,
>- Ray
>
>On Mon, Feb 12, 2018 at 4:41 PM, Karl Pauls <ka...@gmail.com> 
>wrote:
>
>>On Mon, Feb 12, 2018 at 4:22 PM, Thomas Driessen
>><th...@gmail.com> wrote:
>> > Hi,
>> >
>> > I'm currently trying to get Vaadin to work within OSGi and for this
>>purpose
>> > I'm using felix http as webserver.
>> >
>> > My current setup looks like this:
>> > I have a ResourceTracker that tracks all themes/widgetsets/resources 
>>and
>> > registers them according to the Vaadin scheme as resources via:
>> >
>> >
>> > http.registerResources("/vaadin-8.2.1/VAADIN/path/to/resource",
>> > "/VAADIN/path/to/resource", new MySpecialContext());
>> >
>> > This works fine for production mode where all scss files are 
>>compiled to
>> > css.
>> >
>> > The problem is in debug mode, where Vaadin offers an on-the-fly
>>compilation
>> > from scss to css. For this purpose Vaadin states one should register 
>>a
>> > VaadinServlet under "/VAADIN/*" (or "/vaadin-8.2.1/VAADIN/*" in an 
>>OSGi
>> > context) that takes care of compiling scss files on the fly if the
>> > corresponding css files can not be found.
>> >
>> > The problem is:
>> >
>> > When I register a Vaadin servlet under "/vaadin-8.2.1/VAADIN/*" then 
>>this
>> > servlet is never used.
>>
>>I might not remember correctly but IIRC, you are not supposed to put a
>>"/*" at the end of the alias. Can you try to register the servlet with
>>an alias of: "/vaadin-8.2.1/VAADIN" and see if that works?
>>
>>regards,
>>
>>Karl
>>
>> > Requests to
>> > "localhost:8080/vaadin-8.2.1/VAADIN/path/to/resource" are still 
>>handled
>>by a
>> > ResourceServlet (DefaultServlet?) which, of course, is not able to 
>>find
>>the
>> > non-existent css files.
>> >
>> > Is there a way to tell felix http to  use a custom servlet instead 
>>of its
>> > default resource servlet?
>> >
>> > Kind regards,
>> > Thomas
>>
>>
>>
>>--
>>Karl Pauls
>>karlpauls@gmail.com
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>
>
>--
>*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
>(@rotty3000)
>Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
>(@Liferay)
>Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> 
>(@OSGiAlliance)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Replace ResourceServlet

Posted by Raymond Auge <ra...@liferay.com>.
I feel like you'd be having way more fun if you bumped up to using Http
Whiteboard.

Sincerely,
- Ray

On Mon, Feb 12, 2018 at 4:41 PM, Karl Pauls <ka...@gmail.com> wrote:

> On Mon, Feb 12, 2018 at 4:22 PM, Thomas Driessen
> <th...@gmail.com> wrote:
> > Hi,
> >
> > I'm currently trying to get Vaadin to work within OSGi and for this
> purpose
> > I'm using felix http as webserver.
> >
> > My current setup looks like this:
> > I have a ResourceTracker that tracks all themes/widgetsets/resources and
> > registers them according to the Vaadin scheme as resources via:
> >
> >
> > http.registerResources("/vaadin-8.2.1/VAADIN/path/to/resource",
> > "/VAADIN/path/to/resource", new MySpecialContext());
> >
> > This works fine for production mode where all scss files are compiled to
> > css.
> >
> > The problem is in debug mode, where Vaadin offers an on-the-fly
> compilation
> > from scss to css. For this purpose Vaadin states one should register a
> > VaadinServlet under "/VAADIN/*" (or "/vaadin-8.2.1/VAADIN/*" in an OSGi
> > context) that takes care of compiling scss files on the fly if the
> > corresponding css files can not be found.
> >
> > The problem is:
> >
> > When I register a Vaadin servlet under "/vaadin-8.2.1/VAADIN/*" then this
> > servlet is never used.
>
> I might not remember correctly but IIRC, you are not supposed to put a
> "/*" at the end of the alias. Can you try to register the servlet with
> an alias of: "/vaadin-8.2.1/VAADIN" and see if that works?
>
> regards,
>
> Karl
>
> > Requests to
> > "localhost:8080/vaadin-8.2.1/VAADIN/path/to/resource" are still handled
> by a
> > ResourceServlet (DefaultServlet?) which, of course, is not able to find
> the
> > non-existent css files.
> >
> > Is there a way to tell felix http to  use a custom servlet instead of its
> > default resource servlet?
> >
> > Kind regards,
> > Thomas
>
>
>
> --
> Karl Pauls
> karlpauls@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

Re: Replace ResourceServlet

Posted by Karl Pauls <ka...@gmail.com>.
On Mon, Feb 12, 2018 at 4:22 PM, Thomas Driessen
<th...@gmail.com> wrote:
> Hi,
>
> I'm currently trying to get Vaadin to work within OSGi and for this purpose
> I'm using felix http as webserver.
>
> My current setup looks like this:
> I have a ResourceTracker that tracks all themes/widgetsets/resources and
> registers them according to the Vaadin scheme as resources via:
>
>
> http.registerResources("/vaadin-8.2.1/VAADIN/path/to/resource",
> "/VAADIN/path/to/resource", new MySpecialContext());
>
> This works fine for production mode where all scss files are compiled to
> css.
>
> The problem is in debug mode, where Vaadin offers an on-the-fly compilation
> from scss to css. For this purpose Vaadin states one should register a
> VaadinServlet under "/VAADIN/*" (or "/vaadin-8.2.1/VAADIN/*" in an OSGi
> context) that takes care of compiling scss files on the fly if the
> corresponding css files can not be found.
>
> The problem is:
>
> When I register a Vaadin servlet under "/vaadin-8.2.1/VAADIN/*" then this
> servlet is never used.

I might not remember correctly but IIRC, you are not supposed to put a
"/*" at the end of the alias. Can you try to register the servlet with
an alias of: "/vaadin-8.2.1/VAADIN" and see if that works?

regards,

Karl

> Requests to
> "localhost:8080/vaadin-8.2.1/VAADIN/path/to/resource" are still handled by a
> ResourceServlet (DefaultServlet?) which, of course, is not able to find the
> non-existent css files.
>
> Is there a way to tell felix http to  use a custom servlet instead of its
> default resource servlet?
>
> Kind regards,
> Thomas



-- 
Karl Pauls
karlpauls@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org