No, Sorry, I misunderstood your needs...
Walter Mourão http://waltermourao.com.br http://arcadian.com.br http://oriens.com.br On Tue, Apr 21, 2009 at 12:43 PM, Georg Füchsle <giofy...@googlemail.com>wrote: > Hallo Walter, > > thanks for Your reply. > > I have tried to understand what ist httpclient, but I am not shure if > I am right. > > What I guess is that httpclient can manage the client-communication to > a web server. > That means I can make programs that interact with a webserver. (like > calling an url with some data and process the response.) > > What I want to do is: inside my WebApp - when the User pressed a > button - I want to redirect the User to another WebApp on another > server provided with some post-data. The answer to this request to the > second WebApp should never arrive at my WebApp but should be > interpreted by the User's browser. > > Do You think, httpclient can help me doing this? > > Thanks, > > > Georg > > 2009/4/21 Walter Mourão <walter.mou...@gmail.com>: > > Some time ago I wrote a small http proxy where an web service call > generates > > a http post. I used commons-httpclient: > http://hc.apache.org/httpclient-3.x/ > > and it was quite useful. > > > > Cheers, > > > > Walter Mourão > > http://waltermourao.com.br > > http://arcadian.com.br > > http://oriens.com.br > > > > > > > > On Tue, Apr 21, 2009 at 7:58 AM, Georg Füchsle <giofy...@googlemail.com> > > wrote: > >> > >> Hallo Simon, > >> > >> > >> Yes You have understood right: I want the user's browser to call > >> another server and dont want to continue processing my application > >> afterwards. > >> > >> I also have thought about the JavaScript solution. > >> But using a js solution generally I will write the xml-data into the > >> user's html. I did'nt like to do that, because this (xml-)data grants > >> You access to the other application. For this reason I wanted to hide > >> the xml-data. But using get-Parameters the xml-data is visible the > >> same. > >> > >> > >> Maybe should think about a ajax- functionality like this: > >> > >> I use a commandbutton that supports ajax-request and a hidden form > >> that makes a post-request. > >> When the user clickes the commandbutton i can fill the data of the > >> form via ajax and then in an after-ajax-event click the submit-button > >> of the form via JavaScript. Do You think this will work? > >> > >> I hoped, there would be an more easy way.... > >> > >> Thank You for Your help. > >> > >> Regards > >> > >> > >> Georg > >> > >> 2009/4/21 Simon Kitching <skitch...@apache.org>: > >> > Georg Füchsle schrieb: > >> >> hallo, > >> >> > >> >> > >> >> I have to call another application out from JSF. > >> >> To call this application i have to send (xml) data via post to the > >> >> start-url of this application. > >> >> > >> >> I found some example on the web: > >> >> > >> >> <code> > >> >> ExternalContext extContext = > >> >> FacesContext.getCurrentInstance().ctx.getExternalContext(); > >> >> String name = URLEncoder.encode("INTERFACENAME", "utf-8"); > >> >> String someData = "<?xml version='1.0' encoding='UTF-8'?> <data> > >> >> <caller value='giofyxle'/><app value='2'/></data></xml>"; > >> >> String value = URLEncoder.encode(someData , "UTF-8"); > >> >> String viewId = "http://www.server.com/startapp/index.html"+ '?' + > >> >> name + "=" + value; > >> >> String urlLink = extContext.encodeActionURL(viewId); > >> >> extContext.redirect(urlLink); > >> >> </code> > >> >> > >> >> > >> >> I tried this code. its calls the new application, but the data is > sent > >> >> via GET: > >> >> > >> >> > >> >> > http://www.server.com/startapp/index.html?INTERFACENAME==%3C%3Fxml+version%3D%271.0%27+encoding... > .. > >> >> > >> >> So the intefacedata is easily be read by the user. Has anyone any > idea > >> >> how i can make a rediract with POST data? > >> > > >> > When you say "call another application out", do you mean that you want > >> > the *user's browser* to send a POST command to some other server, and > >> > then display the result returned from that server (without any further > >> > processing)? > >> > > >> > HTTP provides no way to do this; the http-redirect facilities only do > >> > GET commands. See the HTTP specification for more details. What your > >> > code above does (extContext.redirect) just generates an http redirect > >> > response, and the user's browser then processes this response and does > >> > the redirect. > >> > > >> > HTML provides no way to do this either AFAIK. > >> > > >> > JSF just uses HTTP and HTML, so JSF also has no way to do this. I > think > >> > you will need to use javascript, ie generate an HTML page that > contains > >> > an html <form> with the fields you want, and some javascript that then > >> > does document.getElementById(formId).submit() or something similar. > >> > > >> > > >> > Or does "call another application out"mean that after a JSF submit, > you > >> > want *your server* to send a POST command to some other server, then > >> > process the result before sending back a new page to the user? You can > >> > use the apache commons-httpclient library to do things like this. > >> > > >> > Regards, > >> > Simon > >> > > >> > -- > >> > -- Emails in "mixed" posting style will be ignored > >> > -- (http://en.wikipedia.org/wiki/Posting_style) > >> > > > > > >