Error on Redirect when 2 pages begins with the same characters

Details

Description

Hi,

the setRedirect method with the target Page class doesn't work on a page which has the same beginners characters with another page
In my case, i had 2 pages named PatindPage.class and PatindBOPage.class, their names have the same Patind characters.

With Click 1.4 when i call the setRedirect(PatindBOPage.class), it works well but with Click 1.5, it doesn't find the path (404 error)
If i try with the PatindPage.class, i have the same error, and finally if i try with ApatindBOPage.class it works.

One thing you might want to do is clean and recompile your project and try again. Also look at the redirect URL generated in your browser. Why is it giving a 404? If you want you can post the redirect URL in a comment below.

Bob Schellink
added a comment - 13/Nov/08 10:14 Hi Christophe,
I did a quick test but cannot produce it. Redirecting between two test pages PatindPage and PatindBOPage seems to work.
Also the fact that you receive 404 seems to suggest a different problem. If Click cannot find a Page it will show the "Page not found" error: http://www.avoka.com/click-examples/general/missing.htm
One thing you might want to do is clean and recompile your project and try again. Also look at the redirect URL generated in your browser. Why is it giving a 404? If you want you can post the redirect URL in a comment below.
bob

Bob Schellink
added a comment - 13/Nov/08 11:48 Ah interesting. Since the context path '/patind' and the page path '/patindBO.htm' have the same prefix '/patind' Click thinks the context is already part of the path and does not add it.
We'll fix this for 1.5.1.
In the meantime you can work around this by redirecting to the path instead of the page class.
Or create a custom BorderPage override setRedirect with the following:
public void setRedirect(String location) {
if (location != null) {
if (location.charAt(0) == '/') {
Context context = getContext();
String contextPath = context.getRequest().getContextPath();
// CLK-468 - append trailing '/' in case context and path prefix is the same
if (!location.startsWith(contextPath + '/'))
{
location = contextPath + location;
}
}
}
redirect = location;
}
Thanks.