Jonathan Locke wrote:
>
>
> it's pure common sense.
>
> "don't prematurely optimize" is just a version of "don't fix what ain't
> broke".
>
>
> luther.baker wrote:
>>
>> Thanks Igor.
>>
>> We're not having performance issues. I'm just mapping what we
>> traditionally
>> do to Wicket. I did come across
>>
>> CSSPackageResource.getHeaderContribution("style/default/main.css"));
>>
>> which seems to do exactly what I was looking for.
>>
>> Back to your point, I guess I understood that Wicket 'could' manage
>> resources - I'm just not sure when it 'should' manage them. I generally
>> consider it a best practice to let the server handle static CSS and
>> potentially huge js and img files but it sounds like you're suggesting
>> "start by managing the resources within Wicket and wait until performance
>> issues actually start popping up and then consider externalizing them."
>> What's nice to see is that Wicket appears to handle either approach
>> pretty
>> well.
>>
>> Also, ContextImage hit the nail on the head. Thanks for the suggestion
>>
>> -Luther
>>
>>
>> On Sat, Oct 24, 2009 at 4:42 PM, Igor Vaynberg
>> <[email protected]>wrote:
>>
>>> 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 <[email protected]>
>>> 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: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>
>>
>
>
Hi all, I am a new member of forum. Would a newcomer be warmly welcome here?
Good day you guys!!!
__________________
[url=http://animewatching.com]Watch Anime Episodes[/url]
--
View this message in context:
http://old.nabble.com/Absolute-static-file-references-tp26041429p26260531.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]