
36 changed files with 548 additions and 150 deletions
@ -0,0 +1,41 @@ |
|||||
|
package com.genersoft.iot.vmp.conf; |
||||
|
|
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.context.annotation.Configuration; |
||||
|
import springfox.documentation.builders.ApiInfoBuilder; |
||||
|
import springfox.documentation.builders.PathSelectors; |
||||
|
import springfox.documentation.builders.RequestHandlerSelectors; |
||||
|
import springfox.documentation.builders.RequestParameterBuilder; |
||||
|
import springfox.documentation.schema.ScalarType; |
||||
|
import springfox.documentation.service.ApiInfo; |
||||
|
import springfox.documentation.service.Contact; |
||||
|
import springfox.documentation.spi.DocumentationType; |
||||
|
import springfox.documentation.spring.web.plugins.Docket; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@Configuration |
||||
|
public class Swagger3Config { |
||||
|
|
||||
|
@Bean |
||||
|
public Docket createRestApi() { |
||||
|
return new Docket(DocumentationType.OAS_30) |
||||
|
.apiInfo(apiInfo()) |
||||
|
.select() |
||||
|
.apis(RequestHandlerSelectors.basePackage("com.genersoft.iot.vmp.vmanager")) |
||||
|
.paths(PathSelectors.any()) |
||||
|
.build() |
||||
|
.pathMapping("/"); |
||||
|
} |
||||
|
|
||||
|
private ApiInfo apiInfo() { |
||||
|
return new ApiInfoBuilder() |
||||
|
.title("WVP-PRO 接口文档") |
||||
|
.description("更多请咨询服务开发者(18010473990@@163.com)。") |
||||
|
.contact(new Contact("Ray。", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com")) |
||||
|
.version("1.0") |
||||
|
.build(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
package com.genersoft.iot.vmp.vmanager.server; |
||||
|
|
||||
|
import com.genersoft.iot.vmp.VManageBootstrap; |
||||
|
import com.genersoft.iot.vmp.utils.SpringBeanFactory; |
||||
|
import com.genersoft.iot.vmp.vmanager.gbStream.bean.GbStreamParam; |
||||
|
import gov.nist.javax.sip.SipStackImpl; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.context.ConfigurableApplicationContext; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.sip.ListeningPoint; |
||||
|
import javax.sip.ObjectInUseException; |
||||
|
import javax.sip.SipProvider; |
||||
|
import java.util.Iterator; |
||||
|
|
||||
|
@CrossOrigin |
||||
|
@RestController |
||||
|
@RequestMapping("/api/server") |
||||
|
public class ServerController { |
||||
|
|
||||
|
@Autowired |
||||
|
private ConfigurableApplicationContext context; |
||||
|
|
||||
|
|
||||
|
@RequestMapping(value = "/restart") |
||||
|
@ResponseBody |
||||
|
public Object restart(){ |
||||
|
Thread restartThread = new Thread(new Runnable() { |
||||
|
@Override |
||||
|
public void run() { |
||||
|
try { |
||||
|
Thread.sleep(3000); |
||||
|
SipProvider up = (SipProvider) SpringBeanFactory.getBean("udpSipProvider"); |
||||
|
SipStackImpl stack = (SipStackImpl)up.getSipStack(); |
||||
|
stack.stop(); |
||||
|
Iterator listener = stack.getListeningPoints(); |
||||
|
while (listener.hasNext()) { |
||||
|
stack.deleteListeningPoint((ListeningPoint) listener.next()); |
||||
|
} |
||||
|
Iterator providers = stack.getSipProviders(); |
||||
|
while (providers.hasNext()) { |
||||
|
stack.deleteSipProvider((SipProvider) providers.next()); |
||||
|
} |
||||
|
VManageBootstrap.restart(); |
||||
|
} catch (InterruptedException ignored) { |
||||
|
} catch (ObjectInUseException e) { |
||||
|
e.printStackTrace(); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
restartThread.setDaemon(false); |
||||
|
restartThread.start(); |
||||
|
return "success"; |
||||
|
} |
||||
|
} |
Binary file not shown.
Loading…
Reference in new issue