net.sf.fikin.ant.httpclientanttask
Class AntMultipartPostMethod

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by net.sf.fikin.ant.httpclientanttask.BaseAntMethod
              extended by net.sf.fikin.ant.httpclientanttask.BaseResponseAntMethod
                  extended by net.sf.fikin.ant.httpclientanttask.AntMultipartPostMethod

public class AntMultipartPostMethod
extends BaseResponseAntMethod

Perform HTTP POST method (multu-part message)

This is the only way to submit file(s) and plain text together in one http post call. File uploading is only possible via this method.

Examples:

 
      <httpmpost url="..." >
          <credentials ... />
          <postString>Here is my string to send</postString>
          <postFile name="..." type="text" />
      </httpmpost>
 
 
created on Dec 7, 2006

Since:
Version:
$Revision: 1.3 $
Author:
fiykov
Ant Task Name:
httpmpost

Nested Class Summary
 class AntMultipartPostMethod.MyParam
          Base class for all multi-part Ant tags
 class AntMultipartPostMethod.MyParamFile
          Place a file in the multi-part post request
 class AntMultipartPostMethod.MyParamString
          Place a plain text as part in the multi-part post request
 
Nested classes/interfaces inherited from class net.sf.fikin.ant.httpclientanttask.BaseResponseAntMethod
BaseResponseAntMethod.ProjectLogOutputStream, BaseResponseAntMethod.ProjectLogWriter
 
Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
AntMultipartPostMethod()
           
 
Method Summary
protected  void before_execute_method()
          do something before @link #execute_method() is called
 AntMultipartPostMethod.MyParamFile createPostFile()
          add the file as part of the message
 AntMultipartPostMethod.MyParamString createPostString()
          add the text as part of the message
 java.util.HashSet getPost()
          get http-query parameterss send in the post request
protected  org.apache.commons.httpclient.HttpMethod newHttpMethod(java.lang.String url)
          factory for OPTIONS method
protected  void setPost(org.apache.commons.httpclient.HttpMethod method)
          set given Http query values
 
Methods inherited from class net.sf.fikin.ant.httpclientanttask.BaseResponseAntMethod
after_execute_method, check, closeOutput, getLogAppend, getLogFile, getLogLevel, getLogProcessAs, getOutStream, getOutWriter, initOutputHandler, printBytes, printString, processResponse, setLogAppend, setLogFile, setLogLevel, setLogProcessAs, setOutStream, setOutWriter
 
Methods inherited from class net.sf.fikin.ant.httpclientanttask.BaseAntMethod
addProperty, clearHttpClient, createProxy, createUserCredentials, execute_method, execute, getConnectionTimeout, getCookiePolicy, getFailOnError, getHttpClient, getHttpMethod, getProperties, getProxy, getRetryAttempts, getShutdown, getSslAcceptUntrusted, getUrl, getUserCredentials, setConnectionTimeout, setCookiePolicy, setFailOnError, setHttpMethod, setProperties, setProxy, setRetryAttempts, setShutdown, setSslAcceptUntrusted, setUrl, setUserCredentials
 
Methods inherited from class org.apache.tools.ant.Task
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AntMultipartPostMethod

public AntMultipartPostMethod()
Method Detail

createPostString

public AntMultipartPostMethod.MyParamString createPostString()
add the text as part of the message

Returns:
a string send in the multi-part post
Ant Task Param Required:
false

createPostFile

public AntMultipartPostMethod.MyParamFile createPostFile()
add the file as part of the message

Returns:
a file content send in the multi-part post
Ant Task Param Required:
false

getPost

public java.util.HashSet getPost()
get http-query parameterss send in the post request

Returns:
http-query parameters

newHttpMethod

protected org.apache.commons.httpclient.HttpMethod newHttpMethod(java.lang.String url)
factory for OPTIONS method

Specified by:
newHttpMethod in class BaseAntMethod

before_execute_method

protected void before_execute_method()
                              throws org.apache.tools.ant.BuildException,
                                     org.apache.commons.httpclient.HttpException,
                                     java.io.FileNotFoundException,
                                     java.io.IOException
do something before @link #execute_method() is called

Overrides:
before_execute_method in class BaseAntMethod
Throws:
org.apache.tools.ant.BuildException
org.apache.commons.httpclient.HttpException
java.io.IOException
java.io.FileNotFoundException

setPost

protected void setPost(org.apache.commons.httpclient.HttpMethod method)
                throws org.apache.tools.ant.BuildException,
                       java.io.FileNotFoundException
set given Http query values

Throws:
org.apache.tools.ant.BuildException
java.io.FileNotFoundException


Copyright © 2003-2007 Nikolay Fiykov. All Rights Reserved.