You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by bh...@actrix.gen.nz on 2010/06/19 20:27:47 UTC

Re: ResourceStreamLocator and mvn resource:resource copying resources in the right directory

Thanks Erik.

Why are you using absolute URLS?

Are you using absolute URLs to support editing in the web directory,
with a directory structure the same as the java package structure,
without breaking images?

Then it would look like you have found a different solution for the
same problem. Interesting. Both solutions require only small changes.
Have you tried to patch RelativePathPrefixHandler? With that change,
you would no longer be restricted to absolute paths.


Regards,

Bernard


On Sat, 19 Jun 2010 14:15:44 +0200, you wrote:

>Hi,
>
>https://issues.apache.org/jira/browse/WICKET-1974 describes a way to 
>make all URLs absolute.
>
>Unfortunately the patch attached to the issue is still not applied so 
>you'll have to build wicket yourself.
>
>Regards,
>     Erik.
>
>
>Op 18-06-10 21:56, bht@actrix.gen.nz schreef:
>> Hi Fernando,
>>
>> obviously quite a few including yourself are separating markup from
>> Java packages to make it accessable to HTML developers.
>>
>> How do you cope with the fact that Wicket markup, when rendered in any
>> folder without flattening the package structure, gets broken images?
>>
>> That is what I am trying to address with
>>
>> "Cannot substitute RelativePathPrefixHandler"
>> https://issues.apache.org/jira/browse/WICKET-2881
>>
>> The three lines of Java code in RelativePathPrefixHandler are solving
>> this problem.
>>
>> int lastIndex = attrValue.lastIndexOf("../");
>> if (lastIndex>= 0){
>>      attrValue = attrValue.substring(lastIndex + 3);
>> }
>>
>> Regards,
>> Bernard
>>
>>    


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


Re: ResourceStreamLocator and mvn resource:resource copying resources in the right directory

Posted by bh...@actrix.gen.nz.
Hi Erik,

I know the problem. It is a JavaScript problem, where the browser has
to construct an absolute URL from the relative URL that is in the HTML
fragment. The question is relative to what context this URL has to be
constructed in the browser - relative to the source of the fragment,
to some iframe or to the source of the page it is inserted into.

I am not arguing with you that you have found a good solution to the
problem.

But if you wanted to solve the problem at the root of it, you would
code the relative URLs at the server, and make them absolute at the
client side. The conversion is quite trivial. I did this for a
JavaScript based e-commerce app some time ago. This will always work
because the browser cannot reqest relative URLs anyway.

Regarding Wicket's inability to do this out of the box, I am once
again disappointed. This is so basic it blows my mind. While Wicket is
very flexible in many areas, in some areas it forces special use cases
as "best practice" on site develpers who then don't have any choices.

RelativePathPrefixHandler just breaks things by making a stupid
assumption about paths. I wish I could replace it dynamically.

If I start making alternative suggesions, then I am hearing catchy
words like "best practice" "community consensus" , "begginner" and "we
like to do it this way". That never convinces anyone because there is
no such thing as a community consensus, and especially not one that
agrees on a special use case.

I would say that putting HTML pages alongside Java source files is a
special use case for component deployment. It is ridiculous to call
this Wicket best practice for site development. Once you explore
benefits eg  better separation of concerns of the more general cases,
you run into trouble only because the original designers did not
consider them enough. A framework might originate from special use
cases but it should at some stage address general cases with higher
priority not as never ending afterthoughts. These things should be
pluggable.

Regards,

Bernard


On Sat, 19 Jun 2010 20:43:12 +0200, you wrote:

