Hi everyone,

I've got a interesting requirement and, being only a complete newbie to
Wicket, I'm not 100% sure I can achieve it. Basically, assume you have the
following URL to display a product:

app/products/1234

I know I can use bookmarkable links and URL mounting in Wicket to allow such
"pretty" URLs. However, something that is extremely common on the Web these
days is including additional path information in a URL that further
identifies the contents of the page - mainly for search engine
optimization/marketing reasons.

For example, the product with code 1234 might be the book "Wicket in
Action". So what I'd really want is for the following URL to work:

app/products/1234/Wicket-in-Action.html

Now, what you'll find in most cases is that the web application completely
ignores the URL after the product code so, even if I navigated to
app/products/1234/blah-blah-blah.html, it would still be the correct product
page for the Wicket in Action book.

So, my question is, does this requirement sound like something that would be
easily possible in Wicket (maybe with some custom URL mounting strategy)?

I can easily do something like this with the REST support in Spring MVC 3.0
because I can simply map a Spring MVC Controller to a URL using wildcarding.
With the annotation support in Spring MVC, I can do something like this:

@RequestMapping( value = "/products/{productId}/*", method =
RequestMethod.GET )
public ModelAndView getProduct( @PathVariable( value = "productId" ) String
productId) { ... }

What this example shows is that the0 method getProduct() will be invoked
with any URL that starts with /products/[productId]. So it doesn't matter if
the invoker has added additional path information, it will just be ignored.

I'd be keen to understand a bit more about URL mounting and whether I could
achieve something similar to this with Wicket. Maybe if there was some kind
of wildcarding strategy? It is also important that I can build bookmarkable
links in Wicket pages that could include the additional path information.

Thanks for any help you can give me,

Andrew

Reply via email to