RE: extension of ApplicationGateway

"Christian Cryder" <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi Thorsten!

Ok, I have just checked in a build which provides a solution. From the
comments...

<p><b>csc_100603_1</b> - Modified ApplicationGateway so that there is a new
RESPOND_WITH_404
constant which defaults to false but can be overriden to true. If true,
rather than create
a generic HttpRequestEvent when a bad event is specified, simply return a
404 error.

What this means is that all you need to do is override this constant - the
easiest way to do that is via the object repository.xml file, like this:

    <object class="org.enhydra.barracuda.core.event.ApplicationGateway">
      <prop name="RESPOND_WITH_404">true</prop>
    </object>

That work for you? Please note that I haven't actually tested this, but I'm
pretty certain it works...if you could kindly update from cvs and give it a
spin to verify, I'd be most appreciative.

Christian
----------------------------------------------
Christian Cryder
Internet Architect, ATMReports.com
Project Chair, BarracudaMVC - http://barracudamvc.org
----------------------------------------------
"Coffee? I could quit anytime, just not today"


> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Thorsten Möller
> Sent: Monday, October 06, 2003 4:35 PM
> To: [email protected]
> Subject: [Barracuda] extension of ApplicationGateway
>
>
> I posted this a few days ago but I believe it got lost in somewhere. My
> apologies if this is a repost for some (or all) of you.
> ------------------------
>
> Is it possible to extend the Application Gateway to send an 404 error in
> situations when the gateway can't map the request to an event. At
> the moment
> an HttpRequestEvent is dispatched by default. Maybe it is useful
> to specify
> this in event-gateway.xml or web.xml by additional parameter(s).
>
> code snip from ApplicationGateway, to demonstrate what I mean:
>
> ...
> } catch (Exception e) {
>     //if we can't map the request to an event, we will just
>     //send a 404 error or dispatch a generic HttpRequestEvent
>     //according to configuration
>     boolean send404 = getItFromSomewhere();
>     if (send404)
>     {
>         resp.sendError(HttpServletResponse.SC_NOT_FOUND);
>     }
>     else
>     {
>         logger.error("Class "+eventName+" not found...Creating a generic
> HttpRequestEvent");
>         event = new HttpRequestEvent();
>     }
> }
> ...
>
>
>
> Thorsten
>
> _______________________________________________
> Barracuda mailing list
> [email protected]
> http://barracudamvc.org/lists/listinfo/barracuda
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.