Re: I am having trouble mounting shared resources
I will have to track down each individual image use from css and mount it. Is there a way to mount the entire folder? Thanks! 2011/8/5 Miroslav F. : > Same way as is mounted .js and .css mount images and then in .css you can > just use this path. > > >> -Original Message- >> From: Alec Swan [mailto:alecs...@gmail.com] >> Sent: Friday, 05. August 2011 19:30 >> To: users@wicket.apache.org >> Subject: Re: I am having trouble mounting shared resources >> >> Thanks, mounting JS worked perfectly. >> >> However, mounting CSS was problematic because it references >> quite a few images and they don't get loaded/mounted >> correctly. How do I mount the folder that contains all images >> so that they can be loaded from the CSS? >> >> Thanks, >> >> Alec >> >> >> On Fri, Aug 5, 2011 at 11:51 AM, Miroslav F. wrote: >> > Project dirs: >> > >> > . com.myapp >> > . MyStartAppPoint.java >> > . com.myapp.resources >> > . MyResources.java >> > . fancybox-123.js >> > >> > In MyStartAppPoint.init() do: >> > >> > mountSharedResource("/js/fancybox.js", new >> > ResourceReference(MyResources.class, >> > "fancybox-123.js").getSharedResourceKey()); >> > >> > MyResources.java is just empty class (for classloader to find your >> > resource): >> > package com.myapp.resources; >> > public class MyResources >> > { >> > } >> > >> > and then in html markup you can write: >> > >> > >> > Hope helps, >> > >> > Miro >> > >> > >> > >> > >> >> -Original Message- >> >> From: Alec Swan [mailto:alecs...@gmail.com] >> >> Sent: Friday, 05. August 2011 08:42 >> >> To: users@wicket.apache.org >> >> Subject: I am having trouble mounting shared resources >> >> >> >> Hello, >> >> >> >> I am having troubles figuring out how to organize my >> static resources. >> >> >> >> I would like to map a static URL alias, e.g. /js/fancybox, >> to a file >> >> such as /js/fancybox/version123/fancybox-123.js. I also want to be >> >> able to update the file version and after that have it >> served under >> >> the same alias. This assumes that I will modify my Java code to >> >> reference the new file name. >> >> >> >> I think I need to create a resource reference class that points to >> >> /js/fancybox/version123/fancybox-123.js and mount it in my Wicket >> >> Application. But I can only mount a resource, not a >> >> JavaScriptResourceReference in Application.init(). >> >> >> >> Can anybody please explain how to do this right? >> >> >> >> Thanks >> >> >> >> >> - >> >> 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 >> > >> > >> >> - >> 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 > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: I am having trouble mounting shared resources
Same way as is mounted .js and .css mount images and then in .css you can just use this path. > -Original Message- > From: Alec Swan [mailto:alecs...@gmail.com] > Sent: Friday, 05. August 2011 19:30 > To: users@wicket.apache.org > Subject: Re: I am having trouble mounting shared resources > > Thanks, mounting JS worked perfectly. > > However, mounting CSS was problematic because it references > quite a few images and they don't get loaded/mounted > correctly. How do I mount the folder that contains all images > so that they can be loaded from the CSS? > > Thanks, > > Alec > > > On Fri, Aug 5, 2011 at 11:51 AM, Miroslav F. wrote: > > Project dirs: > > > > . com.myapp > > . MyStartAppPoint.java > > . com.myapp.resources > > . MyResources.java > > . fancybox-123.js > > > > In MyStartAppPoint.init() do: > > > > mountSharedResource("/js/fancybox.js", new > > ResourceReference(MyResources.class, > > "fancybox-123.js").getSharedResourceKey()); > > > > MyResources.java is just empty class (for classloader to find your > > resource): > > package com.myapp.resources; > > public class MyResources > > { > > } > > > > and then in html markup you can write: > > > > > > Hope helps, > > > > Miro > > > > > > > > > >> -Original Message- > >> From: Alec Swan [mailto:alecs...@gmail.com] > >> Sent: Friday, 05. August 2011 08:42 > >> To: users@wicket.apache.org > >> Subject: I am having trouble mounting shared resources > >> > >> Hello, > >> > >> I am having troubles figuring out how to organize my > static resources. > >> > >> I would like to map a static URL alias, e.g. /js/fancybox, > to a file > >> such as /js/fancybox/version123/fancybox-123.js. I also want to be > >> able to update the file version and after that have it > served under > >> the same alias. This assumes that I will modify my Java code to > >> reference the new file name. > >> > >> I think I need to create a resource reference class that points to > >> /js/fancybox/version123/fancybox-123.js and mount it in my Wicket > >> Application. But I can only mount a resource, not a > >> JavaScriptResourceReference in Application.init(). > >> > >> Can anybody please explain how to do this right? > >> > >> Thanks > >> > >> > - > >> 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 > > > > > > - > 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
Re: I am having trouble mounting shared resources
Thanks, mounting JS worked perfectly. However, mounting CSS was problematic because it references quite a few images and they don't get loaded/mounted correctly. How do I mount the folder that contains all images so that they can be loaded from the CSS? Thanks, Alec On Fri, Aug 5, 2011 at 11:51 AM, Miroslav F. wrote: > Project dirs: > > . com.myapp > . MyStartAppPoint.java > . com.myapp.resources > . MyResources.java > . fancybox-123.js > > In MyStartAppPoint.init() do: > > mountSharedResource("/js/fancybox.js", new > ResourceReference(MyResources.class, > "fancybox-123.js").getSharedResourceKey()); > > MyResources.java is just empty class (for classloader to find your > resource): > package com.myapp.resources; > public class MyResources > { > } > > and then in html markup you can write: > > > Hope helps, > > Miro > > > > >> -Original Message- >> From: Alec Swan [mailto:alecs...@gmail.com] >> Sent: Friday, 05. August 2011 08:42 >> To: users@wicket.apache.org >> Subject: I am having trouble mounting shared resources >> >> Hello, >> >> I am having troubles figuring out how to organize my static resources. >> >> I would like to map a static URL alias, e.g. /js/fancybox, to >> a file such as /js/fancybox/version123/fancybox-123.js. I >> also want to be able to update the file version and after >> that have it served under the same alias. This assumes that I >> will modify my Java code to reference the new file name. >> >> I think I need to create a resource reference class that >> points to /js/fancybox/version123/fancybox-123.js and mount >> it in my Wicket Application. But I can only mount a resource, >> not a JavaScriptResourceReference in Application.init(). >> >> Can anybody please explain how to do this right? >> >> Thanks >> >> - >> 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 > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: I am having trouble mounting shared resources
Project dirs: . com.myapp . MyStartAppPoint.java . com.myapp.resources . MyResources.java . fancybox-123.js In MyStartAppPoint.init() do: mountSharedResource("/js/fancybox.js", new ResourceReference(MyResources.class, "fancybox-123.js").getSharedResourceKey()); MyResources.java is just empty class (for classloader to find your resource): package com.myapp.resources; public class MyResources { } and then in html markup you can write: Hope helps, Miro > -Original Message- > From: Alec Swan [mailto:alecs...@gmail.com] > Sent: Friday, 05. August 2011 08:42 > To: users@wicket.apache.org > Subject: I am having trouble mounting shared resources > > Hello, > > I am having troubles figuring out how to organize my static resources. > > I would like to map a static URL alias, e.g. /js/fancybox, to > a file such as /js/fancybox/version123/fancybox-123.js. I > also want to be able to update the file version and after > that have it served under the same alias. This assumes that I > will modify my Java code to reference the new file name. > > I think I need to create a resource reference class that > points to /js/fancybox/version123/fancybox-123.js and mount > it in my Wicket Application. But I can only mount a resource, > not a JavaScriptResourceReference in Application.init(). > > Can anybody please explain how to do this right? > > Thanks > > - > 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
Re: I am having trouble mounting shared resources
Quick solution: Resource res = new JavaScriptResourceReference().getResource(); mountSharedResource(somePath, res); On Fri, Aug 5, 2011 at 10:01 AM, Alec Swan wrote: > We are using Wicket 1.4.17 but we would like to do something like this > mountResource("/mount/path", new SomeResourceReference()) as described > in http://wicketinaction.com/ for Wicket 1.5. > > On Fri, Aug 5, 2011 at 12:41 AM, Alec Swan wrote: >> Hello, >> >> I am having troubles figuring out how to organize my static resources. >> >> I would like to map a static URL alias, e.g. /js/fancybox, to a file >> such as /js/fancybox/version123/fancybox-123.js. I also want to be >> able to update the file version and after that have it served under >> the same alias. This assumes that I will modify my Java code to >> reference the new file name. >> >> I think I need to create a resource reference class that points to >> /js/fancybox/version123/fancybox-123.js and mount it in my Wicket >> Application. But I can only mount a resource, not a >> JavaScriptResourceReference in Application.init(). >> >> Can anybody please explain how to do this right? >> >> Thanks >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: I am having trouble mounting shared resources
We are using Wicket 1.4.17 but we would like to do something like this mountResource("/mount/path", new SomeResourceReference()) as described in http://wicketinaction.com/ for Wicket 1.5. On Fri, Aug 5, 2011 at 12:41 AM, Alec Swan wrote: > Hello, > > I am having troubles figuring out how to organize my static resources. > > I would like to map a static URL alias, e.g. /js/fancybox, to a file > such as /js/fancybox/version123/fancybox-123.js. I also want to be > able to update the file version and after that have it served under > the same alias. This assumes that I will modify my Java code to > reference the new file name. > > I think I need to create a resource reference class that points to > /js/fancybox/version123/fancybox-123.js and mount it in my Wicket > Application. But I can only mount a resource, not a > JavaScriptResourceReference in Application.init(). > > Can anybody please explain how to do this right? > > Thanks > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
I am having trouble mounting shared resources
Hello, I am having troubles figuring out how to organize my static resources. I would like to map a static URL alias, e.g. /js/fancybox, to a file such as /js/fancybox/version123/fancybox-123.js. I also want to be able to update the file version and after that have it served under the same alias. This assumes that I will modify my Java code to reference the new file name. I think I need to create a resource reference class that points to /js/fancybox/version123/fancybox-123.js and mount it in my Wicket Application. But I can only mount a resource, not a JavaScriptResourceReference in Application.init(). Can anybody please explain how to do this right? Thanks - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Mounting shared resources
Hi edvin, pictures are not my only goal, I would like to serve compressed js and css also, and to take advantage of wicket resource caching (http header generation). Anyway, I wrote a simple requesttargeturlcodingstrategy that fulfills my needs. If anyone is interested, here it is: public class SharedResourcesRequestTargetUrlCodingStrategy extends AbstractRequestTargetUrlCodingStrategy { private String keyPrefix; public SharedResourcesRequestTargetUrlCodingStrategy(String mountPath, Class scope) { this(mountPath, scope, mountPath.substring(1)); } public SharedResourcesRequestTargetUrlCodingStrategy(String mountPath, Class scope, String namePrefix) { super(mountPath); this.keyPrefix = scope.getCanonicalName() + "/" + namePrefix; } public IRequestTarget decode(RequestParameters requestParameters) { String name = requestParameters.getPath ().substring(getMountPath().length()); requestParameters.setResourceKey(keyPrefix + name); return new SharedResourceRequestTarget(requestParameters); } public CharSequence encode(IRequestTarget requestTarget) { String key = ((ISharedResourceRequestTarget)requestTarget).getResourceKey(); return getMountPath() + key.substring(keyPrefix.length()); } public boolean matches(IRequestTarget requestTarget) { if (!(requestTarget instanceof ISharedResourceRequestTarget)) return false; String key = ((ISharedResourceRequestTarget)requestTarget).getResourceKey(); return key.startsWith(keyPrefix); } } Thank you Regards -Carlos On Feb 1, 2008 6:31 PM, Edvin Syse <[EMAIL PROTECTED]> wrote: > > Then there is the mountSharedResource method, but it works on resource > > by resource basis. Instead, I need to alias the path for a big number > > of resources (for example, static images for my application). > > Ideally, I would like my images, following the previous example, to > > be requested as: > > > > If your goal is just to supply static pictures and don't have > programmatically control over them, why don't you just create an img-folder > in > your webroot? Then pictures will be served by your container instead of > Wicket :) > > -- Edvin > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: Mounting shared resources
Then there is the mountSharedResource method, but it works on resource by resource basis. Instead, I need to alias the path for a big number of resources (for example, static images for my application). Ideally, I would like my images, following the previous example, to be requested as: If your goal is just to supply static pictures and don't have programmatically control over them, why don't you just create an img-folder in your webroot? Then pictures will be served by your container instead of Wicket :) -- Edvin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Mounting shared resources
Hi all, is it possible to alias resource paths like /resources/scope/name to simply, say, /mount_point/name? I know there is a scope alias for shared resources, but that only works for the scope (class) part of the path, so it can't get shorter that /resources/alias/path. Then there is the mountSharedResource method, but it works on resource by resource basis. Instead, I need to alias the path for a big number of resources (for example, static images for my application). Ideally, I would like my images, following the previous example, to be requested as: Any chance to get this? Thank you in advance. Regards, Carlos - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]