Hi Oliver, There is no such central class that maps all resources. You can use any class as a scope for resources. Just make sure the resources are in the same folder as the scope class. Example: - if the scope class is com.example.package.MyClass - if the resource path is: css/some.css - then Wicket will try to load some.css from /wicket/resource/com.example.package.MyClass/css/some.css
- if some.css contains: url (../font/some.woff) - then the browser will calculate its absolute url to: /wicket/resource/com.example.package.MyClass/font/some.woff - so you have to make sure that font/ folder resides next to css/ in the classpath This is how it works. You can still use the web folder, i.e. create css/ and font/ folders next to WEB-INF. This works as with any other Servlet based application. In your .html you can use <link href="css/some.css"/> to load it in a page. The benefit of using Wicket resource references is that: - you can load different resources depending on the user agent's locale, or session style/variation - you can use dependency management - one resource may depend on several other. You do "response.render(headerItem)" and wicket makes sure that all its dependencies are rendered too - resource bundles - i.e. to combine several CSS files into one to save network requests ... For more consult with http://wicket.apache.org/guide/guide/single.html#chapter14_4 I'll need more information/code to be able to help you more. On Wed, Dec 4, 2013 at 2:34 PM, Oliver B. Fischer <[email protected]>wrote: > Hi Martin, > > is there any ready resource class that simply maps all resource requests > to a package including relative paths? > > Such a simple task takes already too much time. Putting all file in the > WEB-INF folder would take me 10 minutes... > > BTW, Wicket is great and powerfull and you can build some simple pages > quite fast. But if you need something more complicated you are confronted > with a lot of classes and you must understand all the details. And this > does not pay off unless you will build many different applications... > > Am 04.12.13 13:45, schrieb Oliver B. Fischer: > > Hi Martin, >> >> I think I will try to write a custom package resource... >> >> BYe, >> >> Oliver >> >> Am 04.12.13 13:23, schrieb Martin Grigorov: >> >>> On Wed, Dec 4, 2013 at 12:11 PM, Oliver B. Fischer >>> <[email protected]>wrote: >>> >>> Hi, >>>> >>>> it is there. The CSS as bundle is referenced via >>>> >>>> http://localhost:8080/bs3test/wicket/resource/com. >>>> profitbricks.wicket.bootstrap.resources.example.bundle. >>>> Bootstrap3Reference/dist/css/bootstrap-theme-ver-1386155341000.css >>>> >>>> But the fonts via >>>> >>>> http://localhost:8080/bs3test/wicket/resource/fonts/ >>>> glyphicons-halflings-regular.woff >>>> >>> >>> >>> There is something wrong here. >>> A relative url like >>> ../fonts/glyphicons-halflings-regular.eot?#iefix >>> should be calculated to >>> http://localhost:8080/bs3test/wicket/resource/com. >>> profitbricks.wicket.bootstrap.resources.example.bundle. >>> Bootstrap3Reference/dist >>> >>> /fonts/glyphicons-halflings-regular.eot?#iefix >>> >>> Do you use Wicket bundle (several CSS files combined into one) by >>> chance ? >>> It would break if the bundle doesn't use Bootstrap3Reference.class (or >>> another class in the same package) as a scope. >>> >>> >>> >>>> >>>> I know that the problem that the fonts referenced directly from the CSS >>>> files. But how can I handle that? >>>> >>>> Viele Grüße >>>> >>>> Oliver >>>> >>>> >>>> Am 04.12.13 12:03, schrieb Martin Grigorov: >>>> >>>> Hi, >>>> >>>>> >>>>> Just make sure the font/ folder is next to the css/ folder in your file >>>>> structure. >>>>> >>>>> >>>>> >>>>> On Wed, Dec 4, 2013 at 11:59 AM, Oliver B. Fischer >>>>> <[email protected] >>>>> >>>>>> wrote: >>>>>> >>>>> >>>>> Hi, >>>>> >>>>>> >>>>>> I would like to include all Bootstrap 3 resources via resources >>>>>> references. I managed to in include all CSS files by extending >>>>>> CssResourceReference and specifying a list of dependencies >>>>>> (getDependencies()). >>>>>> >>>>>> But how can I include the fonts provided by Bootstrap? The fonts are >>>>>> referenced directly in the CSS files via >>>>>> >>>>>> src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') >>>>>> format('embedded-opentype'), >>>>>> >>>>>> How can I reference these fonts? >>>>>> >>>>>> Bye, >>>>>> >>>>>> Oliver >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: [email protected] >>>>>> For additional commands, e-mail: [email protected] >>>>>> >>>>>> >>>>>> >>>>>> >>>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
