Re: Caching Imagages, CSS, JS in Wicket 1.5.3

2012-07-04 Thread Martin Grigorov
Hi,

If you can reproduce this in a mini application (aka quickstart) then
please attach it to a ticket in our Jira and we will have a look.

On Wed, Jul 4, 2012 at 1:08 PM, sardo  wrote:
> UPDATE:
>
> I created a new TestBasePage and a new class that extends TestBasePage. The
> markup for TestBasePage has the same  mark up as that in my
> application's BasePage class.  When I tested the rendered html it still has
> two  tags.  I then added the  tag to the child class of
> TestBasePage and then the second  disappears. So:
>
> I put this in the child class before the  tag:
>
>   
>
>   
>
> Which renders the following, removing the second  tag:
>
>
>/>
>   Test page
>
>   
>
>
>
>
>   
>
> Not really a solution, and I still don't know why it's happening.
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4650357.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> 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: Caching Imagages, CSS, JS in Wicket 1.5.3

2012-07-04 Thread sardo
UPDATE:

I created a new TestBasePage and a new class that extends TestBasePage. The
markup for TestBasePage has the same  mark up as that in my
application's BasePage class.  When I tested the rendered html it still has
two  tags.  I then added the  tag to the child class of
TestBasePage and then the second  disappears. So:

I put this in the child class before the  tag:

  

  

Which renders the following, removing the second  tag:

   
  
  Test page

  
  
  


  

Not really a solution, and I still don't know why it's happening.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4650357.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Caching Imagages, CSS, JS in Wicket 1.5.3

2012-07-04 Thread sardo

Martin Grigorov-4 wrote
> 
> 
>>If you provide components library then you need to distribute the
>>resources too, not just the classes.
>>Shared resources is more for delivering dynamically generated content.
>>A content that is different depending on some external condition
>>(request parameter, session variable, ...).
>>If you have one monolithic application and the resource is really
>>static then I see no reason why not to put it in its expected place in
>>the .war.
> 
> I see thanks Martin. For general app stuff though my personal feeling is
> that it's best to modify as much as possible by just changing the class of
> component's associated tag. 
> 
>>Not sure.
>>I see no  in UnSecureTemplate.html.
> 
> Oh that's due to my formatting error, I've corrected the post. I'm not
> sure how to fix this one, it's going to take some time to try and debug.
> I've just had a look again at what the Wicket 1.4 version of the app
> produces. I get two  tags but it doesn't repeat what's in the
> BasePage , which is what's happening in Wicket 1.5.  See below for
> Wicket 1.4 mark up. Wicket 1.5 reproduces the content of the first header
> (yes I know the css gets added several times, it's one of the things I'm
> correcting. I'm wondering if there's something that's related to repeated
> additions of CSS causing the problem):
> 
> 
>   
>content="text/html;charset=iso-8859-1"
> />
>   This site holds the key to wealth, success, and being 
> able to
> attract the opposite sex
>href="css/application.css"/>
>   
>   
>   
>   
> 
>   
>  href="css/application.css" />
> 
> 
> 
>>
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4650350.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> -
>> To unsubscribe, e-mail: users-unsubscribe@.apache
>> For additional commands, e-mail: users-help@.apache
>>
> 
> 
> 
> -- 
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
> 
> -
> To unsubscribe, e-mail: users-unsubscribe@.apache
> For additional commands, e-mail: users-help@.apache
> 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4650355.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Caching Imagages, CSS, JS in Wicket 1.5.3

2012-07-03 Thread Martin Grigorov
Hi,

On Tue, Jul 3, 2012 at 11:32 PM, sardo  wrote:
> Thanks Martin, that helps. Forgive my naivety, but why do I have the option
> of adding CSS via the Java code? Surely it's better to follow convention and
> add it into the appropriate .war directory?

If you provide components library then you need to distribute the
resources too, not just the classes.
Shared resources is more for delivering dynamically generated content.
A content that is different depending on some external condition
(request parameter, session variable, ...).
If you have one monolithic application and the resource is really
static then I see no reason why not to put it in its expected place in
the .war.

