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 dlr
Full name Daniel Rall
Date 2000-10-09 09:46:36 PDT
Message David Pellegrini wrote:
>
> dlr at finemaltcoding dot com wrote:
> >
> > I don't understand the point of this method:
> >
> > /**
> > * Redirect to another page
> > *
> > * @param targetPage the page to which to redirect
> > * @exception RedirectException
> > */
> > protected void
> > redirectTo (String targetPage)
> > throws RedirectException
> > {
> > if (debug) log.debug("redirectTo: " + targetPage);
> > throw new RedirectServletExcep​tion(targetPage);
> > }
> >
> > It does nothing but throw a RedirectServletException.
>
> ... specifying the name of the servlet to redirect to. The catch clause
> for this exception pulls the name of the servlet from the exception,
> then gets an instance of the servlet by that name, then invokes handle()
> on that servlet instance. This is the basis of the "internal redirect".

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

« Previous message in topic | 3 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: