| 1 |
package org.apache.commons.jcs3.auxiliary.remote.http.client; |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
import org.apache.commons.jcs3.auxiliary.remote.RemoteCacheAttributes; |
| 23 |
|
| 24 |
|
| 25 |
public class RemoteHttpCacheAttributes |
| 26 |
extends RemoteCacheAttributes |
| 27 |
{ |
| 28 |
|
| 29 |
private static final long serialVersionUID = -5944327125140505212L; |
| 30 |
|
| 31 |
|
| 32 |
private static final String DEFAULT_HTTP_VERSION = "1.1"; |
| 33 |
|
| 34 |
|
| 35 |
private int maxConnectionsPerHost = 100; |
| 36 |
|
| 37 |
|
| 38 |
private int socketTimeoutMillis = 3000; |
| 39 |
|
| 40 |
|
| 41 |
private int connectionTimeoutMillis = 5000; |
| 42 |
|
| 43 |
|
| 44 |
private String httpVersion = DEFAULT_HTTP_VERSION; |
| 45 |
|
| 46 |
|
| 47 |
private boolean includeCacheNameAsParameter = true; |
| 48 |
|
| 49 |
|
| 50 |
private boolean includeKeysAndPatternsAsParameter = true; |
| 51 |
|
| 52 |
|
| 53 |
private boolean includeRequestTypeasAsParameter = true; |
| 54 |
|
| 55 |
|
| 56 |
private String url; |
| 57 |
|
| 58 |
|
| 59 |
public static final String DEFAULT_REMOTE_HTTP_CLIENT_CLASS_NAME = RemoteHttpCacheClient.class.getName(); |
| 60 |
|
| 61 |
|
| 62 |
private String remoteHttpClientClassName = DEFAULT_REMOTE_HTTP_CLIENT_CLASS_NAME; |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
public void setMaxConnectionsPerHost( final int maxConnectionsPerHost ) |
| 68 |
{ |
| 69 |
this.maxConnectionsPerHost = maxConnectionsPerHost; |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
public int getMaxConnectionsPerHost() |
| 76 |
{ |
| 77 |
return maxConnectionsPerHost; |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
public void setSocketTimeoutMillis( final int socketTimeoutMillis ) |
| 84 |
{ |
| 85 |
this.socketTimeoutMillis = socketTimeoutMillis; |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
public int getSocketTimeoutMillis() |
| 92 |
{ |
| 93 |
return socketTimeoutMillis; |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
public void setHttpVersion( final String httpVersion ) |
| 100 |
{ |
| 101 |
this.httpVersion = httpVersion; |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
public String getHttpVersion() |
| 108 |
{ |
| 109 |
return httpVersion; |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
public void setConnectionTimeoutMillis( final int connectionTimeoutMillis ) |
| 116 |
{ |
| 117 |
this.connectionTimeoutMillis = connectionTimeoutMillis; |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
public int getConnectionTimeoutMillis() |
| 124 |
{ |
| 125 |
return connectionTimeoutMillis; |
| 126 |
} |
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
public void setIncludeCacheNameAsParameter( final boolean includeCacheNameInURL ) |
| 132 |
{ |
| 133 |
this.includeCacheNameAsParameter = includeCacheNameInURL; |
| 134 |
} |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
public boolean isIncludeCacheNameAsParameter() |
| 140 |
{ |
| 141 |
return includeCacheNameAsParameter; |
| 142 |
} |
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
public void setIncludeKeysAndPatternsAsParameter( final boolean includeKeysAndPatternsInURL ) |
| 148 |
{ |
| 149 |
this.includeKeysAndPatternsAsParameter = includeKeysAndPatternsInURL; |
| 150 |
} |
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
public boolean isIncludeKeysAndPatternsAsParameter() |
| 156 |
{ |
| 157 |
return includeKeysAndPatternsAsParameter; |
| 158 |
} |
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
public void setIncludeRequestTypeasAsParameter( final boolean includeRequestTypeasAsParameter ) |
| 164 |
{ |
| 165 |
this.includeRequestTypeasAsParameter = includeRequestTypeasAsParameter; |
| 166 |
} |
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
public boolean isIncludeRequestTypeasAsParameter() |
| 172 |
{ |
| 173 |
return includeRequestTypeasAsParameter; |
| 174 |
} |
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
public void setUrl( final String url ) |
| 180 |
{ |
| 181 |
this.url = url; |
| 182 |
} |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
public String getUrl() |
| 188 |
{ |
| 189 |
return url; |
| 190 |
} |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
public void setRemoteHttpClientClassName( final String remoteHttpClientClassName ) |
| 196 |
{ |
| 197 |
this.remoteHttpClientClassName = remoteHttpClientClassName; |
| 198 |
} |
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
public String getRemoteHttpClientClassName() |
| 204 |
{ |
| 205 |
return remoteHttpClientClassName; |
| 206 |
} |
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
@Override |
| 212 |
public String toString() |
| 213 |
{ |
| 214 |
final StringBuilder buf = new StringBuilder(); |
| 215 |
buf.append( "\n RemoteHttpCacheAttributes" ); |
| 216 |
buf.append( "\n maxConnectionsPerHost = [" + getMaxConnectionsPerHost() + "]" ); |
| 217 |
buf.append( "\n socketTimeoutMillis = [" + getSocketTimeoutMillis() + "]" ); |
| 218 |
buf.append( "\n httpVersion = [" + getHttpVersion() + "]" ); |
| 219 |
buf.append( "\n connectionTimeoutMillis = [" + getConnectionTimeoutMillis() + "]" ); |
| 220 |
buf.append( "\n includeCacheNameAsParameter = [" + isIncludeCacheNameAsParameter() + "]" ); |
| 221 |
buf.append( "\n includeKeysAndPatternsAsParameter = [" + isIncludeKeysAndPatternsAsParameter() + "]" ); |
| 222 |
buf.append( "\n includeRequestTypeasAsParameter = [" + isIncludeRequestTypeasAsParameter() + "]" ); |
| 223 |
buf.append( "\n url = [" + getUrl() + "]" ); |
| 224 |
buf.append( "\n remoteHttpClientClassName = [" + getRemoteHttpClientClassName() + "]" ); |
| 225 |
buf.append( super.toString() ); |
| 226 |
return buf.toString(); |
| 227 |
} |
| 228 |
} |