Re: Barracuda: case-insensitive event names?
Jeremy L Rosenberger <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
I had a feeling it might have something to do with this. My opinion is that the event names should be "opaque"--the user may see them, but they shouldn't necessarily be meaningful (i.e. part of a URL that the user would actually type into the browser's address field). To me, just the fact that they end in ".event" (by default) suggests that they'd probably be unfamiliar to users. Typically, to get to your fictitious Web application, wouldn't it make the most sense to allow the user to enter the URL http://www.myhost.com/myapp ? I would expect a URL of this form to be the entry point for the application (it's also less typing for the user). This is actually pretty easy to do in Barracuda, especially if the application has only one entry point. I just have a DefaultEventGateway that redirects to the URL of the event that displays the "main" application page. (The mechanism I use is a bit oversimplified--it actually redirects any request that wasn't handled by another event listener to the "main" event--but it illustrates that the mechanism can work.) I'd imagine this mechanism could be extended to redirect various URLs to various events, and I think that would be a more useful capability than case-insensitive event names would be. This can certainly be implemented with a DefaultEventGateway, but I wonder if there would be another, more elegant way of doing this. Having said all that, it doesn't seem that implementing a case-insensitive event name mechanism would introduce any real problems. I'm not sure how the event name-to-class mapping is implemented internally, but if it uses something like a HashMap, I would think this would be easy enough to implement: Simply perform something like toLowerCase() on a key before insertion or comparison. If the mapping uses something like Class.forName(), then adding a HashMap to map the toLowerCase() version of the event name to its "true" capitalization should work well. Cheers, Jeremy On Thu, 2002-12-12 at 22:09, Jacob Kjome wrote: > Hi Jeremy, > > Why you little.... I mean.... heh :-) > > It is just because if someone were to type the URL to some page, they > really shouldn't have to care about the case-sensitivity of the event > name. If they know the name, they should be able to fire the event. > > For instance.... > > http://www.myhost.com/myapp/MyBigLongEventName.event > > Now, besides the fact that I created a very cumbersome event name, a > user would have difficulty with this since they would have to remember > to use Java coding standards for classes when typing the name of the > event. Besides, that, they could miss the SHIFT key and get most of > the case right, but one letter in lower case when it should have been > in upper and now they get an "event not found" message. Why not be > able to do something like... > > http://www.myhost.com/myapp/mybiglongeventname.event > > or > > http://www.myhost.com/myapp/MyBigLongEventname.event > > or > > http://www.myhost.com/myapp/MyBiglongeventName.event > > etc.... > > We all know what event they are trying to fire, don't we? Why should > we care that they typed it just so? Does that make things more > clear? Now that it is clear, do you feel it is a valid point? If it > is a valid point, are there any gotcha's we might run into by allowing > for this? > > Jake -- Jeremy L. Rosenberger * [email protected] http://www.frii.com/~jeremy/ _______________________________________________ Barracuda mailing list [email protected] http://www.enhydra.org/mailman/listinfo.cgi/barracuda FAQ - http://www.jguru.com/faq/Barracuda