Re: Change extension from .event
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Andras,
At 04:36 PM 4/19/2003 +0300, you wrote:
>A question for Jake:
>
>Why this is not possible in the 2.3 servlet spec:
>
> <servlet-mapping>
> <servlet-name>ApplicationGateway</servlet-name>
> <url-pattern>/admin/*.event</url-pattern>
> </servlet-mapping>
Well, that should be perfectly fine, except for the fact that if you
already have a mapping for "*.event", then the two are equivalent. If, on
the other hand, you had this, things would work...
<servlet-mapping>
<servlet-name>ApplicationGateway</servlet-name>
<url-pattern>/admin/*</url-pattern>
</servlet-mapping>
I think having the following would be better and work with the custom
extension idea that you have implemented.
<servlet-mapping>
<servlet-name>ApplicationGateway</servlet-name>
<url-pattern>*.event</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ApplicationGateway</servlet-name>
<url-pattern>*.admin</url-pattern>
</servlet-mapping>
Then in your events.xml, you'd have something like...
<event name="PublicEvent">
<event name="ViewProducts">
<event name="BuyProduct">
</event>
<event name="AdminEvent" extension=".admin">
<event name="AddUser">
<event name="DeleteUser">
</event>
The events extending PublicEvent would inherit the default ".event"
extension while the events extending AdminEvent would inherit the specified
".admin" extension.
Your URL's would look something like this...
http://localhost:8080/AddUser.admin
and the following URL would fail and be caught by the default request event
reporting that no event by that name exists...
http://localhost:8080/AddUser.event
Now that I think of it, I'm not sure if more than one extension is possible
in a single ApplicationGateway??? Hmm...... It seems like it doesn't
since ApplicationGateway has a method getEventExtension() that returns a
single string ( ".event" ) and then getNewEventBrokerInstance() uses that
method to set the extension for the DefaultEventBroker.
So, it seems this would have to be done with separate event
gateways. That's too bad. If a single event gateway supported multiple
extensions, that would be ideal and make things very flexible. In the
web.xml, one would specify all possible mappings for the ApplicationGateway
servlet and then specific events which would provide the preferred
extension that they will listen to so that other extensions for that event
are ignored as if the event didn't exist....although this still seems
somewhat unnecessary since, if your admin events extend one event that
requires authentication, your admin events are protected anyway by the
chosen event hierarchy, so this ends up all being sort of cosmetic rather
than adding any new functionality.
>I have added in the EventBuilder.template a new variable
>@event.setextension@ in each constructor after super() and
>this will be replaced with setEventExtension(".myext"); or with an empty
>String.
Why not just overload getEventExtension()?
>>
>> Ought of curiousity, what's causes you to need to change the extension in
>> the first place?
>The problem is the same as discussed some time ago.
>I want to separate the admin part from the public part.
>So one application gateway for admin with one extension and one
>for public part with different extension.
I still think this is merely cosmetic rather than providing any new
functionality, but if this is still something you want I'd like to see it
where the control of the extensions is controlled by the events.xml file
completely (other than providing all possible mappings to the
ApplicationGateway in web.xml) rather than having so many different actors
specifying the extension. Like I said above, it would be ideal if a single
ApplicationGateway could support more than one extension at once. I would
look into figuring out how to do that instead of adding multiple
application gateways.
I haven't looked into how possible these changes are. If you can look into
it more closely and report back, that would be great! After you have your
changes done (if any), zip up the files you modified and post them as an
attachment. That way, we can try things out and see if it is something
that should be made part of Barracuda.
Jake