You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.
| Online: | 25 Members of 4546 |
| Forum: Seam Users |
10. Jul 2008, 16:21 CET | Link |
In our system we like to signal 404 when a user is trying to find an entity (by tinkering with the url for instance) which we don't have in our database. We like to customize a message for that error-page like: Foo
does not exist in our system. It is also of importance that the page has the 404-header.
The bean doing the search is under conversation scope (not long-running).
The message is lost in this process. Isn't this possible to do?
/Tobias
Btw. I don't really want to work around this by posting the customize message to session scope to preserve it long enough ...
I don't think the conversation is propagated to the error page (I could be wrong). Your best bet is to throw an exception that is annotated with @HttpError. There is an example of this in chapter 3 of Seam in Action.
Dan Allen | mojavelinux.com | Author of Seam in Action
Hi Dan, and thanks for answering,
Trowing an HttpError-annotated exception is exactly what we do ... but the message that we stuck into facesMessages just before throwing does not live to see the 404-page.
Any clever workarounds that comes into mind, or is signalling via the session-scope what's needed?
Best regards Tobias
As fas as i understand the SEAM ref doc (2.1.0), the conversation is propagated to the error page! I am referring to chapter: 5.3.4
The ref describes an example how to access the message of the thrown exception within/from pages.xml. As SEAM places the message in the conversation, i would conclude that SEAM does NOT destroy it!
Therefore, Tobias could put any Object in the Conversation context and reference it in the error page. Or just put your customized message in the exception itself!
Greetings
PS: pls correct me if i am wrong!