Package fr.paris.lutece.util.httpaccess
Class HttpAccess
java.lang.Object
fr.paris.lutece.util.httpaccess.HttpAccess
Http net Object Accessor.
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new http access.HttpAccess(HttpAccessService accessService) Instantiates a new http access.HttpAccess(HttpAccessService accessService, ResponseStatusValidator validator) Instantiates a new http access.HttpAccess(ResponseStatusValidator validator) Instantiates a new http access. -
Method Summary
Modifier and TypeMethodDescriptiondoDelete(String strUrl, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, String> headersResponse) Send a DELETE HTTP request to an url and return the response content.doDeleteJSON(String strUrl, String strJSON, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, String> headersResponse) Send a DELETE HTTP request to an url and return the response content.Send a GET HTTP request to an Url and return the response content.doGet(String strUrl, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements) Send a GET HTTP request to an Url and return the response content.doGet(String strUrl, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headers) Send a GET HTTP request to an Url and return the response content.doGet(String strUrl, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, String> headersResponse) Send a GET HTTP request to an Url and return the response content.Send a POST HTTP request to an url and return the response content.doPost(String strUrl, Map<String, String> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements) Send a POST HTTP request to an url and return the response content.doPost(String strUrl, Map<String, String> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest) Send a POST HTTP request to an url and return the response content.doPost(String strUrl, Map<String, String> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, String> headersResponse) Send a POST HTTP request to an url and return the response content.doPostJSON(String strUrl, String strJSON, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, String> headersResponse) Do post json.doPostJSON(String strUrl, String strJSON, Map<String, String> headersRequest, Map<String, String> headersResponse) Do post json.doPostMultiPart(String strUrl, Map<String, List<String>> params, Map<String, org.apache.commons.fileupload.FileItem> fileItems) Send a POST HTTP request to an url and return the response content.doPostMultiPart(String strUrl, Map<String, List<String>> params, Map<String, org.apache.commons.fileupload.FileItem> fileItems, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements) Send a POST HTTP request to an url and return the response content.doPostMultiPart(String strUrl, Map<String, List<String>> params, Map<String, org.apache.commons.fileupload.FileItem> fileItems, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest) Send a POST HTTP request to an url and return the response content.doPostMultiPart(String strUrl, Map<String, List<String>> params, Map<String, org.apache.commons.fileupload.FileItem> fileItems, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, String> headersResponse) Send a POST HTTP request to an url and return the response content.Send a POST HTTP request to an url and return the response content.doPostMultiValues(String strUrl, Map<String, List<String>> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements) Send a POST HTTP request to an url and return the response content.doPostMultiValues(String strUrl, Map<String, List<String>> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest) Send a POST HTTP request to an url and return the response content.doPostMultiValues(String strUrl, Map<String, List<String>> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, String> headersResponse) Send a POST HTTP request to an url and return the response content.doPut(String strUrl, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> params, Map<String, String> headersRequest, Map<String, String> headersResponse) Send a PUT HTTP request to an url and return the response content.doPutJSON(String strUrl, String strJSON, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, String> headersResponse) Do put json.doPutJSON(String strUrl, String strJSON, Map<String, String> headersRequest, Map<String, String> headersResponse) Do put json.doRequestEnclosingMethod(String strUrl, String strMethod, String strContent, String contentType, String charset, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, String> headersResponse) Do request enclosing method.org.apache.commons.fileupload.FileItemdownloadFile(String strUrl) Send a GET HTTP request to an Url and return the response content.voiddownloadFile(String strUrl, OutputStream outputStream) Send a GET HTTP request to an Url and return the response content in the ouput stream.voiddownloadFile(String strUrl, String strFilePath) Send a GET HTTP request to an Url and return the response content.getFileName(String strUrl) Send a GET HTTP request to an Url and return the response content.
-
Constructor Details
-
HttpAccess
public HttpAccess()Instantiates a new http access. -
HttpAccess
Instantiates a new http access.- Parameters:
validator- the validator
-
HttpAccess
Instantiates a new http access.- Parameters:
accessService- the access servicevalidator- the validator
-
HttpAccess
Instantiates a new http access.- Parameters:
accessService- the access service
-
-
Method Details
-
doGet
Send a GET HTTP request to an Url and return the response content.- Parameters:
strUrl- The Url to access- Returns:
- The response content of the Get request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doGet
public String doGet(String strUrl, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements) throws HttpAccessException Send a GET HTTP request to an Url and return the response content.- Parameters:
strUrl- The Url to accessauthenticator- TheRequestAuthenticatorlistElements- to include in the signature- Returns:
- The response content of the Get request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doGet
public String doGet(String strUrl, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headers) throws HttpAccessExceptionSend a GET HTTP request to an Url and return the response content.- Parameters:
strUrl- The Url to accessauthenticator- TheRequestAuthenticatorlistElements- to include in the signatureheaders- the headers- Returns:
- The response content of the Get request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doGet
public String doGet(String strUrl, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, throws HttpAccessExceptionString> headersResponse) Send a GET HTTP request to an Url and return the response content.- Parameters:
strUrl- The Url to accessauthenticator- TheRequestAuthenticatorlistElements- to include in the signatureheadersRequest- Map of headers request parametersheadersResponse- Map to contain response headers- Returns:
- The response content of the Get request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPost
Send a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to post- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPost
public String doPost(String strUrl, Map<String, String> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements) throws HttpAccessExceptionSend a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to postauthenticator- TheRequestAuthenticatorlistElements- to include in the signature- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPost
public String doPost(String strUrl, Map<String, String> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, throws HttpAccessExceptionString> headersRequest) Send a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to postauthenticator- TheRequestAuthenticatorlistElements- to include in the signatureheadersRequest- Map of headers request parameters- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPost
public String doPost(String strUrl, Map<String, String> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, throws HttpAccessExceptionString> headersRequest, Map<String, String> headersResponse) Send a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to postauthenticator- TheRequestAuthenticatorlistElements- to include in the signatureheadersRequest- Map of headers request parametersheadersResponse- Map to contain response headers- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doRequestEnclosingMethod
public String doRequestEnclosingMethod(String strUrl, String strMethod, String strContent, String contentType, String charset, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, throws HttpAccessExceptionString> headersResponse) Do request enclosing method.- Parameters:
strUrl- the str urlstrMethod- the str methodstrContent- the str contentcontentType- the content typecharset- the charsetauthenticator- the authenticatorlistElements- the list elementsheadersRequest- the headers requestheadersResponse- the headers response- Returns:
- the string
- Throws:
HttpAccessException- the http access exception
-
doPostJSON
public String doPostJSON(String strUrl, String strJSON, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, throws HttpAccessExceptionString> headersResponse) Do post json.- Parameters:
strUrl- the str urlstrJSON- the str jsonauthenticator- the authenticatorlistElements- the list elementsheadersRequest- the headers requestheadersResponse- the headers response- Returns:
- the string
- Throws:
HttpAccessException- the http access exception
-
doPostJSON
public String doPostJSON(String strUrl, String strJSON, Map<String, String> headersRequest, Map<String, throws HttpAccessExceptionString> headersResponse) Do post json.- Parameters:
strUrl- the str urlstrJSON- the str jsonheadersRequest- the headers requestheadersResponse- the headers response- Returns:
- the string
- Throws:
HttpAccessException- the http access exception
-
doPutJSON
public String doPutJSON(String strUrl, String strJSON, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, throws HttpAccessExceptionString> headersResponse) Do put json.- Parameters:
strUrl- the str urlstrJSON- the str jsonauthenticator- the authenticatorlistElements- the list elementsheadersRequest- the headers requestheadersResponse- the headers response- Returns:
- the string
- Throws:
HttpAccessException- the http access exception
-
doPutJSON
public String doPutJSON(String strUrl, String strJSON, Map<String, String> headersRequest, Map<String, throws HttpAccessExceptionString> headersResponse) Do put json.- Parameters:
strUrl- the str urlstrJSON- the str jsonheadersRequest- the headers requestheadersResponse- the headers response- Returns:
- the string
- Throws:
HttpAccessException- the http access exception
-
doPostMultiValues
public String doPostMultiValues(String strUrl, Map<String, List<String>> params) throws HttpAccessExceptionSend a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to post- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPostMultiValues
public String doPostMultiValues(String strUrl, Map<String, List<String>> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements) throws HttpAccessExceptionSend a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to postauthenticator- TheRequestAuthenticatorlistElements- to include in the signature- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPostMultiValues
public String doPostMultiValues(String strUrl, Map<String, List<String>> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, throws HttpAccessExceptionString> headersRequest) Send a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to postauthenticator- TheRequestAuthenticatorlistElements- to include in the signatureheadersRequest- Map of headers request parameters- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPostMultiValues
public String doPostMultiValues(String strUrl, Map<String, List<String>> params, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, throws HttpAccessExceptionString> headersRequest, Map<String, String> headersResponse) Send a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to postauthenticator- TheRequestAuthenticatorlistElements- to include in the signatureheadersRequest- Map of headers request parametersheadersResponse- Map to contain response headers- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPostMultiPart
public String doPostMultiPart(String strUrl, Map<String, List<String>> params, Map<String, throws HttpAccessExceptionorg.apache.commons.fileupload.FileItem> fileItems) Send a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to postfileItems- The list of file items- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPostMultiPart
public String doPostMultiPart(String strUrl, Map<String, List<String>> params, Map<String, throws HttpAccessExceptionorg.apache.commons.fileupload.FileItem> fileItems, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements) Send a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to postfileItems- The list of file itemsauthenticator- TheRequestAuthenticatorlistElements- to include in the signature- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPostMultiPart
public String doPostMultiPart(String strUrl, Map<String, List<String>> params, Map<String, throws HttpAccessExceptionorg.apache.commons.fileupload.FileItem> fileItems, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest) Send a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to postfileItems- The list of file itemsauthenticator- TheRequestAuthenticatorlistElements- to include in the signatureheadersRequest- Map of headers request parameters- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPostMultiPart
public String doPostMultiPart(String strUrl, Map<String, List<String>> params, Map<String, throws HttpAccessExceptionorg.apache.commons.fileupload.FileItem> fileItems, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, String> headersResponse) Send a POST HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessparams- the list of parameters to postfileItems- The list of file itemsauthenticator- TheRequestAuthenticatorlistElements- to include in the signatureheadersRequest- Map of headers request parametersheadersResponse- Map to contain response headers- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doPut
public String doPut(String strUrl, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> params, Map<String, throws HttpAccessExceptionString> headersRequest, Map<String, String> headersResponse) Send a PUT HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessauthenticator- TheRequestAuthenticatorlistElements- to include in the signatureparams- the paramsheadersRequest- Map of headers request parametersheadersResponse- Map to contain response headers- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doDelete
public String doDelete(String strUrl, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, throws HttpAccessExceptionString> headersResponse) Send a DELETE HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessauthenticator- TheRequestAuthenticatorlistElements- to include in the signatureheadersRequest- Map of headers request parametersheadersResponse- Map to contain response headers- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
doDeleteJSON
public String doDeleteJSON(String strUrl, String strJSON, fr.paris.lutece.util.signrequest.RequestAuthenticator authenticator, List<String> listElements, Map<String, String> headersRequest, Map<String, throws HttpAccessExceptionString> headersResponse) Send a DELETE HTTP request to an url and return the response content.- Parameters:
strUrl- the url to accessstrJson- the json to send in bodyauthenticator- TheRequestAuthenticatorlistElements- to include in the signatureheadersRequest- Map of headers request parametersheadersResponse- Map to contain response headers- Returns:
- The response content of the Post request to the given Url
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
downloadFile
Send a GET HTTP request to an Url and return the response content.- Parameters:
strUrl- The Url to accessstrFilePath- the file path- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
downloadFile
Send a GET HTTP request to an Url and return the response content in the ouput stream.- Parameters:
strUrl- The Url to accessoutputStream- write in the outpustrean the contents of the file- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
getFileName
Send a GET HTTP request to an Url and return the response content.- Parameters:
strUrl- The Url to access- Returns:
- the file name
- Throws:
HttpAccessException- if there is a problem to access to the given Url
-
downloadFile
public org.apache.commons.fileupload.FileItem downloadFile(String strUrl) throws HttpAccessException Send a GET HTTP request to an Url and return the response content.- Parameters:
strUrl- The Url to access- Returns:
- a
FileItem - Throws:
HttpAccessException- if there is a problem to access to the given Url
-