Package VASSAL.tools
Class HTTPPostBuilder
java.lang.Object
VASSAL.tools.HTTPPostBuilder
public class HTTPPostBuilder extends Object
Builds HTTP POST requests conveniently.
- Since:
- 3.1.0
- Author:
- Joel Uckelman
-
Constructor Summary
Constructors Constructor Description HTTPPostBuilder()
-
Method Summary
Modifier and Type Method Description InputStream
post(String url)
Submits an HTTP POST request to the given URL.InputStream
post(URL url)
Submits an HTTP POST request to the given URL.void
setParameter(String name, File file)
Sets a file to be uploaded as part of an HTTP POST request.void
setParameter(String name, String value)
Sets a parameter for an HTTP POST request.void
setParameter(String name, String filename, InputStream in)
Sets a file to be uploaded as part of an HTTP POST request.void
setParameter(String name, String filename, String contents)
Sets a file to be uploaded as part of an HTTP POST request.
-
Constructor Details
-
HTTPPostBuilder
public HTTPPostBuilder()
-
-
Method Details
-
setParameter
Sets a parameter for an HTTP POST request.- Parameters:
name
- the name of the parametervalue
- the value of the parameter- Throws:
IOException
- in case of failure
-
setParameter
Sets a file to be uploaded as part of an HTTP POST request.- Parameters:
name
- the name of the parameterfile
- the path to the file- Throws:
IOException
- in case of failure
-
setParameter
Sets a file to be uploaded as part of an HTTP POST request.- Parameters:
name
- the name of the parameterfilename
- the path to the filein
- anInputStream
from which to read the file- Throws:
IOException
- in case of failure
-
setParameter
Sets a file to be uploaded as part of an HTTP POST request.- Parameters:
name
- the name of the parameterfilename
- the path to the filecontents
- aString
containing the file- Throws:
IOException
- in case of failure
-
post
Submits an HTTP POST request to the given URL. This convenience method is equivalent toHTTPPostBuilder.post(new URL(url))
.- Parameters:
url
- the URL to receive the POST request- Returns:
- the reply
- Throws:
IOException
- in case of failure
-
post
Submits an HTTP POST request to the given URL.- Parameters:
url
- the URL to receive the POST request- Returns:
- the reply
- Throws:
IOException
- in case of failure
-