Hi,
See http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/
There I used following code for this:
ResourceReference imagesResourceReference = new ImageResourceReference();
PageParameters imageParameters = new PageParameters();
String imageName = "anyName.jpg";
imageParameters.set("name", imageName);
CharSequence urlForImage =
getRequestCycle().urlFor(imagesResourceReference, imageParameters);
ExternalLink link = new ExternalLink("link", urlForImage.toString());
I.e. you can create the url as string, then instead of
renderCssResRef() use renderCss(String url)
On Fri, Dec 23, 2011 at 7:54 PM, Serban Balamaci <[email protected]> wrote:
> Hi all,
> I'm trying to serve some css files from a custom dir outside the web dir.
> It should get a little more complicated that I'd want to fallback to serve
> the file from a package location if it's not found in the custom-css folder,
> but let's keep it simple first.
>
> I've created a class
> public class CustomCssResource extends AbstractResource implements
> IStaticCacheableResource {
> public CustomCssResource(String path) {
> this.path = path;
> }
> ...
> }
> that returns the css file found at path location.
>
> And public class CustomCssResourceReference extends ResourceReference {
> public CustomCssResourceReference(String name) {
> super(scope, "custom-css-dir/" + name);
> }
> public IResource getResource() {
> return new CustomCssResource(name);
> }
> }
>
> In pages I do something like this:
> response.renderCSSReference(new CustomCssResourceReference("front.css"));
>
> Problem is that I'd want to mount this serving of resources from
> "/customcss"
> But how should this be done? Because I cannot just do
> app.mountResource("/customcss", new CustomCssResourceReference("???"));
>
> Should I bind as SharedResources all css files instead of using
> CustomCssResourceReference?
>
> Thanks.
>
> -----
> http://balamaci.wordpress.com
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Overridable-css-resource-tp4229370p4229370.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]