|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--iaik.x509.ocsp.net.HttpOCSPRequest
A simple wrapper class allowing to post an OCSP request to an OCSP server over HTTP.
This class uses a HttpURLConnection
object for sending a request
to an OCSP responder by using the POST method. When creating a HttpOCSPRequest
object supply the URL of the
OCSP responder and subsequently call method postRequest
for sending the OCSPRequest
to the server. The response from the server can be obtained by calling
method getOCSPResponse
, e.g.:
// the request to be send: OCSPRequest ocspRequest = ...; // the responder URL to post to: URL url = ...; // create the http request: HttpOCSPRequest httpOCSPRequest = new HttpOCSPRequest(url); // post the request int responseCode = httpOCSPRequest.postRequest(ocspRequest); if (responseCode/200 != 2) { System.out.println("Error connecting to " + responderUrl + ":"); System.out.println(httpOCSPRequest.getResponseMessage()); } else { System.out.println("Parse response: "); OCSPResponse ocspResponse = httpOCSPRequest.getOCSPResponse(); ... }
OCSPRequest
,
OCSPResponse
Constructor Summary | |
HttpOCSPRequest(URL responderUrl)
Creates a HttpOCSPRequest for the given responder url. |
Method Summary | |
OCSPResponse |
getOCSPResponse()
Returns the ocsp response sent by the server. |
String |
getResponseMessage()
Gets the http response message. |
int |
postRequest(OCSPRequest ocspRequest)
Posts the given ocsp request to the responder of this HttpOCSPRequest. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HttpOCSPRequest(URL responderUrl)
responderUrl
- the url of the OCSP responderMethod Detail |
public int postRequest(OCSPRequest ocspRequest) throws IOException, UnknownResponseException
ocspRequest
- the OCSPrequest
to be postedIOException
- if an I/O error occurs while reading the responseUnknownResponseException
- if the post has been successful, but
the server uses an not supported response typepublic OCSPResponse getOCSPResponse()
public String getResponseMessage()
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |