Thank you, it worked. I'll try to create a quickstart...
Matteo Sotil -----Mensaje original----- De: Martin Grigorov [mailto:[email protected]] Enviado el: viernes, 02 de septiembre de 2011 10:37 Para: [email protected] Asunto: Re: Reference to css outside classpath on wicket 1.5RC7 Quick solution for your case: Implement a new ResourceReference which returns org.apache.wicket.request.resource.ContextRelativeResource in its #getResource(). I think we should add such ResourceReference in wicket-core. I am not sure at the moment what's the problem with the wrongly produced Url with your approach. Please create a quickstart and attach it to a ticket. On Fri, Sep 2, 2011 at 10:27 AM, Sotil Bertanzetti, Matteo <[email protected]> wrote: > Hello. > > I'm tying to migrate a project from wicket 1.4.18 to 1.5rc7. > I have a problem trying to add css and javascript links to my html code; > css and javascript files are located outside classpath (outside > WEB-INF). > > > In wicket 1.4.18 I do: > > add(CSSPackageResource.getHeaderContribution("css/main.css")); > > and in html appears a relative css link like this: > > <link rel="stylesheet" type="text/css" href="../../css/main.css > <view-source:http://10.128.28.213:8000/plash/css/main.css> " /> > > wich is correct. > > > I want to do the same in wicket 1.5. I try > > @Override > public void renderHead(final IHeaderResponse aResponse) { > super.renderHead(aResponse); > > aResponse.renderCSSReference(RequestCycle.get().getUrlRenderer().renderC > ontextRelativeUrl("css/main.css")); > } > > It works in some url, but in others it puts too much .. to the url; in > the same example I wrote before, now writes: > > <link rel="stylesheet" type="text/css" > href="../../../css/main.css <view-source:http://localhost/css/main.css> > " /> > > Debugging I see that > RequestCycle.get().getUrlRenderer().renderContextRelativeUrl("css/main.c > ss")returns the correct url, but function renderCSSReference adds more > .. to the url. More precisely, it's in line 231 of > org.apache.wicket.request.UrlRenderer, called from renderCSSReference, > where extra .. are added. > > I'm using: > > Wicket 1.5RC7 > Windows xp > Jdk 1.5 > Weblogic 9.2 > > Please help. > > Matteo Sotil > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
