JAVA interface interpretation / Cast JAVA Object in Rhino

73 views
Skip to first unread message

Yves COUTURIER

unread,
Dec 6, 2017, 10:59:44 AM12/6/17
to mozilla-rhino
Hi,

I want to open a two-way SSL connexion for RestEasy (old jboss 6.4 eap) in Rhino.

For establish connexion, I do like :

  var httpClient = new Packages.org.apache.http.impl.client.DefaultHttpClient();
  [...]
  var clientExecutor = new Packages.org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor( httpClient );

This don't work because "ApacheHttpClient4Executor" do not have a constructor with "DefaultHttpClient"

"ApacheHttpClient4Executor" have a constructor with "HttpClient"

"DefaultHttpClient" implements "HttpClient" but Rhino RunTime do not reconized it when I make instance of "ApacheHttpClient4Executor"

I attempt cast with "Class.cast" (Class.forName("org.apache.http.client.HttpClient").cast( myObjDefaultHttpClient )) but do not work too.

How can I do that without write a specific JAVA class for cast DefaultHttpClient to HttpClient ?

I attempt to do dynamic cast in java but I found nothing (case seems difficult because HttpClient is an interface)


Thanks,

Yves.


Reply all
Reply to author
Forward
0 new messages