have you actually hit a scalability problem? if you are trying to optimize upfront you can use a less invasive technique. all resource urls in wicekt are served under the /resources/ virtual folder. you can enable the setting where wicket will append a last-modified date to the end of each resource url, and then have an apache-side cache to cache and serve everything under /resources/.
alternatively see how ContextImage works if you want to serve your own stuff out of webapp folder. -igor On Sat, Oct 24, 2009 at 10:53 AM, Luther Baker <lutherba...@gmail.com> wrote: > Have another question about serving up CSS (JS, img, etc) files statically: > > a) I'd like to have the option to serve my CSS up statically via an apache > proxy. I'd also like to avoid serving CSS requests up via the wicket filter > - even if served up by Jetty - as I think it will scale just a bit better > ... > b) With my current URL mounts, many pages with different base URLs refer to > the same CSS file. Consequently, a relative URL for the common CSS files as > referenced in the master template won't work since the CSS file would be > looked up relative to each different URL mount point. > > Does that makes sense? So, I would like to create a simple, absolute > reference mechanism for my static CSS, image or other files (without > hardcoding). > > I'm not as knowledgeable about the way that components are mapped to wicket > tags, how to add my own tags or even how to create my own components (other > than Panels of course). Does the approach below adhere to the "wicket way"? > It feels a bit manual ... and I'm not fond of the static WEB_CONTEXT > assignment - but I don't see an elegant/efficient way to get it from within > the Page or the AbstractBehavior on a per request basis. > > Just looking for a bit of advice. > > Does the WIKI have some detailed docs that really get into the nitty gritty > of low-level component and tag design? IE: Details of ComponentTag, > MarkupElement, WicketTag, > > On the other hand, is there any strong advice to put custom CSS, image and > JS files in the classpath and reference ala wicket or is my approach > perfectly reasonable here. An alternate goal of mine to keep custom > components/solutions to a minimum. > > Thanks in advance, > > -Luther > > > > *MARKUP IN:* > > <head> > <link wicket:id="head.link" rel="stylesheet" > href="style/default/main.css"/> > </head> > > *MARKUP OUT:* > > <head> > <link rel="stylesheet" href="*/portal/*style/default/main.css"/> > </head> > > *JAVA* > > final static String WEB_CONTEXT = > WebApplication.get().getServletContext().getContextPath(); > > protected DefaultPageTemplate() > { > // > http://www.mkyong.com/wicket/how-to-dynamic-add-attribute-to-a-html-tag-in-wicket/ > > final WebMarkupContainerWithAssociatedMarkup cssLink = new > WebMarkupContainerWithAssociatedMarkup("head.link"); > add(cssLink); > > cssLink.add(new AbstractBehavior() > { > private static final long serialVersionUID = 1L; > > �...@override > public void onComponentTag(final Component component, > final ComponentTag tag) > { > String href = tag.getAttribute("href"); > href = WEB_CONTEXT + "/" + href; > tag.put("href", href); > } > }); > } > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org