Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Re: [joist-dev] UnsecureServlet method use unclear

Project highlights: Architectural Overview

joist
Discussion topic

Back to topic list

Re: [joist-dev] UnsecureServlet method use unclear

Author "Daniel L dot Rall" <dlr at collab dot net>
Full name "Daniel L dot Rall" <dlr at collab dot net>
Date 2000-10-09 20:47:10 PDT
Message David Pellegrini wrote:
>
> Jon Stevens wrote:
> >
> > on 10/9/2000 9:46 AM, "Daniel L. Rall" <dlr at finemaltcoding dot com> wrote:
> >
> > > Why is an Exception even thrown if you just want a redirect? To quote
> > > Brian Kernighan, "exceptions should be used only in exceptional
> > > circumstances." This doesn't qualify. Additionally, this method means
> > > nothing on its own, which makes its purpose indecipherable without
> > > looking at how it's called. Just today you mentioned that Exceptions
> > > are not cheap to create, so why bother when what you actually want is a
> > > redirect?
> > >
> > > Daniel Rall
> >
> > I agree. This is a bad design decision.
>
> Don't rush to judgement without understanding what this is doing.
>
> It's not doing a full browser redirect. In fact, this is to _avoid_ a full redirect. So instead of using a HttpServletResponse.​sendRedirect(aURL), using UnsecureServlet.redi​rectTo(servletName) allows for effectively "redirecting" to another servlet, all in the same request, and with the context intact. No need to construct a URL complete with query string arguments and pay the performance penalty of the round trip to the browser.

No one said it was doing a browser redirect. I understand what the
exception is doing, and I dislike the implementation.

> Raising an exception to accomplish this greatly reduced the code complexity, enough so to outweigh any performance impact IMO. You can still do the usual redirects using a convenience method UnsecureServlet.redi​rectToURL(theContext​, aURL).

Okay. Will you document your weirdness when you have a moment, please?
This is not something that should be left unnoted. Thanks.
--

Daniel Rall <dlr at collab dot net>
http://collab.net/ | open source | do the right thing

« Previous message in topic | 7 of 9 | Next message in topic »

Messages

Show all messages in topic

UnsecureServlet method use unclear dlr Daniel Rall 2000-10-09 15:14:30 PDT
     Re: [joist-dev] UnsecureServlet method use unclear David Pellegrini <davidp at collab dot net> David Pellegrini <davidp at collab dot net> 2000-10-09 09:28:22 PDT
         Re: [joist-dev] UnsecureServlet method use unclear dlr Daniel Rall 2000-10-09 09:46:36 PDT
             Re: [joist-dev] UnsecureServlet method use unclear Jon Stevens <jon at latchkey dot com> Jon Stevens <jon at latchkey dot com> 2000-10-09 16:58:19 PDT
                 Re: [joist-dev] UnsecureServlet method use unclear Ed Korthof <edk at laswell dot collab dot net> Ed Korthof <edk at laswell dot collab dot net> 2000-10-09 17:26:28 PDT
                 Re: [joist-dev] UnsecureServlet method use unclear David Pellegrini <davidp at collab dot net> David Pellegrini <davidp at collab dot net> 2000-10-09 20:41:44 PDT
                     Re: [joist-dev] UnsecureServlet method use unclear "Daniel L dot Rall" <dlr at collab dot net> "Daniel L dot Rall" <dlr at collab dot net> 2000-10-09 20:47:10 PDT
                     Re: [joist-dev] UnsecureServlet method use unclear Jon Stevens <jon at latchkey dot com> Jon Stevens <jon at latchkey dot com> 2000-10-10 09:47:54 PDT
                         Re: [joist-dev] UnsecureServlet method use unclear dlr Daniel Rall 2000-10-10 09:53:41 PDT
Messages per page: