| Line | Hits | Note | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * $Id: HttpClientConnection.java 1011 2008-06-16 17:57:36Z amandel $ | ||
| 3 | * | ||
| 4 | * Copyright 2006, The jCoderZ.org Project. All rights reserved. | ||
| 5 | * | ||
| 6 | * Redistribution and use in source and binary forms, with or without | ||
| 7 | * modification, are permitted provided that the following conditions are | ||
| 8 | * met: | ||
| 9 | * | ||
| 10 | * * Redistributions of source code must retain the above copyright | ||
| 11 | * notice, this list of conditions and the following disclaimer. | ||
| 12 | * * Redistributions in binary form must reproduce the above | ||
| 13 | * copyright notice, this list of conditions and the following | ||
| 14 | * disclaimer in the documentation and/or other materials | ||
| 15 | * provided with the distribution. | ||
| 16 | * * Neither the name of the jCoderZ.org Project nor the names of | ||
| 17 | * its contributors may be used to endorse or promote products | ||
| 18 | * derived from this software without specific prior written | ||
| 19 | * permission. | ||
| 20 | * | ||
| 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND | ||
| 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
| 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS | ||
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | ||
| 28 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | ||
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | ||
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 32 | */ | ||
| 33 | package org.jcoderz.commons.connector.http.transport; | ||
| 34 | |||
| 35 | import java.io.InputStream; | ||
| 36 | import java.security.KeyStore; | ||
| 37 | |||
| 38 | |||
| 39 | /** | ||
| 40 | * Interface used by the commons http connector to use the jakarta | ||
| 41 | * commons-httpclient. | ||
| 42 | * | ||
| 43 | */ | ||
| 44 | (1) | public interface HttpClientConnection | |
| 45 | { | ||
| 46 | /** | ||
| 47 | * Establishes the connection to the target host using the given parameter | ||
| 48 | * values. At this step only the underlaying objects will be created and | ||
| 49 | * initializied. The physical connection will be open later on. | ||
| 50 | * | ||
| 51 | * @param url the URL to connect to | ||
| 52 | * @param connectTimeout the connect timeout used for connecting the host | ||
| 53 | * @param readTimeout the read timeout used whilst reading the response | ||
| 54 | * from the target host | ||
| 55 | */ | ||
| 56 | void establishConnection ( | ||
| 57 | String url, int connectTimeout, int readTimeout); | ||
| 58 | |||
| 59 | /** | ||
| 60 | * Releases the connection for reuse. | ||
| 61 | * The physical connection is afterwards still open. | ||
| 62 | */ | ||
| 63 | void releaseConnection (); | ||
| 64 | |||
| 65 | /** | ||
| 66 | * Closes the physical connection. | ||
| 67 | */ | ||
| 68 | void closeConnection (); | ||
| 69 | |||
| 70 | /** | ||
| 71 | * Executes sending the request and receiving the response. | ||
| 72 | * | ||
| 73 | * @throws HttpConnectionException in case of a connection failure | ||
| 74 | */ | ||
| 75 | void execute () | ||
| 76 | throws HttpConnectionException; | ||
| 77 | |||
| 78 | /** | ||
| 79 | * Sets the request body to send. | ||
| 80 | * | ||
| 81 | * @param body the message body to send | ||
| 82 | */ | ||
| 83 | void setRequestBody (InputStream body); | ||
| 84 | |||
| 85 | /** | ||
| 86 | * Gets the response body received from the target host. | ||
| 87 | * | ||
| 88 | * @return byte[] - the body of the response message | ||
| 89 | * @throws HttpEmptyResponseException if response body is empty | ||
| 90 | */ | ||
| 91 | byte[] getResponseBody () | ||
| 92 | throws HttpEmptyResponseException; | ||
| 93 | |||
| 94 | /** | ||
| 95 | * Gets the response header parameter value for a given key. | ||
| 96 | * | ||
| 97 | * @param key the parameter key to obtain the value for | ||
| 98 | * @return String - the parameter value for the given key | ||
| 99 | */ | ||
| 100 | String getResponseHeader (String key); | ||
| 101 | |||
| 102 | /** | ||
| 103 | * Sets parameter necessary for SSL connection. | ||
| 104 | * | ||
| 105 | * @param keyStore | ||
| 106 | * the keystore given from Signature Service | ||
| 107 | * @param trustStore | ||
| 108 | * the truststore given from Signature Service | ||
| 109 | * @param keyAlias | ||
| 110 | * the alias of the key used from keystore | ||
| 111 | * @param keyAliasPassword | ||
| 112 | * the password of the key in use | ||
| 113 | */ | ||
| 114 | void initSsl ( | ||
| 115 | KeyStore keyStore, | ||
| 116 | KeyStore trustStore, | ||
| 117 | String keyAlias, | ||
| 118 | String keyAliasPassword); | ||
| 119 | |||
| 120 | /** | ||
| 121 | * Sets parameter necessary for SSL connection. | ||
| 122 | * Here: the keystores are loaded from the file system. | ||
| 123 | * | ||
| 124 | * @param keyAlias | ||
| 125 | * the alias of the key used from keystore | ||
| 126 | * @param keyAliasPassword | ||
| 127 | * the password of the key in use | ||
| 128 | */ | ||
| 129 | void initSsl ( | ||
| 130 | String keyAlias, | ||
| 131 | String keyAliasPassword); | ||
| 132 | |||
| 133 | /** | ||
| 134 | * Sets the event listener used for SLA logging. | ||
| 135 | * | ||
| 136 | * @param listener the listener to set | ||
| 137 | * @param context the context to set | ||
| 138 | */ | ||
| 139 | void setEventListener (HttpConnectorEventListener listener, | ||
| 140 | ConnectorContext context); | ||
| 141 | |||
| 142 | /** | ||
| 143 | * Sets request header to send and response header to validate. | ||
| 144 | * @param header the header object | ||
| 145 | */ | ||
| 146 | void setRequestResponseHeader (HttpRequestResponseHeader header); | ||
| 147 | } |
|
|
(1) | 44 | : | 0 | Type Javadoc comment is missing an @author tag. |