Search in sources :

Example 1 with VxApiCustomHandlerOptions

use of com.szmirren.vxApi.spi.customHandler.VxApiCustomHandlerOptions in project VX-API-Gateway by EliMirren.

the class VxApiApplication method serverCustomTypeHandler.

/**
 * 自定义服务类型处理器
 *
 * @param isNext
 * @param api
 * @param route
 * @throws Exception
 */
public void serverCustomTypeHandler(boolean isNext, VxApis api, Route route) throws Exception {
    JsonObject body = api.getServerEntrance().getBody();
    VxApiCustomHandlerOptions options = VxApiCustomHandlerOptions.fromJson(body);
    if (options == null) {
        throw new NullPointerException("自定义服务类型的配置文件无法装换为服务类");
    }
    if (body.getValue("isNext") == null) {
        body.put("isNext", isNext);
    }
    options.setOption(body);
    VxApiCustomHandler customHandler = VxApiCustomHandlerFactory.getCustomHandler(options.getInFactoryName(), options.getOption(), api, httpClient);
    route.handler(customHandler);
}
Also used : VxApiCustomHandler(com.szmirren.vxApi.spi.customHandler.VxApiCustomHandler) JsonObject(io.vertx.core.json.JsonObject) VxApiCustomHandlerOptions(com.szmirren.vxApi.spi.customHandler.VxApiCustomHandlerOptions)

Aggregations

VxApiCustomHandler (com.szmirren.vxApi.spi.customHandler.VxApiCustomHandler)1 VxApiCustomHandlerOptions (com.szmirren.vxApi.spi.customHandler.VxApiCustomHandlerOptions)1 JsonObject (io.vertx.core.json.JsonObject)1