You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Erik Beijnoff <er...@addsystems.com> on 2002/04/16 09:54:51 UTC

How to handle stylesheets in a multiuser environment.

Hi. I'm using turbine as the foundation for a web-application which has a
hierarchy for users, where some users will be administrators and so on in a
normal fashion. I'm facing the problem of customization as each user should
have a specific stylesheet tied to him/her. A stylesheet may also be shared,
depending on how the administrators have set up the system.

I'd like to put the stylesheets within the database to be able to set up
security control on them, so that some users, or group of users, may have
the right to edit the stylesheets, on a per stylesheet basis. But I'm unsure
wheter this will make caching of the stylesheets for each user impossible.
Since the stylesheet will be rather large, something like 20K, it will be
quite a large hit for each user if they need to download the stylesheet for
new each time, instead of fetching it from their cache.

Be aware that id like this to be able to scale rather large, with a users
structure of thousands, or tens of thousands, or even possibly more.

So my question is this: Is it possible for a user computer to use it's
caching capabilities if it fetches the stylesheet from a database, or from a
server side cache (oh the joys of turbine :) ), or will it need to refetch
the stylesheet each time? And if not, does anybody have any experience in
storing hundreds or thousands of autofetched stylesheets in some directory
structure? Note that I'd like to avoid that, if possible.

Best regards

Erik Beijnoff

erik@beijnoff.com

Re: How to handle stylesheets in a multiuser environment.

Posted by John McNally <jm...@collab.net>.
it should make no difference on caching whether the stylesheet is stored
in a db or filesystem.  Though I would recommend the filesystem.  Not
sure about windows, but I think most *nix filesystems can handle a few
thousand files in a directory.  If you want to break it up into smaller
chunks, and the path is not obvious from other data, you can store the
path in the db.

john mcnally 

Erik Beijnoff wrote:
> 
> Hi. I'm using turbine as the foundation for a web-application which has a
> hierarchy for users, where some users will be administrators and so on in a
> normal fashion. I'm facing the problem of customization as each user should
> have a specific stylesheet tied to him/her. A stylesheet may also be shared,
> depending on how the administrators have set up the system.
> 
> I'd like to put the stylesheets within the database to be able to set up
> security control on them, so that some users, or group of users, may have
> the right to edit the stylesheets, on a per stylesheet basis. But I'm unsure
> wheter this will make caching of the stylesheets for each user impossible.
> Since the stylesheet will be rather large, something like 20K, it will be
> quite a large hit for each user if they need to download the stylesheet for
> new each time, instead of fetching it from their cache.
> 
> Be aware that id like this to be able to scale rather large, with a users
> structure of thousands, or tens of thousands, or even possibly more.
> 
> So my question is this: Is it possible for a user computer to use it's
> caching capabilities if it fetches the stylesheet from a database, or from a
> server side cache (oh the joys of turbine :) ), or will it need to refetch
> the stylesheet each time? And if not, does anybody have any experience in
> storing hundreds or thousands of autofetched stylesheets in some directory
> structure? Note that I'd like to avoid that, if possible.
> 
> Best regards
> 
> Erik Beijnoff
> 
> erik@beijnoff.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to handle stylesheets in a multiuser environment.

Posted by John McNally <jm...@collab.net>.
Eric gives the same reason I would choose the filesystem.  You can put
the files in a location where they can be served directly by the web
server.  This is definitely preferrable if there is no reason to need
webapp managed security on the stylesheets.  Then again, caching of the
stylesheet by the browser may make this not such an issue.  If it makes
sense for other reasons to put the file in a db, do it.  Otherwise the
fs is a better choice.

john mcnally 

Eric Dobbs wrote:
> 
> On Wednesday, April 17, 2002, at 02:35  AM, Erik Beijnoff wrote:
> 
> > BTW, why do you think storing the stylesheets in directories is a better
> > idea? Less overhead? Easier or more flexible whenever someone wants to
> > make
> > changes to them? Or do you have any other reasons?
> 
> It's not a strong opinion.  I just found myself agreeing with John.
> Some things just seem like they belong in the file system.  For example,
> I think you could save yourself the trouble of creating and debugging
> the RawScreen by judicious use of the file system.  Sometimes the best
> code is no code at all.
> 
> -Eric
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to handle stylesheets in a multiuser environment.

