You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by wiseguy2 <fo...@gmail.com> on 2015/04/06 01:34:59 UTC

Mounting a parameter on the root url crashes resource location wicket

in my wicket application settings I wish to mount a parameter on the root "/"
like

mountPage (Profile.class, "/{username}") similar to how twitter and facebook
maps the usernames to its accounts. In wicket 7, this seems to crash the
resource location algorithm. In the sense that all css, js files now load
with 404.

Is there a work around this?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mounting-a-parameter-on-the-root-url-crashes-resource-location-wicket-tp4670175.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Mounting a parameter on the root url crashes resource location wicket

Posted by wiseguy2 <fo...@gmail.com>.
This is what I was looking for. A way to tell the url segments apart. Thank
you. 

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mounting-a-parameter-on-the-root-url-crashes-resource-location-wicket-tp4670175p4670220.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Mounting a parameter on the root url crashes resource location wicket

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

/wicket is nothing special. Every application can use it for its own needs.
The problem is that your mount path would match anything. Even
'/something/that/do/not/exist'.

There are several solutions. Here is one of them:

Override MountedMapper#urlStartsWithMountedSegments(Url url) to return
'true' only if the url has a single segment (the username)
MyApp.mount(new MountedMapper("/${username}", ProfilePage.class) {
  @Override protected boolean urlStartsWithMountedSegments(Url url) {return
url.getSegments().size() == 1;}
})

Martin Grigorov
Freelancer, available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Apr 7, 2015 at 10:33 PM, wiseguy2 <fo...@gmail.com>
wrote:

> In a social network, that seems redundant especially when users will be
> sharing the links on other platforms. Is it not possible for wicket to
> treat
> the /wicket/* urls differently with a separate filter so that mounting a
> parameter in root doesnt collapse resource resoclution? This is where the
> problem lies.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Mounting-a-parameter-on-the-root-url-crashes-resource-location-wicket-tp4670175p4670217.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Mounting a parameter on the root url crashes resource location wicket

Posted by wiseguy2 <fo...@gmail.com>.
In a social network, that seems redundant especially when users will be
sharing the links on other platforms. Is it not possible for wicket to treat
the /wicket/* urls differently with a separate filter so that mounting a
parameter in root doesnt collapse resource resoclution? This is where the
problem lies.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mounting-a-parameter-on-the-root-url-crashes-resource-location-wicket-tp4670175p4670217.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Mounting a parameter on the root url crashes resource location wicket

Posted by Christoph Läubrich <la...@googlemail.com>.
Why not simply use "/profile/${username}" or something like 
"/user-${username}"?


Am 07.04.2015 12:43, schrieb wiseguy2:
> I have that in the actual code.
>
> I have two pages mounted.
>
> 1. Home page at "/" pointing to Index.class
> 2. Person profile page "/${username}"
>
> Each time wicket tries to load a resource e.g
> ./wicket/resources/package/jquery.css
>
> it calls the person profile page.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mounting-a-parameter-on-the-root-url-crashes-resource-location-wicket-tp4670175p4670202.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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: Mounting a parameter on the root url crashes resource location wicket

Posted by wiseguy2 <fo...@gmail.com>.
do I have to mount each resource manually with the dispatcher? If yes, how do
I do this. I use the wicket:link tags 95% of the time for a tonne of files
like js, css, imgs. Links to these files are generated by wicket. and they
all follow the /* pattern of course.


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mounting-a-parameter-on-the-root-url-crashes-resource-location-wicket-tp4670175p4670215.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Mounting a parameter on the root url crashes resource location wicket

Posted by Martin Grigorov <mg...@apache.org>.
Well, Wicket matches the request at "/wicket".
"resources/package/jquery.css" are then treated as path parameters:
parameters.get(0) == "resources"
parameters.get(1) == "package"
parameters.get(2) == "jquery.css"

As I suggested at StackOverflow: use Index.java as a dispatcher. If there
is parameters.get(0) then show profile data, otherwise the home page.

Martin Grigorov
Freelancer, available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Tue, Apr 7, 2015 at 1:43 PM, wiseguy2 <fo...@gmail.com>
wrote:

> I have that in the actual code.
>
> I have two pages mounted.
>
> 1. Home page at "/" pointing to Index.class
> 2. Person profile page "/${username}"
>
> Each time wicket tries to load a resource e.g
> ./wicket/resources/package/jquery.css
>
> it calls the person profile page.
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Mounting-a-parameter-on-the-root-url-crashes-resource-location-wicket-tp4670175p4670202.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Mounting a parameter on the root url crashes resource location wicket

Posted by wiseguy2 <fo...@gmail.com>.
I have that in the actual code. 

I have two pages mounted. 

1. Home page at "/" pointing to Index.class 
2. Person profile page "/${username}"

Each time wicket tries to load a resource e.g
./wicket/resources/package/jquery.css

it calls the person profile page.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Mounting-a-parameter-on-the-root-url-crashes-resource-location-wicket-tp4670175p4670202.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Mounting a parameter on the root url crashes resource location wicket

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Mon, Apr 6, 2015 at 2:34 AM, wiseguy2 <fo...@gmail.com>
wrote:

> in my wicket application settings I wish to mount a parameter on the root
> "/"
> like
>
> mountPage (Profile.class, "/{username}") similar to how twitter and
> facebook
>

The mount path should be: ${username}. I.e. with a leading '$'.


> maps the usernames to its accounts. In wicket 7, this seems to crash the
> resource location algorithm. In the sense that all css, js files now load
> with 404.
>

Crashes how exactly? We need more details to be able to help you.


>
> Is there a work around this?
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Mounting-a-parameter-on-the-root-url-crashes-resource-location-wicket-tp4670175.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>