why apache Httpclient inside Plugin Fails?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

why apache Httpclient inside Plugin Fails?

Giuseppe De Marco
Hi all,

i'm writing a IJ Plugin to store images on a WebServer through a POST Http
method.

I choose Apache's Httpclient Java libraries and, with Documentation examples, I
made a Class to Do the Auth procedure and Then the File upload I Desire.

My problem is that i can't get it working inside the Plugin.

In the Standalone fine-working class the declaration is:

<CODE>
public class FormLogin
{
    static final String LOGON_SITE = "localhost";
       [...other statics vars..]

    public FormLogin() {
        super();
    }

    public static void main(String[] args) throws Exception {
// and then the procedure that works

</CODE>

Inside the Plugin I can't get it work as a Class (i'm not a good Java's OOP) so
I tried to execute the working procedure inside a public void created in the
tradizional imageJ's "public class Plugin_Name implements PlugIn { ...".

...But nothing to do. With raws IJ.showMessage()s I understand that everything
works fine but one not:

client.executeMethod(authget);

Through the terminal i Saw 12 Http connection from JVM and the imageJ seems
dazed by a stupid reiterated loop, the GUI works but the Plugin I made remains
mute.

The code I used to get the Web Methods work is:
http://www.java-tips.org/other-api-tips/httpclient/how-to-perform-form-based-logon.html


Probably someone can suggest me a secure implementation or some design ideas
about it
giuseppe