Posted by Eric Dobbs <er...@dobbse.net>.
On Wednesday, April 17, 2002, at 02:35  AM, Erik Beijnoff wrote:

> BTW, why do you think storing the stylesheets in directories is a better
> idea? Less overhead? Easier or more flexible whenever someone wants to 
> make
> changes to them? Or do you have any other reasons?

It's not a strong opinion.  I just found myself agreeing with John.  
Some things just seem like they belong in the file system.  For example, 
I think you could save yourself the trouble of creating and debugging 
the RawScreen by judicious use of the file system.  Sometimes the best 
code is no code at all.

-Eric

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to handle stylesheets in a multiuser environment.

Posted by Erik Beijnoff <er...@addsystems.com>.
>
>If you're determined to store the stylesheets in the database, then
>Turbine's typical url stuff should help you.
>
>Turbine uses the url for variable info, originally so that search
>engines would index the dynamically generated pages.
>
>Create a screen that will render a given stylesheet when you hit this
>url:
>http://server:8080/myapp/servlet/myapp/screen/stylesheet/id/1543.css
>(look at this message in the archive for suggestions about
>creating the
>screen -- in particular you'll need to set the content-type to
>'text/css):
>http://nagoya.apache.org:8080/eyebrowse/ReadMsg?listName=turbine-
>user@jakarta.apache.org&msgNo=3353)
>
>Then you can use that in the <LINK> tag:
><LINK href="${styleSheetUrl}" rel="stylesheet" type="text/css">
>
>And the browser shouldn't know the difference between a static
>stylesheet and the dynamically generated one.  So the browser cache
>should work as expected.
>
>Hope that helps.
>-Eric
>

Thank a lot for the info. I think it will help me a long way. Great idea
about creating a screen. I think this is exectly what I'm looking for. I
think I'll try the database approach, integrating the stylesheets into the
database will create a lot of spin of-effects. I think you'd understand if I
showed you the database structure, but I think it's irrelevant for the
topic.

BTW, why do you think storing the stylesheets in directories is a better
idea? Less overhead? Easier or more flexible whenever someone wants to make
changes to them? Or do you have any other reasons?

Best regards

Erik Beijnoff



Re: How to handle stylesheets in a multiuser environment.

Posted by Eric Dobbs <er...@dobbse.net>.
On Tuesday, April 16, 2002, at 01:54  AM, Erik Beijnoff wrote:

> So my question is this: Is it possible for a user computer to use it's
> caching capabilities if it fetches the stylesheet from a database, or 
> from a
> server side cache (oh the joys of turbine :) ), or will it need to 
> refetch
> the stylesheet each time? And if not, does anybody have any experience 
> in
> storing hundreds or thousands of autofetched stylesheets in some 
> directory
> structure? Note that I'd like to avoid that, if possible.

If you're determined to store the stylesheets in the database, then 
Turbine's typical url stuff should help you.

Turbine uses the url for variable info, originally so that search 
engines would index the dynamically generated pages.

Create a screen that will render a given stylesheet when you hit this 
url:
http://server:8080/myapp/servlet/myapp/screen/stylesheet/id/1543.css
(look at this message in the archive for suggestions about creating the 
screen -- in particular you'll need to set the content-type to 
'text/css):
http://nagoya.apache.org:8080/eyebrowse/ReadMsg?listName=turbine-
user@jakarta.apache.org&msgNo=3353)

Then you can use that in the <LINK> tag:
<LINK href="${styleSheetUrl}" rel="stylesheet" type="text/css">

And the browser shouldn't know the difference between a static 
stylesheet and the dynamically generated one.  So the browser cache 
should work as expected.

Hope that helps.
-Eric

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>