You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Roland Weber (JIRA)" <ji...@apache.org> on 2008/01/10 19:39:33 UTC
[jira] Created: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
allow explicit unsetting of parameters in stacks or hierarchies
---------------------------------------------------------------
Key: HTTPCORE-139
URL: https://issues.apache.org/jira/browse/HTTPCORE-139
Project: HttpComponents Core
Issue Type: Improvement
Components: HttpCore
Affects Versions: 4.0-alpha6
Reporter: Roland Weber
Assignee: Roland Weber
Priority: Minor
Fix For: 4.0-beta1
Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Commented: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565433#action_12565433 ]
Roland Weber commented on HTTPCORE-139:
---------------------------------------
I don't think it addressed all the cases where it is or might be necessary. I was just addressing the most obvious ones, hoping to avoid implementing more complex ones like NO_INET_ADDRESS to unset the LOCAL_ADDRESS parameter. I consider the technique of creating invalid objects to represent NULL a hack, and it cannot even be used for elementary types where every possible value is valid. How do you unset a String?
Have you taken a look at the NO_HOST object in HttpClient? If we ever added basic sanity checks to HttpHost, it would have to be changed. And as soon as it is changed, we run into version compatibility problems.
cheers,
Roland
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta2
>
> Attachments: 2k8-01-10-null-param.txt, 2k8-01-13-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Commented: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558367#action_12558367 ]
Roland Weber commented on HTTPCORE-139:
---------------------------------------
Hi Oleg,
if you put the check in getParameter(), then classes like ClientParamsStack that reference HttpParams can no longer distinguish between an unset parameter and one set to an explicit null. I've mentioned that problem under Option A in my post to the dev list:
http://mail-archives.apache.org/mod_mbox/hc-dev/200801.mbox/%3c477F510C.2070305@dubioso.net%3e
cheers,
Roland
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta1
>
> Attachments: 2k8-01-10-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Commented: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566157#action_12566157 ]
Oleg Kalnichevski commented on HTTPCORE-139:
--------------------------------------------
> Have you taken a look at the NO_HOST object in HttpClient?
Yes, I have. It is not pretty. However, finding a reasonable representation of a NULL value (non-value) is a completely different story. I respectfully remain unconvinced this patch is necessary, but will not stand in your way.
Oleg
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta2
>
> Attachments: 2k8-01-10-null-param.txt, 2k8-01-13-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Commented: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557762#action_12557762 ]
Oleg Kalnichevski commented on HTTPCORE-139:
--------------------------------------------
Why not just that?
====
public final class BasicHttpParams extends AbstractHttpParams
implements Serializable, Cloneable {
...
public Object getParameter(final String name) {
Object param = null;
if (this.parameters != null) {
param = this.parameters.get(name);
}
if (NoParamValue.NULL.equals(param)) {
param = null;
}
return param;
}
...
====
Oleg
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta1
>
> Attachments: 2k8-01-10-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Commented: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565241#action_12565241 ]
Roland Weber commented on HTTPCORE-139:
---------------------------------------
There are now testcases for the parameter-specific solution in HttpClient. Please have a look at TestRouteParams.testUnsetHierarchy, it should make obvious why getParameter cannot be allowed to map NULL objects to null. Hierarchy traversal needs to be stopped on the first object found, whether that is NULL or a real value. It must not be resumed in wrapping instances of HttpParams.
The reasons why #getParameter needs to behave differently from the typed siblings are:
- typed siblings cannot return an explicit NULL object
- typed siblings are called on the outmost level only, while getParameter is used to traverse hierarchies
NULL checks need to be spread everywhere you currently have null checks. I prefer to have these once in AbstractHttpParams for the default types, instead of spreading them throughout the modules and application code.
as a side note:
The typed getters for elementary types are not required to map to getParameter. Since they get the default as argument and don't return null, they can traverse a hierarchy by calling their counterpart in parents/defaults too. The only getter that needs to map to getParameter is getString. It can return null to indicate it is unset, but it cannot return a NULL object nor does it get a default to pass in traversal calls. The latter wouldn't help anyway, because the default could be null too.
cheers,
Roland
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta2
>
> Attachments: 2k8-01-10-null-param.txt, 2k8-01-13-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Commented: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565351#action_12565351 ]
Oleg Kalnichevski commented on HTTPCORE-139:
--------------------------------------------
Roland
Given the fact HTTPCLIENT-735 seems to have addressed those use cases in HttpClient where unsetting parameters was necessary, I would very much rather not attempt to come up with a generic mechanism in core.
Oleg
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta2
>
> Attachments: 2k8-01-10-null-param.txt, 2k8-01-13-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Updated: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Roland Weber updated HTTPCORE-139:
----------------------------------
Attachment: 2k8-01-13-null-param.txt
Slightly improved version of the previous patch.
A static helper method isNull(Object) simplifies the check.
cheers,
Roland
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta1
>
> Attachments: 2k8-01-10-null-param.txt, 2k8-01-13-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Closed: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Roland Weber closed HTTPCORE-139.
---------------------------------
Resolution: Won't Fix
Alright then, let's see whether this problem is ever encountered by one of our users. So far, nobody asked for it.
I'll add a NULL for LocalAddress to the routing params, the rest of HttpConn doesn't use param hierarchies.
cheers,
Roland
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta2
>
> Attachments: 2k8-01-10-null-param.txt, 2k8-01-13-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Commented: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557768#action_12557768 ]
Oleg Kalnichevski commented on HTTPCORE-139:
--------------------------------------------
Disregard my previous post. I picked up the wrong class. How about this?
===
public final class DefaultedHttpParams extends AbstractHttpParams {
...
public Object getParameter(final String name) {
Object obj = this.local.getParameter(name);
if (NoParamValue.NULL.equals(obj)) {
return null;
}
if (obj == null && this.defaults != null) {
obj = this.defaults.getParameter(name);
}
return obj;
}
===
Oleg
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta1
>
> Attachments: 2k8-01-10-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Updated: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Roland Weber updated HTTPCORE-139:
----------------------------------
Attachment: 2k8-01-10-null-param.txt
Here is a patch for your consideration. It's even less intrusive than I thought, because the constant is not defined in the HttpParams interface. However, I feel that if we introduce this, it should already be in beta1 so that anyone implementing HttpParams is aware of it.
No testcase, since there are no testcases for HttpParams at all.
No changes in NIO were required. I'd update HttpClient some other time if this patch is accepted.
cheers,
Roland
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta1
>
> Attachments: 2k8-01-10-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Updated: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski updated HTTPCORE-139:
---------------------------------------
Fix Version/s: (was: 4.0-rc1)
4.0-beta2
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta2
>
> Attachments: 2k8-01-10-null-param.txt, 2k8-01-13-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Commented: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12566733#action_12566733 ]
Roland Weber commented on HTTPCORE-139:
---------------------------------------
For the records: I didn't add a NULL for LocalAddress. java.net.InetAddress cannot be extended, and we cannot just map some IPv4 or IPv6 address to null. IP wildcard addresses 0.0.0.0 or :: should achieve a similar effect on the network level. If there are problems on the HttpRoute level (wildcard vs. null), a custom route planner needs to be installed. I can live with that.
cheers,
Roland
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-beta2
>
> Attachments: 2k8-01-10-null-param.txt, 2k8-01-13-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
[jira] Updated: (HTTPCORE-139) allow explicit unsetting of
parameters in stacks or hierarchies
Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HTTPCORE-139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oleg Kalnichevski updated HTTPCORE-139:
---------------------------------------
Fix Version/s: (was: 4.0-beta1)
4.0-rc1
Roland,
I am growing somewhat uneasy about this whole thing. I am not sure I like the fact that #getParameter handles NULL values differently from its typed siblings. I also do not like that NULL checks need to be spread all over the place.
There seems to be no single best way of solving the problem, therefore I would like to urge you one more time to consider not including this feature into core.
Anyways, the issue obviously needs more work, so I am pushing it back to beta2.
Oleg
> allow explicit unsetting of parameters in stacks or hierarchies
> ---------------------------------------------------------------
>
> Key: HTTPCORE-139
> URL: https://issues.apache.org/jira/browse/HTTPCORE-139
> Project: HttpComponents Core
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 4.0-alpha6
> Reporter: Roland Weber
> Assignee: Roland Weber
> Priority: Minor
> Fix For: 4.0-rc1
>
> Attachments: 2k8-01-10-null-param.txt, 2k8-01-13-null-param.txt
>
>
> Patch for the "global null" approach to follow.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org