org.jhotdraw.net
Class ClientHttpRequest
- java.lang.Object
-
- org.jhotdraw.net.ClientHttpRequest
-
public class ClientHttpRequest extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor and Description ClientHttpRequest(java.lang.String urlString)Creates a new multipart POST HTTP request for a specified URL stringClientHttpRequest(java.net.URL url)Creates a new multipart POST HTTP request for a specified URLClientHttpRequest(java.net.URLConnection connection)Creates a new multipart POST HTTP request on a freshly opened URLConnection
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.io.InputStreampost()posts the requests to the server, with all the cookies and parameters that were addedjava.io.InputStreampost(java.util.Map parameters)posts the requests to the server, with all the cookies and parameters that were added before (if any), and with parameters that are passed in the argumentjava.io.InputStreampost(java.util.Map<java.lang.String,java.lang.String> cookies, java.util.Map parameters)posts the requests to the server, with all the cookies and parameters that were added before (if any), and with cookies and parameters that are passed in the argumentsjava.io.InputStreampost(java.lang.Object[] parameters)posts the requests to the server, with all the cookies and parameters that were added before (if any), and with parameters that are passed in the argumentjava.io.InputStreampost(java.lang.String[] cookies, java.lang.Object[] parameters)posts the requests to the server, with all the cookies and parameters that were added before (if any), and with cookies and parameters that are passed in the argumentsjava.io.InputStreampost(java.lang.String raw_cookies, java.util.Map parameters)posts the requests to the server, with all the cookies and parameters that were added before (if any), and with cookies and parameters that are passed in the argumentsjava.io.InputStreampost(java.lang.String name, java.lang.Object value)post the POST request to the server, with the specified parameterjava.io.InputStreampost(java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2)post the POST request to the server, with the specified parametersjava.io.InputStreampost(java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2, java.lang.String name3, java.lang.Object value3)post the POST request to the server, with the specified parametersjava.io.InputStreampost(java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2, java.lang.String name3, java.lang.Object value3, java.lang.String name4, java.lang.Object value4)post the POST request to the server, with the specified parametersstatic java.io.InputStreampost(java.net.URL url, java.util.Map parameters)posts a new request to specified URL, with parameters that are passed in the argumentstatic java.io.InputStreampost(java.net.URL url, java.util.Map<java.lang.String,java.lang.String> cookies, java.util.Map parameters)posts a new request to specified URL, with cookies and parameters that are passed in the argumentstatic java.io.InputStreampost(java.net.URL url, java.lang.Object[] parameters)posts a new request to specified URL, with parameters that are passed in the argumentstatic java.io.InputStreampost(java.net.URL url, java.lang.String[] cookies, java.lang.Object[] parameters)posts a new request to specified URL, with cookies and parameters that are passed in the argumentstatic java.io.InputStreampost(java.net.URL url, java.lang.String name1, java.lang.Object value1)post the POST request specified URL, with the specified parameterstatic java.io.InputStreampost(java.net.URL url, java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2)post the POST request to specified URL, with the specified parametersstatic java.io.InputStreampost(java.net.URL url, java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2, java.lang.String name3, java.lang.Object value3)post the POST request to specified URL, with the specified parametersstatic java.io.InputStreampost(java.net.URL url, java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2, java.lang.String name3, java.lang.Object value3, java.lang.String name4, java.lang.Object value4)post the POST request to specified URL, with the specified parametersvoidsetCookie(java.lang.String name, java.lang.String value)adds a cookie to the requstvoidsetCookies(java.util.Map<java.lang.String,java.lang.String> cookies)adds cookies to the requestvoidsetCookies(java.lang.String rawCookies)adds a cookie to the requstvoidsetCookies(java.lang.String[] cookies)adds cookies to the requestvoidsetParameter(java.lang.String name, java.io.File file)adds a file parameter to the requestvoidsetParameter(java.lang.String name, java.lang.Object object)adds a parameter to the request; if the parameter is a File, the file is uploaded, otherwise the string value of the parameter is passed in the requestvoidsetParameter(java.lang.String name, java.lang.String value)adds a string parameter to the requestvoidsetParameter(java.lang.String name, java.lang.String filename, java.io.InputStream is)adds a file parameter to the requestvoidsetParameters(java.util.Map parameters)adds parameters to the requestvoidsetParameters(java.lang.Object[] parameters)adds parameters to the request
-
-
-
Constructor Detail
-
ClientHttpRequest
public ClientHttpRequest(java.net.URLConnection connection) throws java.io.IOExceptionCreates a new multipart POST HTTP request on a freshly opened URLConnection- Parameters:
connection- an already open URL connection- Throws:
java.io.IOException
-
ClientHttpRequest
public ClientHttpRequest(java.net.URL url) throws java.io.IOExceptionCreates a new multipart POST HTTP request for a specified URL- Parameters:
url- the URL to send request to- Throws:
java.io.IOException
-
ClientHttpRequest
public ClientHttpRequest(java.lang.String urlString) throws java.io.IOExceptionCreates a new multipart POST HTTP request for a specified URL string- Parameters:
urlString- the string representation of the URL to send request to- Throws:
java.io.IOException
-
-
Method Detail
-
setCookies
public void setCookies(java.lang.String rawCookies) throws java.io.IOExceptionadds a cookie to the requst- Parameters:
rawCookies- A string with raw cookie data.- Throws:
java.io.IOException
-
setCookie
public void setCookie(java.lang.String name, java.lang.String value) throws java.io.IOExceptionadds a cookie to the requst- Parameters:
name- cookie namevalue- cookie value- Throws:
java.io.IOException
-
setCookies
public void setCookies(java.util.Map<java.lang.String,java.lang.String> cookies) throws java.io.IOExceptionadds cookies to the request- Parameters:
cookies- the cookie "name-to-value" map- Throws:
java.io.IOException
-
setCookies
public void setCookies(java.lang.String[] cookies) throws java.io.IOExceptionadds cookies to the request- Parameters:
cookies- array of cookie names and values (cookies[2*i] is a name, cookies[2*i + 1] is a value)- Throws:
java.io.IOException
-
setParameter
public void setParameter(java.lang.String name, java.lang.String value) throws java.io.IOExceptionadds a string parameter to the request- Parameters:
name- parameter namevalue- parameter value- Throws:
java.io.IOException
-
setParameter
public void setParameter(java.lang.String name, java.lang.String filename, java.io.InputStream is) throws java.io.IOExceptionadds a file parameter to the request- Parameters:
name- parameter namefilename- the name of the fileis- input stream to read the contents of the file from- Throws:
java.io.IOException
-
setParameter
public void setParameter(java.lang.String name, java.io.File file) throws java.io.IOExceptionadds a file parameter to the request- Parameters:
name- parameter namefile- the file to upload- Throws:
java.io.IOException
-
setParameter
public void setParameter(java.lang.String name, java.lang.Object object) throws java.io.IOExceptionadds a parameter to the request; if the parameter is a File, the file is uploaded, otherwise the string value of the parameter is passed in the request- Parameters:
name- parameter nameobject- parameter value, a File or anything else that can be stringified- Throws:
java.io.IOException
-
setParameters
public void setParameters(java.util.Map parameters) throws java.io.IOExceptionadds parameters to the request- Parameters:
parameters- "name-to-value" map of parameters; if a value is a file, the file is uploaded, otherwise it is stringified and sent in the request- Throws:
java.io.IOException
-
setParameters
public void setParameters(java.lang.Object[] parameters) throws java.io.IOExceptionadds parameters to the request- Parameters:
parameters- array of parameter names and values (parameters[2*i] is a name, parameters[2*i + 1] is a value); if a value is a file, the file is uploaded, otherwise it is stringified and sent in the request- Throws:
java.io.IOException
-
post
public java.io.InputStream post() throws java.io.IOExceptionposts the requests to the server, with all the cookies and parameters that were added- Returns:
- input stream with the server response
- Throws:
java.io.IOException
-
post
public java.io.InputStream post(java.util.Map parameters) throws java.io.IOExceptionposts the requests to the server, with all the cookies and parameters that were added before (if any), and with parameters that are passed in the argument- Parameters:
parameters- request parameters- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameters(java.util.Map)
-
post
public java.io.InputStream post(java.lang.Object[] parameters) throws java.io.IOExceptionposts the requests to the server, with all the cookies and parameters that were added before (if any), and with parameters that are passed in the argument- Parameters:
parameters- request parameters- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameters(java.util.Map)
-
post
public java.io.InputStream post(java.util.Map<java.lang.String,java.lang.String> cookies, java.util.Map parameters) throws java.io.IOExceptionposts the requests to the server, with all the cookies and parameters that were added before (if any), and with cookies and parameters that are passed in the arguments- Parameters:
cookies- request cookiesparameters- request parameters- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameters(java.util.Map),setCookies(java.lang.String)
-
post
public java.io.InputStream post(java.lang.String raw_cookies, java.util.Map parameters) throws java.io.IOExceptionposts the requests to the server, with all the cookies and parameters that were added before (if any), and with cookies and parameters that are passed in the arguments- Parameters:
raw_cookies- request cookiesparameters- request parameters- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameters(java.util.Map),setCookies(java.lang.String)
-
post
public java.io.InputStream post(java.lang.String[] cookies, java.lang.Object[] parameters) throws java.io.IOExceptionposts the requests to the server, with all the cookies and parameters that were added before (if any), and with cookies and parameters that are passed in the arguments- Parameters:
cookies- request cookiesparameters- request parameters- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameters(java.util.Map),setCookies(java.lang.String)
-
post
public java.io.InputStream post(java.lang.String name, java.lang.Object value) throws java.io.IOExceptionpost the POST request to the server, with the specified parameter- Parameters:
name- parameter namevalue- parameter value- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameter(java.lang.String, java.lang.String)
-
post
public java.io.InputStream post(java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2) throws java.io.IOExceptionpost the POST request to the server, with the specified parameters- Parameters:
name1- first parameter namevalue1- first parameter valuename2- second parameter namevalue2- second parameter value- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameter(java.lang.String, java.lang.String)
-
post
public java.io.InputStream post(java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2, java.lang.String name3, java.lang.Object value3) throws java.io.IOExceptionpost the POST request to the server, with the specified parameters- Parameters:
name1- first parameter namevalue1- first parameter valuename2- second parameter namevalue2- second parameter valuename3- third parameter namevalue3- third parameter value- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameter(java.lang.String, java.lang.String)
-
post
public java.io.InputStream post(java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2, java.lang.String name3, java.lang.Object value3, java.lang.String name4, java.lang.Object value4) throws java.io.IOExceptionpost the POST request to the server, with the specified parameters- Parameters:
name1- first parameter namevalue1- first parameter valuename2- second parameter namevalue2- second parameter valuename3- third parameter namevalue3- third parameter valuename4- fourth parameter namevalue4- fourth parameter value- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameter(java.lang.String, java.lang.String)
-
post
public static java.io.InputStream post(java.net.URL url, java.util.Map parameters) throws java.io.IOExceptionposts a new request to specified URL, with parameters that are passed in the argument- Parameters:
parameters- request parameters- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameters(java.util.Map)
-
post
public static java.io.InputStream post(java.net.URL url, java.lang.Object[] parameters) throws java.io.IOExceptionposts a new request to specified URL, with parameters that are passed in the argument- Parameters:
parameters- request parameters- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameters(java.util.Map)
-
post
public static java.io.InputStream post(java.net.URL url, java.util.Map<java.lang.String,java.lang.String> cookies, java.util.Map parameters) throws java.io.IOExceptionposts a new request to specified URL, with cookies and parameters that are passed in the argument- Parameters:
cookies- request cookiesparameters- request parameters- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setCookies(java.lang.String),setParameters(java.util.Map)
-
post
public static java.io.InputStream post(java.net.URL url, java.lang.String[] cookies, java.lang.Object[] parameters) throws java.io.IOExceptionposts a new request to specified URL, with cookies and parameters that are passed in the argument- Parameters:
url- post URLcookies- request cookiesparameters- request parameters- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setCookies(java.lang.String),setParameters(java.util.Map)
-
post
public static java.io.InputStream post(java.net.URL url, java.lang.String name1, java.lang.Object value1) throws java.io.IOExceptionpost the POST request specified URL, with the specified parameter- Parameters:
url- post URLname1- parameter namevalue1- parameter value- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameter(java.lang.String, java.lang.String)
-
post
public static java.io.InputStream post(java.net.URL url, java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2) throws java.io.IOExceptionpost the POST request to specified URL, with the specified parameters- Parameters:
name1- first parameter namevalue1- first parameter valuename2- second parameter namevalue2- second parameter value- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameter(java.lang.String, java.lang.String)
-
post
public static java.io.InputStream post(java.net.URL url, java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2, java.lang.String name3, java.lang.Object value3) throws java.io.IOExceptionpost the POST request to specified URL, with the specified parameters- Parameters:
name1- first parameter namevalue1- first parameter valuename2- second parameter namevalue2- second parameter valuename3- third parameter namevalue3- third parameter value- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameter(java.lang.String, java.lang.String)
-
post
public static java.io.InputStream post(java.net.URL url, java.lang.String name1, java.lang.Object value1, java.lang.String name2, java.lang.Object value2, java.lang.String name3, java.lang.Object value3, java.lang.String name4, java.lang.Object value4) throws java.io.IOExceptionpost the POST request to specified URL, with the specified parameters- Parameters:
name1- first parameter namevalue1- first parameter valuename2- second parameter namevalue2- second parameter valuename3- third parameter namevalue3- third parameter valuename4- fourth parameter namevalue4- fourth parameter value- Returns:
- input stream with the server response
- Throws:
java.io.IOException- See Also:
setParameter(java.lang.String, java.lang.String)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG