You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Lester Chua <ci...@gmail.com> on 2009/12/04 08:11:55 UTC

Resource Location

Hi,

I'm attempting to load a css resource.

The example in the wicket reference was using:
private static final CompressedResourceReference MYPAGE_CSS = new CompressedResourceReference(MyPage.class, "MyPage.css");

I understand that this is scoped to MyPage.class

I used
CompressedResourceReference MYPAGE_CSS = new CompressedResourceReference("css/jquery/cupertino/jquery-ui-1.7.2.custom.css");		
add(CSSPackageResource.getHeaderContribution(MYPAGE_CSS));

It is scoped to the application, which it should. But the generated link is:

<link rel="stylesheet" type="text/css" href="resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css <view-source:http://localhost:8888/mirage/resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css>" />

which my browser cannot find. What should be the correct way to do this? I tried hard referencing as well but did not get it to work as well.

Lester




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


Re: Resource Location

Posted by Igor Vaynberg <ig...@gmail.com>.
if its in your context path you can simply link to it in the markup
with its context-relative path.

-igor

On Fri, Dec 4, 2009 at 7:13 AM, Lester Chua <ci...@gmail.com> wrote:
> Is there a way to load the css from webapp's context path?
>
> Stefan Droog wrote:
>>
>> If you use CompressedResourceReference(MyPage.class, "MyPage.css"); it
>> will expect to have the CSS file in the same package as the MyPage.class.
>>
>> So in your case the css file should be in the following package:
>> myPackage/Application.java
>> myPackage/css/jquery/cupertino/jquery-ui-1.7.2.custom.css
>>
>> Regards,
>> Stefan
>>
>> -----Original Message-----
>> From: Lester Chua [mailto:cicowicket@gmail.com]
>> Sent: Friday, December 04, 2009 9:34 AM
>> To: users@wicket.apache.org
>> Subject: Re: Resource Location
>>
>> Do u mean that I did not specify the path?
>> I thought it's done with
>> "css/jquery/cupertino/jquery-ui-1.7.2.custom.css".
>> Do I need to do a exact path? Or can wicket infer from the webapp
>> context path?
>>
>>
>> Marat Radchenko wrote:
>>
>>>
>>> 2009/12/4 Lester Chua <ci...@gmail.com>:
>>>
>>>
>>>>
>>>> Hi,
>>>>
>>>> I'm attempting to load a css resource.
>>>>
>>>> The example in the wicket reference was using:
>>>> private static final CompressedResourceReference MYPAGE_CSS = new
>>>> CompressedResourceReference(MyPage.class, "MyPage.css");
>>>>
>>>> I understand that this is scoped to MyPage.class
>>>>
>>>> I used
>>>> CompressedResourceReference MYPAGE_CSS = new
>>>>
>>>> CompressedResourceReference("css/jquery/cupertino/jquery-ui-1.7.2.custom.css");
>>>>
>>>> add(CSSPackageResource.getHeaderContribution(MYPAGE_CSS));
>>>>
>>>> It is scoped to the application, which it should. But the generated link
>>>> is:
>>>>
>>>> <link rel="stylesheet" type="text/css"
>>>>
>>>> href="resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css
>>>>
>>>> <view-source:http://localhost:8888/mirage/resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css>"
>>>> />
>>>>
>>>> which my browser cannot find. What should be the correct way to do this?
>>>> I
>>>> tried hard referencing as well but did not get it to work as well.
>>>>
>>>> Lester
>>>>
>>>>
>>>
>>> You didn't say where your css file is located.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>> The information contained in this communication is confidential, intended
>> solely for the use of the individual or entity to whom it is addressed and
>> may be legally privileged and protected by professional secrecy. Access to
>> this message by anyone else is unauthorized. If you are not the intended
>> recipient, any disclosure, copying, or distribution of the message, or any
>> action or omission taken by you in reliance on it is prohibited and may be
>> unlawful. Please immediately contact the sender if you have received this
>> message in error. This email does not constitute any commitment from Cordys
>> Holding BV or any of its subsidiaries except when expressly agreed in a
>> written agreement between the intended recipient and Cordys Holding BV or
>> its subsidiaries. Cordys is neither liable for the proper and complete
>> transmission of the information contained in this communication nor for any
>> delay in its receipt. Cordys does not guarantee that the integrity of this
>> communication has been maintained nor that the communication is free of
>> viruses, interceptions or interference. If you are not the intended
>> recipient of this communication please return the communication to the
>> sender and delete and destroy all copies.
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Resource Location

Posted by Lester Chua <ci...@gmail.com>.
Is there a way to load the css from webapp's context path?

Stefan Droog wrote:
> If you use CompressedResourceReference(MyPage.class, "MyPage.css"); it will expect to have the CSS file in the same package as the MyPage.class.
>
> So in your case the css file should be in the following package:
> myPackage/Application.java
> myPackage/css/jquery/cupertino/jquery-ui-1.7.2.custom.css
>
> Regards,
> Stefan
>
> -----Original Message-----
> From: Lester Chua [mailto:cicowicket@gmail.com]
> Sent: Friday, December 04, 2009 9:34 AM
> To: users@wicket.apache.org
> Subject: Re: Resource Location
>
> Do u mean that I did not specify the path?
> I thought it's done with "css/jquery/cupertino/jquery-ui-1.7.2.custom.css".
> Do I need to do a exact path? Or can wicket infer from the webapp
> context path?
>
>
> Marat Radchenko wrote:
>   
>> 2009/12/4 Lester Chua <ci...@gmail.com>:
>>
>>     
>>> Hi,
>>>
>>> I'm attempting to load a css resource.
>>>
>>> The example in the wicket reference was using:
>>> private static final CompressedResourceReference MYPAGE_CSS = new
>>> CompressedResourceReference(MyPage.class, "MyPage.css");
>>>
>>> I understand that this is scoped to MyPage.class
>>>
>>> I used
>>> CompressedResourceReference MYPAGE_CSS = new
>>> CompressedResourceReference("css/jquery/cupertino/jquery-ui-1.7.2.custom.css");
>>>
>>> add(CSSPackageResource.getHeaderContribution(MYPAGE_CSS));
>>>
>>> It is scoped to the application, which it should. But the generated link is:
>>>
>>> <link rel="stylesheet" type="text/css"
>>> href="resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css
>>> <view-source:http://localhost:8888/mirage/resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css>"
>>> />
>>>
>>> which my browser cannot find. What should be the correct way to do this? I
>>> tried hard referencing as well but did not get it to work as well.
>>>
>>> Lester
>>>
>>>       
>> You didn't say where your css file is located.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> The information contained in this communication is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be legally privileged and protected by professional secrecy. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. This email does not constitute any commitment from Cordys Holding BV or any of its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Cordys Holding BV or its subsidiaries. Cordys is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Cordys does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.
>   



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


RE: Resource Location

Posted by Stefan Droog <sd...@educator.eu>.
If you use CompressedResourceReference(MyPage.class, "MyPage.css"); it will expect to have the CSS file in the same package as the MyPage.class.

So in your case the css file should be in the following package:
myPackage/Application.java
myPackage/css/jquery/cupertino/jquery-ui-1.7.2.custom.css

Regards,
Stefan

-----Original Message-----
From: Lester Chua [mailto:cicowicket@gmail.com]
Sent: Friday, December 04, 2009 9:34 AM
To: users@wicket.apache.org
Subject: Re: Resource Location

Do u mean that I did not specify the path?
I thought it's done with "css/jquery/cupertino/jquery-ui-1.7.2.custom.css".
Do I need to do a exact path? Or can wicket infer from the webapp
context path?


