Autolinking resources in 1.4: different path after second request

View: New views
5 Messages — Rating Filter:   Alert me  

Autolinking resources in 1.4: different path after second request

by Daniel Stoch-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

We have the following problem after upgrade to Wicket 1.4:
Prepare quickstart application and add a one simple css file to HomePage, eg.

main.css:

body {
   background-color: green;
}

HomePage.html:
...
    <head>
        <title>Wicket Quickstart Archetype Homepage</title>
                <wicket:link>
                        <link href="main.css" rel="stylesheet" type="text/css"
media="screen, projection"/>
                </wicket:link>
    </head>
...

After the first request to application (eg.
http://localhost:8080/myproject) a link for main.css is rendered as:

<link href="resources/com.mycompany.HomePage/main.css"
rel="stylesheet" type="text/css" media="screen, projection"/>

but after the second request (you can simply click "refresh" in a
browser) this link is always rendered as:

<link href="resources/com.mycompany.HomePage/main_pl.css"
rel="stylesheet" type="text/css" media="screen, projection"/>

So the locale string (in my browser it is "_pl") is appended to the
resource path.
This occurs in Wicket 1.4.1 and 1.4-SNAPSHOT, in Wicket 1.3.6 the path
always is without locale.
Is it a valid behavior or is it a bug?

PS. This causes a problems when using wicketstuff-merged-resources,
when we are mounting css files.

--
Daniel

Re: Autolinking resources in 1.4: different path after second request

by theDown :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I m not sure this is the best way to add css ressources...
try to use instead
add(CssPackageResource.getHeaderContribution("main.css"));
assuming your css file is in you webapp

On Fri, Oct 2, 2009 at 2:47 PM, Daniel Stoch <daniel.stoch@...> wrote:

> Hi,
>
> We have the following problem after upgrade to Wicket 1.4:
> Prepare quickstart application and add a one simple css file to HomePage,
> eg.
>
> main.css:
>
> body {
>   background-color: green;
> }
>
> HomePage.html:
> ...
>    <head>
>        <title>Wicket Quickstart Archetype Homepage</title>
>                <wicket:link>
>                        <link href="main.css" rel="stylesheet"
> type="text/css"
> media="screen, projection"/>
>                </wicket:link>
>    </head>
> ...
>
> After the first request to application (eg.
> http://localhost:8080/myproject) a link for main.css is rendered as:
>
> <link href="resources/com.mycompany.HomePage/main.css"
> rel="stylesheet" type="text/css" media="screen, projection"/>
>
> but after the second request (you can simply click "refresh" in a
> browser) this link is always rendered as:
>
> <link href="resources/com.mycompany.HomePage/main_pl.css"
> rel="stylesheet" type="text/css" media="screen, projection"/>
>
> So the locale string (in my browser it is "_pl") is appended to the
> resource path.
> This occurs in Wicket 1.4.1 and 1.4-SNAPSHOT, in Wicket 1.3.6 the path
> always is without locale.
> Is it a valid behavior or is it a bug?
>
> PS. This causes a problems when using wicketstuff-merged-resources,
> when we are mounting css files.
>
> --
> Daniel
>

Re: Autolinking resources in 1.4: different path after second request

by Daniel Stoch-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't think there is something wrong in using <wicket:link> to add
resources (this way has some advantages too).
But I have tried your proposition and instead <wicket:link> in html, I
have added it in HomePage constructor:
add(CSSPackageResource.getHeaderContribution(HomePage.class, "main.css"));

Now the link is always rendered as (correctly for me :)):
<link rel="stylesheet" type="text/css"
href="resources/com.mycompany.HomePage/main.css" />

Well I think both ways (using <wicket:link> or header contribution in
code) should works the same.

--
Daniel

2009/10/2 François-Xavier Lacroix <fxlacroix@...>:
> I m not sure this is the best way to add css ressources...
> try to use instead
> add(CssPackageResource.getHeaderContribution("main.css"));
> assuming your css file is in you webapp
>

Re: Autolinking resources in 1.4: different path after second request

by theDown :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

i think one thing is better with header...
you can add css or javascript from every action you deal with...
Wicket manage all the added and make all the needed tags

+

On Fri, Oct 2, 2009 at 3:17 PM, Daniel Stoch <daniel.stoch@...> wrote:

> I don't think there is something wrong in using <wicket:link> to add
> resources (this way has some advantages too).
> But I have tried your proposition and instead <wicket:link> in html, I
> have added it in HomePage constructor:
> add(CSSPackageResource.getHeaderContribution(HomePage.class, "main.css"));
>
> Now the link is always rendered as (correctly for me :)):
> <link rel="stylesheet" type="text/css"
> href="resources/com.mycompany.HomePage/main.css" />
>
> Well I think both ways (using <wicket:link> or header contribution in
> code) should works the same.
>
> --
> Daniel
>
> 2009/10/2 François-Xavier Lacroix <fxlacroix@...>:
> > I m not sure this is the best way to add css ressources...
> > try to use instead
> > add(CssPackageResource.getHeaderContribution("main.css"));
> > assuming your css file is in you webapp
> >
>

Re: Autolinking resources in 1.4: different path after second request

by Daniel Stoch-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've created issue for this: WICKET-2507
https://issues.apache.org/jira/browse/WICKET-2507

--
Daniel

On Fri, Oct 2, 2009 at 3:17 PM, Daniel Stoch <daniel.stoch@...> wrote:

> But I have tried your proposition and instead <wicket:link> in html, I
> have added it in HomePage constructor:
> add(CSSPackageResource.getHeaderContribution(HomePage.class, "main.css"));
>
> Now the link is always rendered as (correctly for me :)):
> <link rel="stylesheet" type="text/css"
> href="resources/com.mycompany.HomePage/main.css" />
>
> Well I think both ways (using <wicket:link> or header contribution in
> code) should works the same.
>
> --
> Daniel