Mantis - Hessian
Viewing Issue Advanced Details
4343 feature always 01-12-11 13:08 01-12-11 13:08
Aaron Pieper  
new 4.0.7  
0004343: Expose HessianConnection's underlying HttpURLConnection
We have some code which uses Hessian, and which also wants access to the HTTP connection's cookies. In older versions of Hessian (2.1.3 and such) HessianConnection extended HttpURLConnection, which allowed us to write code like this:

return ((HttpURLConnection)hessianConnection).getRequestProperty("Cookie");

In Hessian 4.0.7, HessianConnection does not extend HttpURLConnection, which is fine - I'm all for composition over inheritance. But it does make our code a lot uglier, as the HttpURLConnection can currently only be accessed via reflection:

try {
  Field connField = ReflectionUtils.getDeclaredField(HessianURLConnection.class, "_conn");
  return ((HttpURLConnection)connField.get(obj)).getRequestProperty("Cookie");
} catch (IllegalArgumentException e) {
  throw new ReflectionException(e);
} catch (IllegalAccessException e) {
  throw new ReflectionException(e);

Could you consider exposing this field somehow? Perhaps with a getter?

There are no notes attached to this issue.