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 Jon Stevens <jon at latchkey dot com>
Full name Jon Stevens <jon at latchkey dot com>
Date 2000-10-10 09:47:54 PDT
Message on 10/9/2000 8:41 PM, "David Pellegrini" <davidp at collab dot net> wrote:

> 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.
>
> 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).
>
> -davidp

Of course I understand what is going on here. Turbine has the same exact
feature, but it don't use an exception to perform this process. There are
two methods:

doRedirect(data, "templateName")
and
setTemplate(data, "templateName")

In the first case, it will execute both the template and the associated Java
class with the template (associated by name) in order to build the context.

In the second case, it will execute the template only with the current
context. Neither method uses an exception to make things happen.

Please don't take this as a "Turbine is better" or "Switch to Turbine" or
whatever. I'm simply explaining that there are other ways to get the same
functionality without throwing an exception.

If the feature is added to Joist to remove the getServlet() method (which
needs to be done anyway), then it will be easy to re-use that same code to
re-implement the doRedirect() method with that code instead.

-jon

--
http://scarab.tigris.org/ | http://noodle.tigris.org/
http://java.apache.org/ | http://java.apache.org/turbine/
http://www.working-dogs.com/ | http://jakarta.apach​e.org/velocity/
http://www.collab.net/ | http://www.sourcexchange.com/

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