Marat Radchenko wrote:
> 2009/12/4 Lester Chua <ci...@gmail.com>:
>
>> Hi,
>>
>> I'm attempting to load a css resource.
>>
>> The example in the wicket reference was using:
>> private static final CompressedResourceReference MYPAGE_CSS = new
>> CompressedResourceReference(MyPage.class, "MyPage.css");
>>
>> I understand that this is scoped to MyPage.class
>>
>> I used
>> CompressedResourceReference MYPAGE_CSS = new
>> CompressedResourceReference("css/jquery/cupertino/jquery-ui-1.7.2.custom.css");
>>
>> add(CSSPackageResource.getHeaderContribution(MYPAGE_CSS));
>>
>> It is scoped to the application, which it should. But the generated link is:
>>
>> <link rel="stylesheet" type="text/css"
>> href="resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css
>> <view-source:http://localhost:8888/mirage/resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css>"
>> />
>>
>> which my browser cannot find. What should be the correct way to do this? I
>> tried hard referencing as well but did not get it to work as well.
>>
>> Lester
>>
>
> You didn't say where your css file is located.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>


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


The information contained in this communication is confidential, intended solely for the use of the individual or entity to whom it is addressed and may be legally privileged and protected by professional secrecy. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, or distribution of the message, or any action or omission taken by you in reliance on it is prohibited and may be unlawful. Please immediately contact the sender if you have received this message in error. This email does not constitute any commitment from Cordys Holding BV or any of its subsidiaries except when expressly agreed in a written agreement between the intended recipient and Cordys Holding BV or its subsidiaries. Cordys is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt. Cordys does not guarantee that the integrity of this communication has been maintained nor that the communication is free of viruses, interceptions or interference. If you are not the intended recipient of this communication please return the communication to the sender and delete and destroy all copies.

Re: Resource Location

Posted by Lester Chua <ci...@gmail.com>.
Do u mean that I did not specify the path?
I thought it's done with "css/jquery/cupertino/jquery-ui-1.7.2.custom.css".
Do I need to do a exact path? Or can wicket infer from the webapp 
context path?


Marat Radchenko wrote:
> 2009/12/4 Lester Chua <ci...@gmail.com>:
>   
>> Hi,
>>
>> I'm attempting to load a css resource.
>>
>> The example in the wicket reference was using:
>> private static final CompressedResourceReference MYPAGE_CSS = new
>> CompressedResourceReference(MyPage.class, "MyPage.css");
>>
>> I understand that this is scoped to MyPage.class
>>
>> I used
>> CompressedResourceReference MYPAGE_CSS = new
>> CompressedResourceReference("css/jquery/cupertino/jquery-ui-1.7.2.custom.css");
>>
>> add(CSSPackageResource.getHeaderContribution(MYPAGE_CSS));
>>
>> It is scoped to the application, which it should. But the generated link is:
>>
>> <link rel="stylesheet" type="text/css"
>> href="resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css
>> <view-source:http://localhost:8888/mirage/resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css>"
>> />
>>
>> which my browser cannot find. What should be the correct way to do this? I
>> tried hard referencing as well but did not get it to work as well.
>>
>> Lester
>>     
>
> You didn't say where your css file is located.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>   


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


Re: Resource Location

Posted by Marat Radchenko <sl...@gmail.com>.
2009/12/4 Lester Chua <ci...@gmail.com>:
> Hi,
>
> I'm attempting to load a css resource.
>
> The example in the wicket reference was using:
> private static final CompressedResourceReference MYPAGE_CSS = new
> CompressedResourceReference(MyPage.class, "MyPage.css");
>
> I understand that this is scoped to MyPage.class
>
> I used
> CompressedResourceReference MYPAGE_CSS = new
> CompressedResourceReference("css/jquery/cupertino/jquery-ui-1.7.2.custom.css");
>
> add(CSSPackageResource.getHeaderContribution(MYPAGE_CSS));
>
> It is scoped to the application, which it should. But the generated link is:
>
> <link rel="stylesheet" type="text/css"
> href="resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css
> <view-source:http://localhost:8888/mirage/resources/org.apache.wicket.Application/css/jquery/cupertino/jquery-ui-1.7.2.custom.css>"
> />
>
> which my browser cannot find. What should be the correct way to do this? I
> tried hard referencing as well but did not get it to work as well.
>
> Lester

You didn't say where your css file is located.

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