• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

an attempt to access a non existing page

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
is there any way how to handle the situation when a user tries to access a non existing page (by editing the URL in browser - for examplea page http://localhost:8080/jforum/PageWhichDoesNotExist.page)?

Currently, if the user is not logged, there is a message that an error occured and a detail "java.util.ArrayList cannot be cast to java.lang.String". If the user is logged, surprisingly header.htm is automatically called as the first page to be included somewhere and in my case usually there is an exception because of some unimportant reason.

It would be nice to have some possibility to show a standart 404 page not found or something else useable. Is this possible? I would say it should be.

Thanks,
Roman

[originally posted on jforum.net by romant]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What version of jForum are you using? My quick testing got 404 errors for non-existing pages.
[originally posted on jforum.net by monroe]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using the last version, 2.1.8 of course. Yes, you can get 404 page not found if the non existing page you try to access does not end with ".page". But if it does the behaviour as I described in my previous post. And I think that it is not just my problem, it is the general behaviour, just try to access this site and you will see

http://www.jforum.net/forums/ANonExistingPage.page

Cheers.
Roman
[originally posted on jforum.net by romant]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
WHoops, sorry I tested on 2.1.7 and it worked... that gave me a starting point and I found that it looks like the WebRequestContext code has a bug about line 159. It calls the parseFriendlyURL method twice which set the module parameter to null twice... which converts it from a String to an ArrayList.

Anyway if you move this call into the if ( index > -1 ) condition above it, things should work as designed. E.g. The code should look like:



Not sure if Raphael is going to do a maint release on the 2.1.8, but if you add this as a Jira issue, it will probably make it into that release.
[originally posted on jforum.net by monroe]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great,
thanks for the solution. I had my own fix, but this one is better.

Cheers,
Roman
[originally posted on jforum.net by romant]
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic