[prev in list] [next in list] [prev in thread] [next in thread] 

List:       barracuda
Subject:    Re: [Barracuda] Change extension from .event
From:       Jacob Kjome <hoju () visi ! com>
Date:       2003-04-19 19:32:08
[Download RAW message or body]

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



[Attachment #3 (text/html)]

<html>
<body>
<font size=3><br>
Hi Andras,<br><br>
At 04:36 PM 4/19/2003 +0300, you wrote:<br>
<blockquote type=cite class=cite cite>A question for Jake:<br><br>
Why this is not possible in the 2.3 servlet spec:<br><br>
&nbsp;&lt;servlet-mapping&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;servlet-name&gt;ApplicationGateway&lt;/servlet-name&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;url-pattern&gt;/admin/*.event&lt;/url-pattern&gt;<br>
&nbsp;&lt;/servlet-mapping&gt; </blockquote><br>
Well, that should be perfectly fine, except for the fact that if you
already have a mapping for &quot;*.event&quot;, then the two are
equivalent.&nbsp; If, on the other hand, you had this, things would
work...<br><br>
&lt;servlet-mapping&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;servlet-name&gt;ApplicationGateway&lt;/servlet-name&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;url-pattern&gt;/admin/*&lt;/url-pattern&gt;<br>
&nbsp;&lt;/servlet-mapping&gt;<br><br>
I think having the following would be better and work with the custom
extension idea that you have implemented.<br><br>
&nbsp;&lt;servlet-mapping&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;servlet-name&gt;ApplicationGateway&lt;/servlet-name&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;url-pattern&gt;*.event&lt;/url-pattern&gt;<br>
&nbsp;&lt;/servlet-mapping&gt;<br>
&nbsp;&lt;servlet-mapping&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;servlet-name&gt;ApplicationGateway&lt;/servlet-name&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;url-pattern&gt;*.admin&lt;/url-pattern&gt;<br>
&nbsp;&lt;/servlet-mapping&gt;<br><br>
<br>
Then in your events.xml, you'd have something like...<br><br>
&nbsp;&nbsp;&nbsp; &lt;event name=&quot;PublicEvent&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;event
name=&quot;ViewProducts&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;event
name=&quot;BuyProduct&quot;&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/event&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;event name=&quot;AdminEvent&quot;
extension=&quot;.admin&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;event
name=&quot;AddUser&quot;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;event
name=&quot;DeleteUser&quot;&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/event&gt;<br><br>
The events extending PublicEvent would inherit the default
&quot;.event&quot; extension while the events extending AdminEvent would
inherit the specified &quot;.admin&quot; extension.<br><br>
Your URL's would look something like this...<br><br>
<a href="http://localhost:8080/AddUser.admin" \
eudora="autourl">http://localhost:8080/AddUser.admin<br><br> </a>and the following \
URL would fail and be caught by the default request event reporting that no event by \
that name exists...<br><br> <a href="http://localhost:8080/AddUser.event" \
eudora="autourl">http://localhost:8080/AddUser.event</a><br><br> <br>
Now that I think of it, I'm not sure if more than one extension is
possible in a single ApplicationGateway???&nbsp; Hmm......&nbsp; It seems
like it doesn't since ApplicationGateway has a method getEventExtension()
that returns a single string ( &quot;.event&quot; ) and then
getNewEventBrokerInstance() uses that method to set the extension for the
DefaultEventBroker.<br><br>
So, it seems this would have to be done with separate event
gateways.&nbsp; That's too bad.&nbsp; If a single event gateway supported
multiple extensions, that would be ideal and make things very
flexible.&nbsp; 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.<br><br>
&gt;I have added in the EventBuilder.template a new variable<br>
&gt;@event.setextension@ in each constructor after super() and<br>
&gt;this will be replaced with setEventExtension(&quot;.myext&quot;); or
with an empty<br>
&gt;String.<br><br>
Why not just overload getEventExtension()?<br><br>
<br>
&gt;&gt;<br>
&gt;&gt; Ought of curiousity, what's causes you to need to change the
extension in<br>
&gt;&gt; the first place?<br><br>
&gt;The problem is the same as discussed some time ago.<br>
&gt;I want to separate the admin part from the public part.<br>
&gt;So one application gateway for admin with one extension and one<br>
&gt;for public part with different extension.<br><br>
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.&nbsp; Like I said above, it would be
ideal if a single ApplicationGateway could support more than one
extension at once.&nbsp; I would look into figuring out how to do that
instead of adding multiple application gateways.<br><br>
I haven't looked into how possible these changes are.&nbsp; If you can
look into it more closely and report back, that would be great!&nbsp;
After you have your changes done (if any), zip up the files you modified
and post them as an attachment.&nbsp; That way, we can try things out and
see if it is something that should be made part of Barracuda.<br><br>
<br>
Jake<br><br>
<br>
</font></body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic