Maybe it was stripped by Wicket Mailing list. Anyway I will paste the code in the mail itself.
Regards, Apple Grew my blog @ http://blog.applegrew.com/ --Code Starts-- /** * Web based application for e-shopping. * Copyright (C) 2010 Nirupam Biswas (AppleGrew) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.sym.core; import java.util.Arrays; import java.util.List; import org.apache.wicket.util.resource.IResourceStream; import org.apache.wicket.util.resource.locator.ResourceStreamLocator; import com.sym.core.utils.MiscUtils; import com.sym.html.pages.BaseLayoutPage; public class AppStreamLocator extends ResourceStreamLocator { private static final String HTML_EXT = ".html"; private static final String CSS_EXT = ".css"; private static final String JS_PATH = "/js/"; private static final String CSS_PATH = "/css/"; private static final String IMG_PATH = "/img/"; private static final List<String> IMG_EXTS = Arrays.asList(new String[]{ ".png", ".jpg", ".gif", ".svg" }); private static final String PAGES_PACKAGE = BaseLayoutPage.class.getPackage().getName(); private static final int PG_PACKAGE_NAME_LEN = PAGES_PACKAGE.length(); private static final int GLOBAL_PACKAGE_NAME_LEN = ApplicationCore.class.getPackage().getName().length(); @Override public IResourceStream locate(final Class<?> clazz, String path) { //Only pages' (not components or panel etc.s') HTMLs and CSS will be fetched from 'res' directory. if(clazz.getName().startsWith(PAGES_PACKAGE)){ IResourceStream located = null; if (path.endsWith(HTML_EXT) || path.endsWith(CSS_EXT)) { located = super.locate(clazz, "html/" + ApplicationCore.getThemeName() + trimFolders(path, false)); }else if (IMG_EXTS.contains(MiscUtils.getExt(path))) { located = super.locate(clazz, "/img" + trimFolders(path, false)); } if (located != null) { return located; } }else if(clazz.equals(ApplicationCore.class)){ //Global shared resources have been requested. IResourceStream located = null; path = trimFolders(path, true); if (path.startsWith(CSS_PATH) || path.startsWith(JS_PATH) || path.startsWith(IMG_PATH)) { located = super.locateByResourceFinder(clazz, path); if(located == null && path.startsWith(CSS_PATH)) { located = super.locateByResourceFinder(clazz, CSS_PATH + ApplicationCore.getThemeName() + path.substring(path.indexOf(CSS_PATH) + CSS_PATH.length() - 1)); } } return located; } return super.locate(clazz, path); } private String trimFolders(final String path, final boolean isGlobalPath) { return isGlobalPath? path.substring(GLOBAL_PACKAGE_NAME_LEN) : path.substring(PG_PACKAGE_NAME_LEN); } } --Code Ends-- On Sun, Apr 11, 2010 at 9:18 AM, sahar rostami <sahar.rost...@gmail.com>wrote: > thank you Apple Grew > I can't receive your attachments. Are you sure they have been attached ? > > On Thu, Apr 8, 2010 at 6:34 AM, Apple Grew <appleg...@gmail.com> wrote: > > > Maybe u can try writing a stream locator as I did. I am attaching my > stream > > locator with this mail. > > > > The necessary plumbing required with this is:- > > > > resourceSettings.addResourceFolder("WEB-INF/res"); > > resourceSettings.setResourceStreamLocator(new AppStreamLocator()); > > getSharedResources().putClassAlias(ApplicationCore.class, "global"); > > > > The above needs to be put in your Application class. > > > > Regards, > > Apple Grew > > my blog @ http://blog.applegrew.com/ > > > > > > > > On Wed, Apr 7, 2010 at 10:19 PM, Stefan Lindner <lind...@visionet.de > >wrote: > > > >> You could e.g. write your own page class > >> > >> class MyCustomersPage extens Page { > >> @Override > >> public void renderHead(HtmlHeaderContainer container) { > >> super.renderHead(container); > >> cssResourceReference = > >> Session.get().getCssResourceReferenceForcustomer() > >> > >> container.getHeaderResponse().renderCSSReference(cssResourceReference); > >> } > >> } > >> > >> And then let each of your pages be a child of MyCustomersPage > >> > >> Stefan > >> -----Ursprüngliche Nachricht----- > >> Von: sahar rostami [mailto:sahar.rost...@gmail.com] > >> Gesendet: Mittwoch, 7. April 2010 18:42 > >> An: users@wicket.apache.org > >> Betreff: Re: resource (css) loading > >> > >> thank you moèz > >> but i want to set the location for whole application not a specific > file. > >> > >> On Wed, Apr 7, 2010 at 8:53 PM, moèz ben rhouma < > benrhouma.m...@gmail.com > >> >wrote: > >> > >> > In java > >> > > >> > add(new StyleSheetReference("stylesheet", BasePage.class, > >> *"style.css"*)); > >> > > >> > style.css is the path of the file style.css (i.e you can write > >> > "/stylesheets/style.css ...) > >> > > >> > 2010/4/7 sahar rostami <sahar.rost...@gmail.com> > >> > > >> > > No , i want to know how wicket knows where is style.css? > >> > > > >> > > On Wed, Apr 7, 2010 at 8:24 PM, moèz ben rhouma < > >> > benrhouma.m...@gmail.com > >> > > >wrote: > >> > > > >> > > > If I understand , you can use in constructor of class java the > >> > following > >> > > > code: > >> > > > add(new StyleSheetReference("stylesheet", BasePage.class, > >> > "style.css")); > >> > > > > >> > > > and in the html page you add: > >> > > > <link wicket:id="stylesheet" > > >> > > > > >> > > > 2010/4/7 sahar rostami <sahar.rost...@gmail.com> > >> > > > > >> > > > > Thanks MZemeck > >> > > > > But my question in another form is "Where wicket load css (which > >> > > class)?" > >> > > > > how wicket knows where look up a css file? > >> > > > > > >> > > > > i'm trying to override default location of css file and read > them > >> > from > >> > > > > path(s) specified in application start up ,but i can't because i > >> > don't > >> > > > know > >> > > > > how wicket loads them. > >> > > > > > >> > > > > any idea would help me! > >> > > > > thanks > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > On Wed, Apr 7, 2010 at 7:50 PM, <mzem...@osc.state.ny.us> > wrote: > >> > > > > > >> > > > > > One difference I am aware of (and community correct me if I am > >> > > wrong), > >> > > > > > Wicket GZIPs resources. So if you directly link to the css > >> using > >> > an > >> > > > > > "href" you will not have that feature. > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > sahar rostami <sahar.rost...@gmail.com> > >> > > > > > 04/07/2010 11:16 AM > >> > > > > > Please respond to > >> > > > > > users@wicket.apache.org > >> > > > > > > >> > > > > > > >> > > > > > To > >> > > > > > Wicket User Mailing List <users@wicket.apache.org> > >> > > > > > cc > >> > > > > > > >> > > > > > Subject > >> > > > > > resource (css) loading > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > Hi all, > >> > > > > > I want to know how wicket loads css files from location > >> specified > >> > in > >> > > > > > HeaderContributer or using "href" in header? > >> > > > > > > >> > > > > > Thanks in advanced! > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > Notice: This communication, including any attachments, is > >> intended > >> > > > solely > >> > > > > > for the use of the individual or entity to which it is > >> addressed. > >> > > This > >> > > > > > communication may contain information that is protected from > >> > > disclosure > >> > > > > > under State and/or Federal law. Please notify the sender > >> > immediately > >> > > if > >> > > > > > you have received this communication in error and delete this > >> email > >> > > > from > >> > > > > > your system. If you are not the intended recipient, you are > >> > requested > >> > > > not > >> > > > > > to disclose, copy, distribute or take any action in reliance > on > >> the > >> > > > > > contents of this information. > >> > > > > > >> > > > > >> > > > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > >> For additional commands, e-mail: users-h...@wicket.apache.org > >> > >> > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > >