Search in sources :

Example 1 with HttpRequestService

use of com.akaxin.site.business.service.HttpRequestService in project openzaly by akaxincom.

the class HttpRequestHandler method handle.

@Override
public CommandResponse handle(Command command) {
    try {
        ChannelHandlerContext context = command.getChannelContext();
        if (context == null) {
            logger.error("{} client={} http request error context={}", AkxProject.PLN, command.getClientIp(), context);
            return null;
        }
        CommandResponse comamndResponse = new HttpRequestService().process(command);
        comamndResponse.setVersion(CommandConst.PROTOCOL_VERSION);
        comamndResponse.setAction(CommandConst.ACTION_RES);
        String authKey = command.getField(PluginConst.PLUGIN_AUTH_KEY, String.class);
        fullHttpResponse(context, comamndResponse, authKey);
        return comamndResponse;
    } catch (Exception e) {
        logger.error("api request error.", e);
    }
    return null;
}
Also used : HttpRequestService(com.akaxin.site.business.service.HttpRequestService) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) CommandResponse(com.akaxin.common.command.CommandResponse)

Aggregations

CommandResponse (com.akaxin.common.command.CommandResponse)1 HttpRequestService (com.akaxin.site.business.service.HttpRequestService)1 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)1