Robert,

thank you for the help. I will try that script as soon
as I figure out how to configure Apache to allow PUT
method and I will let you know.

It is an offtopic, but I tried to make Apache httpd
accept my PUT request for a couple of days with no
success. I followed mainly [1]. So I would be very
grateful if you point me to some detailed explanations
about this configuration.

Regards
Ivan

[1]http://www.apacheweek.com/features/put

--- "Robert r. Sanders" <[EMAIL PROTECTED]>
wrote:

> I gave up on the built-in HTTP Tasks and used the
> BSF support to create 
> a 'simple' upload script that using the Apache
> HttpClient classes:
> 
> In my build.xml
>     <target name="upload">
>         <description>
>             Uses the HTTP PUT method to upload
> several files to a WebDAV 
> server(s)
>         </description>
>         <!-- NOTE: this task depends on having the
> js.jar file
>             from the Mozilla Rhino project in you
> ant/lib directory
>             (and also the commons-http libs). -->
>         <property name="xml.dir"
> value="some/directory"/>
>         <script language="javascript"
> src="upload.js"/>
>     </target>
> 
> 
> In the script.js file:
>     importClass(java.io.File);
>     importClass(java.io.FileInputStream);
>    
>
importClass(Packages.org.apache.commons.httpclient.HttpClient);
>     
>
importClass(Packages.org.apache.commons.httpclient.UsernamePasswordCredentials);
>    
>
importClass(Packages.org.apache.commons.httpclient.methods.PutMethod);
>    
>     var srcDir = new
> File(project.getProperty("xml.dir"));
>     var style = project.getProperty("build.style");
>     var files = srcDir.listFiles();
>     var echo = xview_skins.createTask("echo");
>    
>     var user = project.getProperty("svn.user");
>     var password =
> project.getProperty("svn.password");
>     var client = new HttpClient();
>     client.getState().setCredentials(null, null, new
> 
> UsernamePasswordCredentials(user, password));
>    
>     for (var i = 0; i < files.length; i++) {
>         if (files[i].isFile()) {
>             var put = new PutMethod('http://' +
> style + 
> '.svn.ipov.net/svn/stage/' + files[i].getName());
>             put.setRequestBody( new
> FileInputStream(files[i]) );
>             client.executeMethod(put);
>            
>             put = new PutMethod('http://' + style + 
> '.svn.ipov.net/svn/_live/' + files[i].getName());
>             put.setRequestBody( new
> FileInputStream(files[i]) );
>             client.executeMethod(put);
>         }
>     }
> 
> 
> >  
> >
> >>-----Ursprüngliche Nachricht-----
> >>Von: Ivan Ivanov
> [mailto:[EMAIL PROTECTED] 
> >>Gesendet: Freitag, 1. Juli 2005 23:02
> >>An: user@ant.apache.org
> >>Betreff: HTTP tasks
> >>
> >>Dear Colleagues,
> >>
> >>I am looking for an Ant task that implements HTTP
> PUT method 
> >>so that I can upload files to a web server. Is
> there such a 
> >>task or should I write it myself?
> >>
> >>Also, while I was googling for it, I noticed that
> there is a 
> >>proposal in Ant for http tasks, located at [1],
> that claim 
> >>they will support basic http requests.
> >>I would like to know what is their status. Are
> they planned to 
> >>be part of Ant distribution at some time and if so
> when to expect them?
> >>
> >>Regards
> >>Ivan
> >>
>
>>[1]http://cvs.apache.org/viewcvs.cgi/ant/proposal/sandbox/httptasks/
> >>
> >>    
> >>
> 
> -- 
>     Robert r. Sanders
>     Chief Technologist
>     iPOV
>     (334) 821-5412
>     www.ipov.net
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to