Package org.glassfish.main.itest.tools
Class FormAuthHttpClient
java.lang.Object
org.glassfish.main.itest.tools.FormAuthHttpClient
HTTP client using the HTTP protocol and form based authentication.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDoes following steps: HTTP GET to the protected relative path - expects HTTP 200 and login page - and also id of the new session.static StringreadResponseBody(HttpURLConnection connection) Read remaining bytes in the response as a response body.
-
Constructor Details
-
FormAuthHttpClient
- Parameters:
baseUrl- target endpoint.user-password-
-
-
Method Details
-
readResponseBody
Read remaining bytes in the response as a response body. The input stream will be closed then.- Parameters:
connection-- Returns:
- String.
- Throws:
IOException
-
get
Does following steps:- HTTP GET to the protected relative path - expects HTTP 200 and login page - and also id of the new session.
- HTTP POST to the
/j_security_checkwith the j_username and j_password in the request body and JSESSIONID sent as a cookie. Expects the body for the original protected relative path.
- Parameters:
relativePath-- Returns:
- connection with headers and body which can be parsed.
- Throws:
IOExceptionProtocolException
-