hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ossf...@dubioso.net>
Subject [HttpParams] unsetting a parameter in the hierarchy
Date Sat, 22 Dec 2007 08:48:27 GMT
Hi folks,

how are we going to "unset" a parameter that is defined
somewhere higher up in the hierarchy? The example at hand
is the default proxy. An application defines a default
proxy in the client parameters, but wants a specific
request to be sent without the proxy. Setting the value
to null in the request parameters doesn't work, since
null means "look higher up in the hierarchy".

Option A:
Define a global "Void" object that can be used to
explicitly unset any parameter value. Since the global
object does not match the expected type of parameters,
the check for "Void" has to be done before casting
the value to the target type.
Moving the check for the "Void" object into the params
implementations will not work, since each param impl
can be put into a hierarchy. If it's in the hierarchy,
it has to return the object to cancel recursion, only
the outmost impl can be allowed to do the null conversion.

Option B:
Define a parameter specific Null object for those
parameters where it matters, with the appropriate
type. That would mean a specific HttpHost constant
indicating NO_PROXY. It must be a valid HttpHost,
but must also never equal a real HttpHost.
We could use an invalid port number such as -2 to
do that, but this approach breaks when HttpHost
gets better argument checking. The same applies for
invalid or otherwise special hostnames or protocols.

Option C:
something else?


cheers,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message