>
> ...and if I could do the Columbo, "Just one more thing", thing. Why am I
> getting two  tags in my app?  There's a  tag in a base page
> which is linked to a Label component in the code, which when rendered in the
> second  tag predictably throws an exception.  The full question is on
> the link below in Stack Overflow. This code worked in Wicket 1.4 but not
> after porting to 1.5:
>
> http://stackoverflow.com/questions/11243714/wicket-head-tag-rendered-twice-for-pages-extending-a-base-page
> http://stackoverflow.com/questions/11243714/wicket-head-tag-rendered-twice-for-pages-extending-a-base-page

Not sure.
I see no  in UnSecureTemplate.html.

>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4650350.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> 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: Caching Imagages, CSS, JS in Wicket 1.5.3

2012-07-03 Thread sardo
Thanks Martin, that helps. Forgive my naivety, but why do I have the option
of adding CSS via the Java code? Surely it's better to follow convention and
add it into the appropriate .war directory?

...and if I could do the Columbo, "Just one more thing", thing. Why am I
getting two  tags in my app?  There's a  tag in a base page
which is linked to a Label component in the code, which when rendered in the
second  tag predictably throws an exception.  The full question is on
the link below in Stack Overflow. This code worked in Wicket 1.4 but not
after porting to 1.5:

http://stackoverflow.com/questions/11243714/wicket-head-tag-rendered-twice-for-pages-extending-a-base-page
http://stackoverflow.com/questions/11243714/wicket-head-tag-rendered-twice-for-pages-extending-a-base-page
 


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4650350.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Caching Imagages, CSS, JS in Wicket 1.5.3

2012-07-03 Thread Martin Grigorov
Hi,

Either don't use ContextRelativeResource for the css or use it for all
resources, i.e. the image should be delivered by
ContextRelativeResource too.

With the SharedResources you mount the .css at your own url and
deliver its content. But there is no such code for the images.

I'd remove the shared resources mounting and put the  to the
.css directly in MyPage.html.

On Tue, Jul 3, 2012 at 11:50 AM, sardo  wrote:
> I have a similar problem:
>
> A css style sheet is added to the app like so:
>
>  getSharedResources().add("css_table", new
> ContextRelativeResource("css/table.css"));
>
> and this css file contains image references like so:
>
>   div.tabpanel div.tab-row li {
> float: left;
> background: url("../images/tabs/left.png") no-repeat left top;
> margin: 0;
> padding: 0 0 0 9px;
>   }
>
> The problem is the images aren't displayed because Wicket is prefixing the
> path with:
>
>myApp/wicket/resource/images/tabs/left.png (generates a 404)
>
> instead of leaving it like this:
>
>myApp/images/tabs/left.png
>
> Is there a way to solve this?  chris.schaefer did ask something similar
> during the discussion above but I don't think it was answered...
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4650329.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> 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: Caching Imagages, CSS, JS in Wicket 1.5.3

2012-07-03 Thread sardo
I have a similar problem:

A css style sheet is added to the app like so:

 getSharedResources().add("css_table", new
ContextRelativeResource("css/table.css"));

and this css file contains image references like so:

  div.tabpanel div.tab-row li {
float: left;
background: url("../images/tabs/left.png") no-repeat left top;
margin: 0;
padding: 0 0 0 9px;
  }

The problem is the images aren't displayed because Wicket is prefixing the
path with:

   myApp/wicket/resource/images/tabs/left.png (generates a 404)

instead of leaving it like this:

   myApp/images/tabs/left.png

Is there a way to solve this?  chris.schaefer did ask something similar
during the discussion above but I don't think it was answered...

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4650329.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Caching Imagages, CSS, JS in Wicket 1.5.3

2011-12-03 Thread Martijn Dashorst
Or new ContextImage(...)

Martijn

On Wed, Nov 30, 2011 at 9:09 PM, Martin Grigorov  wrote:
> Try with: new Image(someId, new ContextRelativeResource("images/logout.png"))
>
> On Wed, Nov 30, 2011 at 6:40 PM, chris.schaefer  
> wrote:
>>
>> another thing i did not mention is,
>>
>> that in this applicaiton the images and js and css files are stored in the
>> webapp/images folder and not in the classpath packages !
>>
>> is it intended / required to store all images within java packages ?
>>
>>
>> chris
>>
>>
>>
>> --
>> View this message in context: 
>> http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4123974.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> -
>> 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
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Caching Imagages, CSS, JS in Wicket 1.5.3

2011-11-30 Thread Martin Grigorov
Try with: new Image(someId, new ContextRelativeResource("images/logout.png"))

