If you use HeaderContributor.forCss(String), you can refer files
relative to the context path (or absolute if you want).

If you use HeaderContributor.forCss(Class, String), the class should
be in the same package as where the resource you want to reference is.
This will generate urls like:

foo/bar/resources/com.blerk.MyClass/something.css

where foo is the contextpaht, bar the servlet name, resources a fixed
identifier used by Wicket to recognize shared resources,
com.blerk.MyClass the scope and something.css sits in the same package
as MyClass. Hence, HeaderContributor.forCss(Class, String) should only
be used for resources in packages.

Eelco


On 10/18/06, wicketmarsh <[EMAIL PROTECTED]> wrote:
>
> Hi tried this
> HeaderContributor.forCss(xyz.class,
> "/"+((WebRequest)getRequest()).getHttpServletRequest().getContextPath()
> +"/style/abc.css")
>
> where xyz.class is my webpage in com.ma.itg.test.app directory,
> i am getting error
> wicket.WicketRuntimeException: Unable to find package resource [path =
> //webapp/style/IEEE.css, style = null, locale = null]
>         at
> wicket.markup.html.PackageResource.getResourceStream(PackageResource.java:520)
>         at
> wicket.protocol.http.WicketServlet.getLastModified(WicketServlet.java:395)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:736)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1072)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
>         at
> weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
>         at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6981)
>         at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
>         at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
>         at
> weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892)
>         at
> weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766)
>         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
>         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
>
> i even tries with removing first "/" before context path .. but still it
> gives error Unable to find package resource [path = /webapp/style/IEEE.css,
> style = null, locale = null]
>
> here i don't know what is the class  scope i need to pass , i just pass any
> class i.e XYZ.class
>
> thanks in advance..
>
> marsh
>
>
> igor.vaynberg wrote:
> >
> > the best way is to build the path manually by doing
> > "/"+contextpath+"/style/abc.css" you can get the contextpath from the
> > httpservletrequest object
> > ((WebRequest)getRequest()).getHttpServletRequest().getContextPath()
> >
> > -Igor
> >
> >
> >
> >
> > On 10/17/06, wicketmarsh <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >> Hi everybody,
> >>
> >> I have my .css file in web context directory i.e webapp/style/abc.css
> >> since
> >> this .css is used by plain html and wicket , i can't place it in my
> >> wicket
> >> webpages directory.
> >> I want to access this .css file in my webpage. i know , we can access is
> >> using HeaderContributor.forCss(Class scope,String path) but it seems it
> >> alway need class for scope. so it expect .css in relative  to scope
> >> Class.
> >> how do I access .css from my application context i.e.webapp/style/abc.css
> >>
> >> thanks in advance,
> >>
> >> marsh
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Programatically-access-to-CSS-tf2463427.html#a6867612
> >> Sent from the Wicket - User mailing list archive at Nabble.com.
> >>
> >>
> >> -------------------------------------------------------------------------
> >> Using Tomcat but need to do more? Need to support web services, security?
> >> Get stuff done quickly with pre-integrated technology to make your job
> >> easier
> >> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> >> Geronimo
> >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >> _______________________________________________
> >> Wicket-user mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >
> > -------------------------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services, security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
>
> --
> View this message in context: 
> http://www.nabble.com/Programatically-access-to-CSS-tf2463427.html#a6878003
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to