Hi I need some help! I have controller that I need to pass a full url (with its own parametrs) as a parameter, e.g. I want to call my controller with: /mycontroller/catchurl?url=http://somedomain.com/afile.jsp?param1=xx¶m2=yy and in action "catchurl" in mycontroller.rb I would like to have params[:url] to be "http://somedomain.com/afile.jsp?param1=xx¶m2=yy" I guess that one could do something smart with map.connect but so far I have failed completely. Is there anyone that can give me some help? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
straightflush-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-15 22:30 UTC
Re: How to catch a parameter that contains a full url
whats the problem? params[:url] should work, do you not want to use it that way ? On 9/15/06, jonbjo <jonbjo-ee4meeAH724@public.gmane.org> wrote:> > > Hi > I need some help! > > I have controller that I need to pass a full url (with its own > parametrs) as a parameter, e.g. I want to call my controller with: > > /mycontroller/catchurl?url> http://somedomain.com/afile.jsp?param1=xx¶m2=yy > > and in action "catchurl" in mycontroller.rb I would like to have > params[:url] to be > "http://somedomain.com/afile.jsp?param1=xx¶m2=yy" > > I guess that one could do something smart with map.connect > but so far I have failed completely. > > Is there anyone that can give me some help? > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
The problem is that the url parameter gets split up into several parameters, i.e. params[:url] is http://somedomain.com/afile.jsp?param1=xx and params[:param2] is yy What I want is to treat the whole url as one entity, I do not want it to be slit up into separate parameters. straightflush-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> whats the problem? params[:url] should work, do you not want to use it that > way ? > > > > On 9/15/06, jonbjo <jonbjo-ee4meeAH724@public.gmane.org> wrote: > > > > > > Hi > > I need some help! > > > > I have controller that I need to pass a full url (with its own > > parametrs) as a parameter, e.g. I want to call my controller with: > > > > /mycontroller/catchurl?url> > http://somedomain.com/afile.jsp?param1=xx¶m2=yy > > > > and in action "catchurl" in mycontroller.rb I would like to have > > params[:url] to be > > "http://somedomain.com/afile.jsp?param1=xx¶m2=yy" > > > > I guess that one could do something smart with map.connect > > but so far I have failed completely. > > > > Is there anyone that can give me some help? > > > > > > > > > > > ------=_Part_250645_19886177.1158359402652 > Content-Type: text/html; charset=ISO-8859-1 > X-Google-AttachSize: 1132 > > whats the problem? params[:url] should work, do you not want to use it that way ?<br><br><br><br><div><span class="gmail_quote">On 9/15/06, <b class="gmail_sendername">jonbjo</b> <<a href="mailto:jonbjo-ee4meeAH724@public.gmane.org">jonbjo-ee4meeAH724@public.gmane.org > </a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Hi<br>I need some help!<br><br>I have controller that I need to pass a full url (with its own > <br>parametrs) as a parameter, e.g. I want to call my controller with:<br><br>/mycontroller/catchurl?url=<a href="http://somedomain.com/afile.jsp?param1=xx&param2=yy">http://somedomain.com/afile.jsp?param1=xx&param2=yy > </a><br><br>and in action "catchurl" in mycontroller.rb I would like to have<br>params[:url] to be<br>"<a href="http://somedomain.com/afile.jsp?param1=xx&param2=yy">http://somedomain.com/afile.jsp?param1=xx&param2=yy > </a>"<br><br>I guess that one could do something smart with map.connect<br>but so far I have failed completely.<br><br>Is there anyone that can give me some help?<br><br><br> > ------=_Part_250645_19886177.1158359402652----~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/15/06, jonbjo <jonbjo-ee4meeAH724@public.gmane.org> wrote:> > > Hi > I need some help! > > I have controller that I need to pass a full url (with its own > parametrs) as a parameter, e.g. I want to call my controller with: > > /mycontroller/catchurl?url> http://somedomain.com/afile.jsp?param1=xx¶m2=yy > > and in action "catchurl" in mycontroller.rb I would like to have > params[:url] to be > "http://somedomain.com/afile.jsp?param1=xx¶m2=yy" > > I guess that one could do something smart with map.connect > but so far I have failed completely. > > Is there anyone that can give me some help?The problem is that the url given above is not valid - ? and & need to be escaped in the parameter value. Browsers do this automatically behind the scenes, and then Rails transforms the parameters back. It seems unclear why you''re having this problem - url_for automatically handles the encoding, and so do forms. Hope this helps, -- Matt Jones mdj.acme-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org President/Technical Director, Acme Art Company (acmeartco.org) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---