URL coding strategies

2010-12-16 Thread Henrique Boregio
Hello, I am mounting my URLs so I can list product items like so:
http://www.mysite.com/item/id/0
http://www.mysite.com/item/id/1

and so on...then I user this id param to fetch the data from the database.

I am not accesing this page directly. I have another page where the
items are fully listed (the item's title, description, price, etc) and
when the user click on each item, they are redirected to this /item/id
page.

Is there a way to avoid exposing the item's id, but send it behind
the scenes to the next page, so I would have something like:
http://www.mysite.com/item/ITEM_TITLE
eg. http://www.mysite.com/item/Ford-Ranger-Model-2005

In other words, I'm still using the item's id to fetch it from the
database, but the URL shows an SEO friendly version.

Thanks.

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



Re: URL coding strategies

2010-12-16 Thread Andrea Del Bene

Hi Henrique,

are you using a custom WebRequestCodingStrategy implementation? This 
class should let you encode visible URL as you prefer.

Hello, I am mounting my URLs so I can list product items like so:
http://www.mysite.com/item/id/0
http://www.mysite.com/item/id/1

and so on...then I user this id param to fetch the data from the database.

I am not accesing this page directly. I have another page where the
items are fully listed (the item's title, description, price, etc) and
when the user click on each item, they are redirected to this /item/id
page.

Is there a way to avoid exposing the item's id, but send it behind
the scenes to the next page, so I would have something like:
http://www.mysite.com/item/ITEM_TITLE
eg. http://www.mysite.com/item/Ford-Ranger-Model-2005

In other words, I'm still using the item's id to fetch it from the
database, but the URL shows an SEO friendly version.

Thanks.

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






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



Re: URL coding strategies

2010-12-16 Thread Bas Gooren

There are two ways to achieve what you are looking for:

1) store a stable, unique textual identifier per product (e.g. 
Ford-Ranger-Model-2005), and lookup the product from this identifier
2) store a textual identifier - ID mapping in your session and do the 
lookup when the page is accessed; of course this mapping needs to be created 
at some point in time so the product page can lookup the proper product ID.


Option (2) is rather clumsy as it requires a session for a url that looks 
stateless/bookmarkable. Also, you cannot get around the fact that you need 
to be able to identify the product somehow.


I'd suggest you take a close look at option (1).

In general sending it behind the scenes is impossible in the way you are 
thinking about it. How would you handle the case that the user bookmarks 
said item-url, and instead of going to your list page goes to the product 
page directly? That way the only contextual information you have is what is 
in the url.


Good luck.

Bas

- Original Message - 
From: Henrique Boregio hbore...@gmail.com

To: users@wicket.apache.org
Sent: Thursday, December 16, 2010 4:05 PM
Subject: URL coding strategies



Hello, I am mounting my URLs so I can list product items like so:
http://www.mysite.com/item/id/0
http://www.mysite.com/item/id/1

and so on...then I user this id param to fetch the data from the database.

I am not accesing this page directly. I have another page where the
items are fully listed (the item's title, description, price, etc) and
when the user click on each item, they are redirected to this /item/id
page.

Is there a way to avoid exposing the item's id, but send it behind
the scenes to the next page, so I would have something like:
http://www.mysite.com/item/ITEM_TITLE
eg. http://www.mysite.com/item/Ford-Ranger-Model-2005

In other words, I'm still using the item's id to fetch it from the
database, but the URL shows an SEO friendly version.

Thanks.

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





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



Re: URL coding strategies

2010-12-16 Thread Henrique Boregio
Hey Bas, you're right, I hadn't thought of it that way.

In option 1, how would I go about using a unique textual identifier?
Say there are 2 items with the name Ford Ranger Model 2005 but each
one is posted by different users, the URL would still be:
http://www.mysite.com/item/Ford-Ranger-Model-2005

..since no reference is made to the user, just to the item itself.

Is there a workaround this issue or do I need to make some kind of
reference to difference among items with the same title?
http://www.mysite.com/item/1-Ford-Ranger-Model-2005
http://www.mysite.com/item/2-Ford-Ranger-Model-2005
http://www.mysite.com/item/3-Ford-Ranger-Model-2005

Thanks.

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



Re: URL coding strategies

2010-12-16 Thread Bas Gooren
Well, look at it this way: when the user enters your application without any 
known state (session or other), how can you differentiate? Only by what you 
know/get from the url.


So yes, if the name itself is not enough input to make a textual identifier 
unique, you'll have to include more information in the identifier.


Bas

- Original Message - 
From: Henrique Boregio hbore...@gmail.com

To: users@wicket.apache.org
Sent: Thursday, December 16, 2010 6:06 PM
Subject: Re: URL coding strategies



Hey Bas, you're right, I hadn't thought of it that way.

In option 1, how would I go about using a unique textual identifier?
Say there are 2 items with the name Ford Ranger Model 2005 but each
one is posted by different users, the URL would still be:
http://www.mysite.com/item/Ford-Ranger-Model-2005

..since no reference is made to the user, just to the item itself.

Is there a workaround this issue or do I need to make some kind of
reference to difference among items with the same title?
http://www.mysite.com/item/1-Ford-Ranger-Model-2005
http://www.mysite.com/item/2-Ford-Ranger-Model-2005
http://www.mysite.com/item/3-Ford-Ranger-Model-2005

Thanks.

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





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



Re: URL coding strategies

2010-03-18 Thread bgooren

You cannot have a seo-friendly url _and_ pass objects. If you want to pass an
object to another page (say a Product), then you need to create a
constructor on the target page which accepts a Product or an
IModelProduct. You can then call setResponsePage( new TargetPage( product
) ); The upside is that you only query the database once for the product,
but the url is not seo-friendly.


vp143 wrote:
 
 Hi there, I have a question about URL coding strategies
 
  
 
 I have decided to use IndexedParamUrlCodingStrategy for friendly URL's.
 
  
 
 I have set PageParameters for this strategy in the following way:
 
  
 
 PageParameters pageParameters = new PageParameters();
 
 pageParameters.add(0, categoryName);
 
 pageParameters.add(1, productName);
 
  
 
 I have then created a Bookmarkable link like the following:
 
 Link viewItem = new BookmarkablePageLink(viewItem, ProductInfo.class,
 pageParameters);
 
  
 
 What I really want to do is pass the Product object to the ProductInfo
 class
 without it being visible in the URL. 
 
 I would rather not have to query the database for data object that I
 already
 have.
 
 How can this be achieved?
 
  
 
 Many thanks in advance.
 
  
 
 Regards
 
 Vishal
 
 
 

-- 
View this message in context: 
http://old.nabble.com/URL-coding-strategies-tp27939290p27944464.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



URL coding strategies

2010-03-17 Thread Vishal Popat
Hi there, I have a question about URL coding strategies

 

I have decided to use IndexedParamUrlCodingStrategy for friendly URL's.

 

I have set PageParameters for this strategy in the following way:

 

PageParameters pageParameters = new PageParameters();

pageParameters.add(0, categoryName);

pageParameters.add(1, productName);

 

I have then created a Bookmarkable link like the following:

Link viewItem = new BookmarkablePageLink(viewItem, ProductInfo.class,
pageParameters);

 

What I really want to do is pass the Product object to the ProductInfo class
without it being visible in the URL. 

I would rather not have to query the database for data object that I already
have.

How can this be achieved?

 

Many thanks in advance.

 

Regards

Vishal