Hello everybody,

I'm working on a web site using Tapestry 5.2.6.
I need to simulate a POST form data to authenticated a client to another site.
I'm trying to do it using the return URL from onActivate.

Object onActivate(@RequestParameter(value="id", allowBlank=true ) String id) throws IOException {
        _idCrypt = id;
        return getUrl();

    }

    private URL getUrl() throws IOException {
        String data = "username=toto&password=titi";
        URL url = new URL("https://myurl/login";);
        HttpURLConnection connection = null;
          //Create connection
          connection = (HttpURLConnection)url.openConnection();
          connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Length", "" +Integer.toString(data.getBytes().length));
          connection.setUseCaches (false);
          connection.setDoInput(true);
          connection.setDoOutput(true);
          //Send request
DataOutputStream wr = new DataOutputStream (connection.getOutputStream ());
          wr.writeBytes (data);
          wr.flush ();
          wr.close ();
          connection.getInputStream();
          return connection.getURL();
    }

But it doesn't work, Tapestry redirect on my url (https://myurl/login), but no authenticated...

Is it possible to simulate a POST redirection using an URL object and onActivate from Tapestry ?

Thanks, Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to