Re: Servlet
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
You can do one of a couple things...even both at the same time...
in web.xml...
<servlet>
<servlet-name>ApplicationGateway</servlet-name>
<servlet-class>org.enhydra.barracuda.contrib.dbroggisch.examples.controller.DBRApplicationGateway</servlet-class>
<init-param>
<param-name>ApplicationAssembler</param-name>
<param-value>org.enhydra.barracuda.core.event.DefaultApplicationAssembler</param-value>
</init-param>
<init-param>
<param-name>AssemblyDescriptor</param-name>
<param-value>/WEB-INF/event-gateway.xml</param-value>
</init-param>
<init-param>
<param-name>SAXParser</param-name>
<param-value>org.apache.xerces.parsers.SAXParser</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
in DBRApplicationGateway....
public void initializeLocal() {
specifyEventGateways(new RenderPageEventGateway());
}
in event-gateway.xml...
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<assemble>
<!-- You can turn on URL rewriting by uncommenting this out
<constant class="org.enhydra.barracuda.plankton.http.URLRewriter"
name="REWRITE_URLS">true</constant>
-->
<event-gateway
class="org.enhydra.barracuda.core.event.DefaultEventGateway">
<event-gateway
class="org.enhydra.barracuda.contrib.dbroggisch.examples.controller.ExampleGateway"
/>
</event-gateway>
</assemble>
So, we've added both RenderPageEventGateway and ExampleGateway as
sub-gateways of the custom DBRApplicationGateway.
You can also add subgateways to your event gateways like this...
In BarracudaConfig (which is an event gateway)....
public BarracudaConfig() {
...
...
...
//add in sub-gateways
this.add(new CompConfig());
this.add(new DataConfig());
this.add(new DomConfig());
this.add(new EventConfig());
this.add(new FormsConfig());
this.add(new UtilConfig());
this.add(new ViewConfig());
this.add(new MasterConfig());
}
or this (in an event-gateway.xml)....
<event-gateway class="org.enhydra.barracuda.core.event.DefaultEventGateway">
<event-gateway class="com.mypackage.MySubEventGateway1" />
<event-gateway class="com.mypackage.MySubEventGateway2" />
<event-gateway class="com.mypackage.MySubEventGateway3" />
</event-gateway>
So, you can do everything in application gateway and/or event gateway
classes or do everything in the event-gateway.xml file read in by the
application assembler. The advantage of doing the former is compile-time
assurance that your application is set up right. The advantage of the
former is ease of configuration and the ability to mix and match event
gateways and/or event handlers without recompiling anything.
Does that help?
You might also want to read the 30,000 foot overview and the other docs on
the event model:
http://barracudamvc.org/Barracuda/index_details.html
Jake
At 10:11 AM 4/4/2003 -0500, you wrote:
>Yes, now I see ApplicationGateway has a method
>
>public final void add(EventGateway eg)
>
>Where are the codes that actually 'add' all
>'DefaultEventGateway's?
>
>Maybe I should ask differently.
>
>Each specific DefaultEventGateway contains main
>information of MVC for each page. I just want to
>understand the code flow how the servlet treats these
>DefaultEventGateway's step by step.
>
>
>Thanks,
>
>Xue-Feng
>
>
> --- Jacob Kjome <[email protected]> wrote: >
> > Are you wondering about the ApplicationGateway?
> > That extends
> > HttpServlet. You add event gateways to the
> > application gateway.
> >
> > Jake
> >
> > At 07:34 PM 4/3/2003 -0500, you wrote:
> > >Hi Jack,
> > >
> > >I guess that DefaultEventGateway should be comsumed
> > by
> > >some servlet. Could you please tell me which
> > servlet
> > >consumes the class which entends
> > DefaultEventGateway?
> > >Or correct me.
> > >
> > >Xue-Feng
> > >
> > >
> > >
> >
> >______________________________________________________________________
> > >Post your free ad now! http://personals.yahoo.ca
> > >_______________________________________________
> > >Barracuda mailing list
> > >[email protected]
> > >http://barracudamvc.org/lists/listinfo/barracuda
> >
>
>______________________________________________________________________
>Post your free ad now! http://personals.yahoo.ca
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://barracudamvc.org/lists/listinfo/barracuda