On Wed, Nov 30, 2011 at 6:40 PM, chris.schaefer  wrote:
>
> another thing i did not mention is,
>
> that in this applicaiton the images and js and css files are stored in the
> webapp/images folder and not in the classpath packages !
>
> is it intended / required to store all images within java packages ?
>
>
> chris
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4123974.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> 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: Caching Imagages, CSS, JS in Wicket 1.5.3

2011-11-30 Thread chris.schaefer

another thing i did not mention is, 

that in this applicaiton the images and js and css files are stored in the
webapp/images folder and not in the classpath packages ! 

is it intended / required to store all images within java packages ?


chris



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4123974.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Caching Imagages, CSS, JS in Wicket 1.5.3

2011-11-30 Thread chris.schaefer
thanks for this answer.
in the pub example this seems to work, and we also see the Cache-control
headers.

but we do not need and have language specific resouces (so far). 

a. can you tell me how we should change the image construction for our
initialization code which currently looks like this:

Image img = new Image("logoutImg") {
protected void onComponentTag(ComponentTag tag) {
super.onComponentTag(tag);
tag.put("src", baseUrl+"images/logout.png");
}
};

should this then be like this ?:  
 ResourceReference resRefFrogster = new
SharedResourceReference("./images/my_image.jpg");
 Image test = new Image("testid", resRefFrogster);
 add(img);

which resourceReference is to take for non NLS: images, css and js ?

b. can you tell me how we should change our scirpt include which is
currently done in the html file directly in the header like this:





thanks !

lg chris


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4123742.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Caching Imagages, CSS, JS in Wicket 1.5.3

2011-11-30 Thread Peter Ertl
the effects of the caching strategy can been for example on package resources 
(e.g. javascript, css, images) …

e.g. start wicket-examples and load the 

  "pub - Localization"

page (the page with the different beers :-)

From looking at the html source you see url's like this:



part of the url is the fingerprint which is provided by the deployment caching 
strategy (= MessageDigestResourceVersion) since the sample runs with config = 
deployment.

the code that sets the strategies can been seen in the method

   org.apache.wicket.settings.def.ResourceSettings#getCachingStrategy()


you also see in the sample that the beer image, which is an 
org.apache.wicket.markup.html.image.Image works with different locales. Just 
switch the country and see that the fingerprints changes for the same resource 
url with different locale qualifiers in the query string.

If you want to implement own resource types that should use the caching 
strategy they should implement 
org.apache.wicket.request.resource.caching.IStaticCacheableResource (read the 
javadoc)

also you should construct urls using wicket's urlFor(…) so the caching strategy 
gets applied to the url.

if you just want to use wicket's default resource types (package resources, 
etc.) you don't have to do anything since caching should work transparently.

Cheers
Peter


Am 30.11.2011 um 14:21 schrieb chris.schaefer:

> yes we also tested with the default strategy, it does not change anything.
> and 
> yes we reviews the link about caching already.
> 
> no we have not found any working example for wicket 1.5. and caching, but
> reviewed most of the samples and git sources i think. which example would be
> the working one ? 
> 
> thanks.
> chris
> 
> 
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4122947.html
> Sent from the Users forum mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 



Re: Caching Imagages, CSS, JS in Wicket 1.5.3

2011-11-30 Thread chris.schaefer
yes we also tested with the default strategy, it does not change anything.
and 
yes we reviews the link about caching already.

no we have not found any working example for wicket 1.5. and caching, but
reviewed most of the samples and git sources i think. which example would be
the working one ? 

thanks.
 chris


--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4122947.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Caching Imagages, CSS, JS in Wicket 1.5.3

2011-11-30 Thread Peter Ertl
> 
> and we have set: /getResourceSettings().setCachingStrategy(strat); /during
> application init.
> 

You don't have to. There's a default strategy during development and deployment 
that should work in most cases.

Basically you have "wicket-examples" which are part of the wicket distribution 
and provide sample of working caching.

here's a little more general information on caching in 1.5: 
https://cwiki.apache.org/WICKET/caching-in-wicket-15.html

Cheers
Peter

Re: Caching Imagages, CSS, JS in Wicket 1.5.3

2011-11-29 Thread Doug Leeper
Out of curiosity, why aren't you using ContextImage?  That would help with
the contextual path for the logout.png. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Caching-Imagages-CSS-JS-in-Wicket-1-5-3-tp4121068p4121323.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org