From a5fe499d59bc691c9cf92661fac3aacda743df9e Mon Sep 17 00:00:00 2001 From: mattinger Date: Thu, 17 Aug 2006 06:15:24 +0000 Subject: git-svn-id: file:///home/sven/projects/JOGL/temp/ant-contrib/svn/ant-contrib-code/trunk/ant-contrib@23 32d7a393-a5a9-423c-abd3-5d954feb1f2f --- .../net/httpclient/AbstractHttpStateTypeTask.java | 15 ++++++ .../net/httpclient/AbstractMethodTask.java | 15 ++++++ .../antcontrib/net/httpclient/AddCookieTask.java | 15 ++++++ .../net/httpclient/AddCredentialsTask.java | 15 ++++++ .../net/httpclient/ClearCookiesTask.java | 15 ++++++ .../net/httpclient/ClearCredentialsTask.java | 15 ++++++ .../sf/antcontrib/net/httpclient/ClientParams.java | 15 ++++++ .../sf/antcontrib/net/httpclient/Credentials.java | 16 +++++- .../antcontrib/net/httpclient/GetMethodTask.java | 15 ++++++ .../antcontrib/net/httpclient/HeadMethodTask.java | 15 ++++++ .../sf/antcontrib/net/httpclient/HostConfig.java | 57 ++++++++++++++++++++++ .../sf/antcontrib/net/httpclient/HostParams.java | 39 +++++++++++++++ .../antcontrib/net/httpclient/HttpClientType.java | 24 +++++++++ .../antcontrib/net/httpclient/HttpStateType.java | 15 ++++++ .../sf/antcontrib/net/httpclient/MethodParams.java | 15 ++++++ .../net/sf/antcontrib/net/httpclient/Params.java | 15 ++++++ .../antcontrib/net/httpclient/PostMethodTask.java | 15 ++++++ .../net/httpclient/PurgeExpiredCookiesTask.java | 15 ++++++ 18 files changed, 344 insertions(+), 2 deletions(-) create mode 100644 src/java/net/sf/antcontrib/net/httpclient/HostConfig.java create mode 100644 src/java/net/sf/antcontrib/net/httpclient/HostParams.java (limited to 'src/java') diff --git a/src/java/net/sf/antcontrib/net/httpclient/AbstractHttpStateTypeTask.java b/src/java/net/sf/antcontrib/net/httpclient/AbstractHttpStateTypeTask.java index 6f4d963..3212552 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/AbstractHttpStateTypeTask.java +++ b/src/java/net/sf/antcontrib/net/httpclient/AbstractHttpStateTypeTask.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import org.apache.tools.ant.BuildException; diff --git a/src/java/net/sf/antcontrib/net/httpclient/AbstractMethodTask.java b/src/java/net/sf/antcontrib/net/httpclient/AbstractMethodTask.java index e5c15ef..6bb34ed 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/AbstractMethodTask.java +++ b/src/java/net/sf/antcontrib/net/httpclient/AbstractMethodTask.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import java.io.File; diff --git a/src/java/net/sf/antcontrib/net/httpclient/AddCookieTask.java b/src/java/net/sf/antcontrib/net/httpclient/AddCookieTask.java index b394c9a..f68c84b 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/AddCookieTask.java +++ b/src/java/net/sf/antcontrib/net/httpclient/AddCookieTask.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import java.util.ArrayList; diff --git a/src/java/net/sf/antcontrib/net/httpclient/AddCredentialsTask.java b/src/java/net/sf/antcontrib/net/httpclient/AddCredentialsTask.java index 513014f..91ae9f2 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/AddCredentialsTask.java +++ b/src/java/net/sf/antcontrib/net/httpclient/AddCredentialsTask.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import java.util.ArrayList; diff --git a/src/java/net/sf/antcontrib/net/httpclient/ClearCookiesTask.java b/src/java/net/sf/antcontrib/net/httpclient/ClearCookiesTask.java index 8dd4971..d5f91db 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/ClearCookiesTask.java +++ b/src/java/net/sf/antcontrib/net/httpclient/ClearCookiesTask.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import org.apache.tools.ant.BuildException; diff --git a/src/java/net/sf/antcontrib/net/httpclient/ClearCredentialsTask.java b/src/java/net/sf/antcontrib/net/httpclient/ClearCredentialsTask.java index 63865c7..cfd0923 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/ClearCredentialsTask.java +++ b/src/java/net/sf/antcontrib/net/httpclient/ClearCredentialsTask.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import org.apache.tools.ant.BuildException; diff --git a/src/java/net/sf/antcontrib/net/httpclient/ClientParams.java b/src/java/net/sf/antcontrib/net/httpclient/ClientParams.java index 785dba5..816c3d8 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/ClientParams.java +++ b/src/java/net/sf/antcontrib/net/httpclient/ClientParams.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import org.apache.commons.httpclient.HttpVersion; diff --git a/src/java/net/sf/antcontrib/net/httpclient/Credentials.java b/src/java/net/sf/antcontrib/net/httpclient/Credentials.java index a9f091f..84ecd98 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/Credentials.java +++ b/src/java/net/sf/antcontrib/net/httpclient/Credentials.java @@ -1,5 +1,17 @@ -/** - * +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package net.sf.antcontrib.net.httpclient; diff --git a/src/java/net/sf/antcontrib/net/httpclient/GetMethodTask.java b/src/java/net/sf/antcontrib/net/httpclient/GetMethodTask.java index be19a1d..321ef23 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/GetMethodTask.java +++ b/src/java/net/sf/antcontrib/net/httpclient/GetMethodTask.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import org.apache.commons.httpclient.HttpMethodBase; diff --git a/src/java/net/sf/antcontrib/net/httpclient/HeadMethodTask.java b/src/java/net/sf/antcontrib/net/httpclient/HeadMethodTask.java index 27cce1c..6366011 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/HeadMethodTask.java +++ b/src/java/net/sf/antcontrib/net/httpclient/HeadMethodTask.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import org.apache.commons.httpclient.HttpMethodBase; diff --git a/src/java/net/sf/antcontrib/net/httpclient/HostConfig.java b/src/java/net/sf/antcontrib/net/httpclient/HostConfig.java new file mode 100644 index 0000000..8c2a374 --- /dev/null +++ b/src/java/net/sf/antcontrib/net/httpclient/HostConfig.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package net.sf.antcontrib.net.httpclient; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +import org.apache.commons.httpclient.HostConfiguration; +import org.apache.tools.ant.BuildException; + +public class HostConfig + extends HostConfiguration { + + public void setPort(int port) { + setHost(getHost(), port); + } + + public void setProtocol(String protocol) { + setHost(getHost(), getPort(), protocol); + } + + public void setAddress(String address) { + try { + setLocalAddress(InetAddress.getByName(address)); + } + catch (UnknownHostException e) { + throw new BuildException(e); + } + } + + public void setProxyHost(String host) { + setProxy(host, getProxyPort()); + } + + public void setProxyPort(int port) { + setProxy(getProxyHost(), port); + } + + public HostParams createParams() { + HostParams params = new HostParams(); + setParams(params); + return params; + } +} diff --git a/src/java/net/sf/antcontrib/net/httpclient/HostParams.java b/src/java/net/sf/antcontrib/net/httpclient/HostParams.java new file mode 100644 index 0000000..0a441c5 --- /dev/null +++ b/src/java/net/sf/antcontrib/net/httpclient/HostParams.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package net.sf.antcontrib.net.httpclient; + +public class HostParams + extends org.apache.commons.httpclient.params.HostParams { + private static final long serialVersionUID = -1; + + public void addConfiguredDouble(Params.DoubleParam param) { + setDoubleParameter(param.getName(), param.getValue()); + } + + public void addConfiguredInt(Params.IntParam param) { + setIntParameter(param.getName(), param.getValue()); + } + + public void addConfiguredLong(Params.LongParam param) { + setLongParameter(param.getName(), param.getValue()); + } + + public void addConfiguredString(Params.StringParam param) { + setParameter(param.getName(), param.getValue()); + } + + +} diff --git a/src/java/net/sf/antcontrib/net/httpclient/HttpClientType.java b/src/java/net/sf/antcontrib/net/httpclient/HttpClientType.java index ae171c4..946b860 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/HttpClientType.java +++ b/src/java/net/sf/antcontrib/net/httpclient/HttpClientType.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import org.apache.commons.httpclient.HttpClient; @@ -48,4 +63,13 @@ public class HttpClientType client.setParams(clientParams); return clientParams; } + + public HostConfig createHostConfig() { + if (isReference()) { + tooManyAttributes(); + } + HostConfig config = new HostConfig(); + client.setHostConfiguration(config); + return config; + } } diff --git a/src/java/net/sf/antcontrib/net/httpclient/HttpStateType.java b/src/java/net/sf/antcontrib/net/httpclient/HttpStateType.java index 46d7a09..bd3279e 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/HttpStateType.java +++ b/src/java/net/sf/antcontrib/net/httpclient/HttpStateType.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import org.apache.commons.httpclient.Cookie; diff --git a/src/java/net/sf/antcontrib/net/httpclient/MethodParams.java b/src/java/net/sf/antcontrib/net/httpclient/MethodParams.java index fddd648..a61ad02 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/MethodParams.java +++ b/src/java/net/sf/antcontrib/net/httpclient/MethodParams.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import org.apache.commons.httpclient.HttpVersion; diff --git a/src/java/net/sf/antcontrib/net/httpclient/Params.java b/src/java/net/sf/antcontrib/net/httpclient/Params.java index 94acd30..aab388c 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/Params.java +++ b/src/java/net/sf/antcontrib/net/httpclient/Params.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; diff --git a/src/java/net/sf/antcontrib/net/httpclient/PostMethodTask.java b/src/java/net/sf/antcontrib/net/httpclient/PostMethodTask.java index 1106bcc..6f4385a 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/PostMethodTask.java +++ b/src/java/net/sf/antcontrib/net/httpclient/PostMethodTask.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import java.io.File; diff --git a/src/java/net/sf/antcontrib/net/httpclient/PurgeExpiredCookiesTask.java b/src/java/net/sf/antcontrib/net/httpclient/PurgeExpiredCookiesTask.java index 7e9a47d..4146b8e 100644 --- a/src/java/net/sf/antcontrib/net/httpclient/PurgeExpiredCookiesTask.java +++ b/src/java/net/sf/antcontrib/net/httpclient/PurgeExpiredCookiesTask.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2001-2006 Ant-Contrib project. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package net.sf.antcontrib.net.httpclient; import java.util.Date; -- cgit v1.2.3