RedirectView#go

Ted Husted <[email protected]> Mon, 27 Oct 2003 05:36:36 -0500
Newsgroups gmane.comp.web.maverick.general
Organization Apache Software Foundation - Jakarta Project
Message-ID <[email protected]>
On RedirectView, if the model is neither a Map nor a String, should 
model.toString() be used instead? ?

I could make the change, if we that's what we want.

And should we do nothing if the model is null (WARN in the log?), or 
just NPE?

As it stands, in the case of a null model or model!<-Map & !<-String, it 
appears that the original target would be added to itself!

----

public void go(ViewContext vctx)  throws IOException, ServletException
   {
     String result = this.target;

     if (vctx.getModel() instanceof Map)
     {
       result = this.addQueryParams(result, (Map)vctx.getModel());
     }
     else if (vctx.getModel() instanceof String)
       {
          result = (String)vctx.getModel();
       }
		
     // Now, a separate step
     result = this.addQueryParams(result, vctx.getViewParams());

     // Just in case we need a session id
     result = vctx.getRealResponse().encodeRedirectURL(result);
		
     vctx.getRealResponse().sendRedirect(result);
   }

----	

-Ted.




-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
[INVALID FOOTER]