RESTful httpclient для Ant - PullRequest
       22

RESTful httpclient для Ant

3 голосов
/ 01 марта 2010

Мне нужен RESTful httpclient для Ant.

Кажется, что ни одна из задач, связанных с Contribute, больше не работает ..

Разве еще никто не связывал Commons-HTTPClient и Ant?

Ответы [ 4 ]

3 голосов
/ 01 марта 2010

Попробуйте использовать задачу Ant exec и curl .

1 голос
/ 21 января 2012

Я использовал CURL из файлов ANT в POST со следующим макросом:

<pathconvert property="curl.path" targetos="windows">
    <path location="${lib.dir}/curl/curl.exe"/>
</pathconvert>
<macrodef name="post-file" description="Use Curl to post the file to the WEBDAV path">
    <attribute name="file"/>
    <attribute name="url" />    
    <attribute name="username" default="${username}" />
    <attribute name="password" default="${password}" />
    <sequential>
        <echo message="Using CURL to upload @{file} to @{url}" />
        <!--Execute curl to post the file to the URL -->
        <exec executable="${curl.path}">
            <arg value='-L'/>
            <arg value='-k'/>
            <arg value='-f'/>
            <arg value='-s'/>
            <arg value="--anyauth"/>
            <arg value="-u"/>
            <arg value="@{username}:@{password}"/>              
            <arg value="-T" />
            <arg value='"@{file}"' /> 
            <arg value='@{url}'/>  
        </exec>
    </sequential>
</macrodef>

Выполнить макрос как это:

<target name="test-upload">
        <post-file file="${file}" 
                   url="${url}" 
                   username="${username}" 
                   password="${password}" />
    </target>
0 голосов
/ 14 апреля 2010

В Antelope есть задача http post, но, похоже, она не поддерживает базовую аутентификацию. : /

0 голосов
/ 01 марта 2010

Я нашел этот проект http://fikin -ant-tasks.sourceforge.net / .

Последнее обновление файла - 2007-03-12, поэтому я немного беспокоюсь о качестве ...

есть здесь какие-нибудь пользователи?

...