You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Felix Meschberger <fm...@gmail.com> on 2007/10/19 10:23:45 UTC

Re: microsling static files + WebDAV (was: microsling user feedback)

Hi,

I do not think, that this is a good idea. It involves magic and leaves
the microsling context in a way we cannot and most probably will not
support in Sling and thus creates an incompatibility.

Rather I would suggest to implement a SpoolServlet (extends
SlingSafeMethodsServlet) which handles nt:file requests
(MicroSlingServlet.addServlet("nt:file", new SpoolServlet()) and just
pumps out the nt:file (or the Property value to which the
Node.getPrimaryItem() trail leads).

Regards
Felix

Am Freitag, den 19.10.2007, 10:11 +0200 schrieb Bertrand Delacretaz:
> On 10/19/07, David Nuescheler <da...@day.com> wrote:
> > > ...Would an "initial content loader" mechanism be useful?...
> 
> > Shouldn't you be able to to just put any static file into the repository via
> > webdav, and then just use the webdav url to retrieve it again?..
> 
> You're right, so the actual problem is that microsling currently
> cannot serve static files.
> 
> > ... think if someone addresses
> > an item with an "exact match" in a url (no additional extensions or selector)
> > I think that resource should be taken care of the same way as we do that in the
> > WebDAV layer today...
> 
> Sounds good to me, so the rules might be:
> 
> 1) A WebDAV servlet is configured in the microsling webapp, but not
> mapped to an URL
> 
> 2) The microsling webapp is mapped to /*
> 
> 3) When a Node exists at a path that exactly matches the current
> request path, microsling forwards the request to the WebDAV servlet.
> 
> Is that what you mean?
> 
> Do others see a problem with that?
> 
> -Bertrand


Re: microsling static files + WebDAV

Posted by Felix Meschberger <fm...@gmail.com>.
Am Freitag, den 19.10.2007, 15:52 +0200 schrieb Carsten Ziegeler:
> Perhaps I'm thinking too complicated here, but does this always work?
> What about if I have
> /content/test
> /content/test.html
> in my repository and try to get /content/test.html ?
> 
> This will be forwarded to the webdav servlet and I don't have any chance
> to get the html view of /content/test.

This is a fundamental problem of resource resolution in Sling and
microsling and has nothing to do with whether we use WebDAV or not....

But of course you can access the html view of /content/test
through /content/test.htm ... And yes, I do not like this either, but I
think such collisions cannot be prevented from happening unless we
require that after resolving the content we must have an extension in
the request info. But this is IMHO not a good idea...

Regards
Felix


Re: microsling static files + WebDAV

Posted by Felix Meschberger <fm...@gmail.com>.
Yes, I always liked the sites where the user is thrown an MSSql
Exception in his face ... :-)

Regards
Felix

Am Freitag, den 19.10.2007, 15:58 +0200 schrieb Tobias Bocanegra:
> > Perhaps I'm thinking too complicated here, but does this always work?
> > What about if I have
> > /content/test
> > /content/test.html
> > in my repository and try to get /content/test.html ?
> >
> > This will be forwarded to the webdav servlet and I don't have any chance
> > to get the html view of /content/test.
> 
> right. that's why you won't have a test.html :-)
> regards, toby
> 
> ps: this also forces people of building sites that have links with
> proper extensions (since /conten/test would point to a webdav
> collection and not 'render' the content) which is a good side effect,
> i think.
> 


Re: microsling static files + WebDAV

Posted by Tobias Bocanegra <to...@day.com>.
> Perhaps I'm thinking too complicated here, but does this always work?
> What about if I have
> /content/test
> /content/test.html
> in my repository and try to get /content/test.html ?
>
> This will be forwarded to the webdav servlet and I don't have any chance
> to get the html view of /content/test.

right. that's why you won't have a test.html :-)
regards, toby

ps: this also forces people of building sites that have links with
proper extensions (since /conten/test would point to a webdav
collection and not 'render' the content) which is a good side effect,
i think.

-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: microsling static files + WebDAV

Posted by Carsten Ziegeler <cz...@apache.org>.
Tobias Bocanegra wrote:
>>> I do not think, that this is a good idea. It involves magic and leaves
>>> the microsling context in a way we cannot and most probably will not
>>> support in Sling and thus creates an incompatibility.
>>>
>>> Rather I would suggest to implement a SpoolServlet (extends
>>> SlingSafeMethodsServlet) which handles nt:file requests
>>> (MicroSlingServlet.addServlet("nt:file", new SpoolServlet()) and just
>>> pumps out the nt:file (or the Property value to which the
>>> Node.getPrimaryItem() trail leads).
>> i agree with felix that having a spool servlet is a better option.
>> nevertheless, i would provide a webdav servlet with the default setup.
>> so that users can easily upload/manager their static content in the
>> repository.
> 
> i rethought about this. the current webdav servlet in jackrabbit is
> pretty cool and feature complete. especially for GET requests it
> suports etags, if-last-modified-since, etc. and it would silly to
> reimplement this again.
> 
> furthermore, i think for the other methods (PUT, DELETE, MKCOL) etc
> the webdav servlet provides the good defaults. so i suggest to drop
> the StreamServlet idea, and map all exact-match resources per default
> to the webdav servlet.
> 
Perhaps I'm thinking too complicated here, but does this always work?
What about if I have
/content/test
/content/test.html
in my repository and try to get /content/test.html ?

This will be forwarded to the webdav servlet and I don't have any chance
to get the html view of /content/test.

Carsten

-- 
Carsten Ziegeler
cziegeler@apache.org

Re: microsling static files + WebDAV (was: microsling user feedback)

Posted by Felix Meschberger <fm...@gmail.com>.
Am Freitag, den 19.10.2007, 15:36 +0200 schrieb Tobias Bocanegra:
> > > I do not think, that this is a good idea. It involves magic and leaves
> > > the microsling context in a way we cannot and most probably will not
> > > support in Sling and thus creates an incompatibility.
> > >
> > > Rather I would suggest to implement a SpoolServlet (extends
> > > SlingSafeMethodsServlet) which handles nt:file requests
> > > (MicroSlingServlet.addServlet("nt:file", new SpoolServlet()) and just
> > > pumps out the nt:file (or the Property value to which the
> > > Node.getPrimaryItem() trail leads).
> >
> > i agree with felix that having a spool servlet is a better option.
> > nevertheless, i would provide a webdav servlet with the default setup.
> > so that users can easily upload/manager their static content in the
> > repository.
> 
> i rethought about this. the current webdav servlet in jackrabbit is
> pretty cool and feature complete. especially for GET requests it
> suports etags, if-last-modified-since, etc. and it would silly to
> reimplement this again.

I completely agree with you and will not dispute this :-)

> furthermore, i think for the other methods (PUT, DELETE, MKCOL) etc
> the webdav servlet provides the good defaults.

Same here ...

>  so i suggest to drop
> the StreamServlet idea, and map all exact-match resources per default
> to the webdav servlet.

But not here. The WebDAV servlet is great and provides a number of
useful features for what it is called DAV, namely Authoring.

But, let us now take the other route: How would you implement this in
microsling ?

I have in mind a solution, where the MicroSlingServlet will try to
resolve the resource and check for any selectors, extension and suffix.
If none of these exist, the MicroSlingServlet would delegate to the
WebDAV servlet, right ?

How would this be done ? By RequestDispatcher.include or by a 301/302 ?
However it is done, the MicroSlingServlet must have knowledge of the
WebDAV servlet !

So we have to big issues here: (1) we create a special case (no
extension, selectors, suffix) and (2) we create a dependency to another
servlet in microsling.

Both may be disputed over. But IMHO this construct violates one thing:
Simplicity. Probably it even violates the "separation of concerns"
principle.

Therefore, we should keep the StreamServlet (it is simple and lean and
shows another concept of microsling, namely Servlet selection by
resource type) and just go with it for what it is intended to do.

Regards
Felix



Re: microsling static files + WebDAV (was: microsling user feedback)

Posted by Tobias Bocanegra <to...@day.com>.
> > I do not think, that this is a good idea. It involves magic and leaves
> > the microsling context in a way we cannot and most probably will not
> > support in Sling and thus creates an incompatibility.
> >
> > Rather I would suggest to implement a SpoolServlet (extends
> > SlingSafeMethodsServlet) which handles nt:file requests
> > (MicroSlingServlet.addServlet("nt:file", new SpoolServlet()) and just
> > pumps out the nt:file (or the Property value to which the
> > Node.getPrimaryItem() trail leads).
>
> i agree with felix that having a spool servlet is a better option.
> nevertheless, i would provide a webdav servlet with the default setup.
> so that users can easily upload/manager their static content in the
> repository.

i rethought about this. the current webdav servlet in jackrabbit is
pretty cool and feature complete. especially for GET requests it
suports etags, if-last-modified-since, etc. and it would silly to
reimplement this again.

furthermore, i think for the other methods (PUT, DELETE, MKCOL) etc
the webdav servlet provides the good defaults. so i suggest to drop
the StreamServlet idea, and map all exact-match resources per default
to the webdav servlet.

regards, toby
-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: microsling static files + WebDAV (was: microsling user feedback)

Posted by Felix Meschberger <fm...@gmail.com>.
Am Freitag, den 19.10.2007, 11:43 +0200 schrieb Tobias Bocanegra:
> nevertheless, i would provide a webdav servlet with the default setup.
> so that users can easily upload/manager their static content in the
> repository.

IIRC the microsling setup includes the Jackrabbit WebDAV servlet just
for this ....

Regards
Felix


Re: microsling static files + WebDAV (was: microsling user feedback)

Posted by Tobias Bocanegra <to...@day.com>.
> I do not think, that this is a good idea. It involves magic and leaves
> the microsling context in a way we cannot and most probably will not
> support in Sling and thus creates an incompatibility.
>
> Rather I would suggest to implement a SpoolServlet (extends
> SlingSafeMethodsServlet) which handles nt:file requests
> (MicroSlingServlet.addServlet("nt:file", new SpoolServlet()) and just
> pumps out the nt:file (or the Property value to which the
> Node.getPrimaryItem() trail leads).

i agree with felix that having a spool servlet is a better option.
nevertheless, i would provide a webdav servlet with the default setup.
so that users can easily upload/manager their static content in the
repository.

-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---