JAVA interface interpretation / Cast JAVA Object in Rhino
93 views
Skip to first unread message
Yves COUTURIER
unread,
Dec 6, 2017, 10:59:44 AM12/6/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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)