java - Cling with tomcat -


i trying create service autodiscover upnp devices in local network, implementing in webapplication running on tomcat 7 , using 4thline cling library. got error

org.fourthline.cling.transport.routerimpl handlestartfailure severe: unable initialize network router: org.fourthline.cling.transport.spi.initializationexception: failed set modified urlstreamhandlerfactory in environment. can't use bundled default client based on httpurlconnection, see manual.

in cling's manual cling couldn't use java jdk's httpurlconnection http client operations. suggest configure network transport.

i didn't understand how do. had similar problem? can suggest me example?

thanks.

the code using is:

    public class example {      public static void startdiscovery() {          registrylistener listener = new registrylistener() {              public void remotedevicediscoverystarted(registry registry,remotedevice device) {                       string name = device.getdisplaystring();                     string url = device.getdetails().getbaseurl().tostring();                     string friendlyname = device.getdetails().getfriendlyname();               }              public void remotedevicediscoveryfailed(registry registry,remotedevice device, exception ex) {             }              public void remotedeviceadded(registry registry, remotedevice device) {             }              public void remotedeviceupdated(registry registry,remotedevice device) {             }              public void remotedeviceremoved(registry registry,remotedevice device) {             }              public void localdeviceadded(registry registry, localdevice device) {             }              public void localdeviceremoved(registry registry, localdevice device) {             }              public void beforeshutdown(registry registry) {             }              public void aftershutdown() {             }         };           try{              upnpservice upnpservice = new upnpserviceimpl(listener);             upnpservice.getcontrolpoint().search(new stallheader());             // wait 5 seconds them respond             thread.sleep(5000);             upnpservice.shutdown();         }catch(exception e){             e.printstacktrace();         }       } } 


Comments

Popular posts from this blog

ios - Memory not freeing up after popping viewcontroller using ARC -

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -