[opencms-dev] Manual invokation of OpenCms 404 handler

Roman-Uhlig roman.uhlig at maxity.de
Fri Aug 27 11:01:47 CEST 2010


Thanks Harald!

Variant 1 simply throws an error 500, as any other exception would. Doesn't
look like there's some special automatism behind it that leads to a 404.

Variant 2 works like a charm, after I modified it a bit like that:

org.opencms.flex.CmsFlexController controller = 
     org.opencms.flex.CmsFlexController.getController(request);
response = controller.getTopResponse();
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
response.sendError(HttpServletResponse.SC_NOT_FOUND,
     org.opencms.db.Messages.ERR_PERM_FILTERED_1);
return;

Thanks again for your suggestions.

Best regards,
Roman



Brabenetz, Harald-2 wrote:
> 
> Try this (I have not tested it :) ):
> 
> Variant 1:
>         Simply throw a CmsVfsResourceNotFoundException
> 
> Variant 2:
>         HttpServletResponse.setStatus(HttpServletResponse.SC_NOT_FOUND);
>         HttpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND,
> msg);
> 
> hth,
> Harald
> 
> 
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Roman Uhlig
> Sent: Donnerstag, 26. August 2010 13:25
> To: 'opencms-dev at opencms.org'
> Subject: [opencms-dev] Manual invokation of OpenCms 404 handler
> 
> I need to manually invoke the OpenCms http error status handler (i.e.
> 404), just like it's called when a resource doesn't exist (basically
> manually throwing a 404). I've been browsing through the mailing list and
> the API doc, but couldn't find anything pointing me in the right
> direction.
> 
> I'd appreciate any hints on this.
> 
> Thanks in advance,
> Roman
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 
> INFONOVA GmbH
> Sitz: Unterpremst?tten bei Graz
> Firmenbuchgericht: Landesgericht f?r ZRS Graz
> Firmenbuchnummer: FN 44354b
> 
> The information in this email is confidential and may be legally
> privileged. If you are not the intended recipient of this message, any
> review, disclosure, copying, distribution, retention, or any action taken
> or omitted to be taken in reliance on it is prohibited and may be
> unlawful. If you are not the intended recipient, please reply to or
> forward a copy of this message to the sender and delete the message, any
> attachments, and any copies thereof from your system.
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
> 
> 

-- 
View this message in context: http://old.nabble.com/Manual-invokation-of-OpenCms-404-handler-tp29541344p29550707.html
Sent from the OpenCMS - Dev mailing list archive at Nabble.com.




More information about the opencms-dev mailing list