>Hi Bernard,
>
>We are using absolute URLs in one application (http://tipspot.com) that 
>does not use the wicket ajax library, only javascript (based on jquery) 
>written by the frontend developer. One of the things we do there is 
>filling popups through ajax requests. As most of that information is 
>completely stateless, we use a wicket page to produce the html 
>fragments. The URL depth and path of the original page (containing the 
>popup), and the page that is pasted into the popup, almost never 
>matches. This is a problem for linking to other pages. I found it easy 
>to make this problem go away by making all URLs absolute.
>
>I did not look at RelativePathPrefixHandler as I was unaware of its 
>existence. I am also not certain that any relative schema would be able 
>to solve the problem cleanly/easily. Secondly having absolute paths is a 
>non-issue for this application.
>
>Regards,
>     Erik.
>
>
>Op 19-06-10 20:27, bht@actrix.gen.nz wrote:
>> Thanks Erik.
>>
>> Why are you using absolute URLS?
>>
>> Are you using absolute URLs to support editing in the web directory,
>> with a directory structure the same as the java package structure,
>> without breaking images?
>>
>> Then it would look like you have found a different solution for the
>> same problem. Interesting. Both solutions require only small changes.
>> Have you tried to patch RelativePathPrefixHandler? With that change,
>> you would no longer be restricted to absolute paths.
>>
>>
>> Regards,
>>
>> Bernard
>>
>>
>> On Sat, 19 Jun 2010 14:15:44 +0200, you wrote:
>>
>>    
>>> Hi,
>>>
>>> https://issues.apache.org/jira/browse/WICKET-1974 describes a way to
>>> make all URLs absolute.
>>>
>>> Unfortunately the patch attached to the issue is still not applied so
>>> you'll have to build wicket yourself.
>>>
>>> Regards,
>>>      Erik.
>>>
>>>
>>> Op 18-06-10 21:56, bht@actrix.gen.nz schreef:
>>>      
>>>> Hi Fernando,
>>>>
>>>> obviously quite a few including yourself are separating markup from
>>>> Java packages to make it accessable to HTML developers.
>>>>
>>>> How do you cope with the fact that Wicket markup, when rendered in any
>>>> folder without flattening the package structure, gets broken images?
>>>>
>>>> That is what I am trying to address with
>>>>
>>>> "Cannot substitute RelativePathPrefixHandler"
>>>> https://issues.apache.org/jira/browse/WICKET-2881
>>>>
>>>> The three lines of Java code in RelativePathPrefixHandler are solving
>>>> this problem.
>>>>
>>>> int lastIndex = attrValue.lastIndexOf("../");
>>>> if (lastIndex>= 0){
>>>>       attrValue = attrValue.substring(lastIndex + 3);
>>>> }
>>>>
>>>> Regards,
>>>> Bernard
>>>>
>>>>
>>>>        
>>
>> ---------------------------------------------------------------------
>> 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: ResourceStreamLocator and mvn resource:resource copying resources in the right directory

Posted by Erik van Oosten <e....@grons.nl>.
Hi Bernard,

We are using absolute URLs in one application (http://tipspot.com) that 
does not use the wicket ajax library, only javascript (based on jquery) 
written by the frontend developer. One of the things we do there is 
filling popups through ajax requests. As most of that information is 
completely stateless, we use a wicket page to produce the html 
fragments. The URL depth and path of the original page (containing the 
popup), and the page that is pasted into the popup, almost never 
matches. This is a problem for linking to other pages. I found it easy 
to make this problem go away by making all URLs absolute.

I did not look at RelativePathPrefixHandler as I was unaware of its 
existence. I am also not certain that any relative schema would be able 
to solve the problem cleanly/easily. Secondly having absolute paths is a 
non-issue for this application.

Regards,
     Erik.


Op 19-06-10 20:27, bht@actrix.gen.nz wrote:
> Thanks Erik.
>
> Why are you using absolute URLS?
>
> Are you using absolute URLs to support editing in the web directory,
> with a directory structure the same as the java package structure,
> without breaking images?
>
> Then it would look like you have found a different solution for the
> same problem. Interesting. Both solutions require only small changes.
> Have you tried to patch RelativePathPrefixHandler? With that change,
> you would no longer be restricted to absolute paths.
>
>
> Regards,
>
> Bernard
>
>
> On Sat, 19 Jun 2010 14:15:44 +0200, you wrote:
>
>    
>> Hi,
>>
>> https://issues.apache.org/jira/browse/WICKET-1974 describes a way to
>> make all URLs absolute.
>>
>> Unfortunately the patch attached to the issue is still not applied so
>> you'll have to build wicket yourself.
>>
>> Regards,
>>      Erik.
>>
>>
>> Op 18-06-10 21:56, bht@actrix.gen.nz schreef:
>>      
>>> Hi Fernando,
>>>
>>> obviously quite a few including yourself are separating markup from
>>> Java packages to make it accessable to HTML developers.
>>>
>>> How do you cope with the fact that Wicket markup, when rendered in any
>>> folder without flattening the package structure, gets broken images?
>>>
>>> That is what I am trying to address with
>>>
>>> "Cannot substitute RelativePathPrefixHandler"
>>> https://issues.apache.org/jira/browse/WICKET-2881
>>>
>>> The three lines of Java code in RelativePathPrefixHandler are solving
>>> this problem.
>>>
>>> int lastIndex = attrValue.lastIndexOf("../");
>>> if (lastIndex>= 0){
>>>       attrValue = attrValue.substring(lastIndex + 3);
>>> }
>>>
>>> Regards,
>>> Bernard
>>>
>>>
>>>        
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>    


-- 
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/


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