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)

Reply via email to