class YarMessageHandlerWrapper implements HttpMessageHandler {
    public static final String BAD_REQUEST = "/bad-request";
    public static final String ROOT_PATH = "/";
    public static final String STATUS_PATH = "/rpcstatus";
    protected String switcherName = MotanConstants.REGISTRY_HEARTBEAT_SWITCHER;
    private final YarMessageRouter orgHandler;

    public YarMessageHandlerWrapper(MessageHandler orgHandler) {
        if (orgHandler == null) {
            throw new MotanFrameworkException("messageHandler is null!");
        }
        if (orgHandler instanceof YarMessageRouter) {
            this.orgHandler = (YarMessageRouter) orgHandler;
        } else {
            throw new MotanFrameworkException("YarMessageHandlerWrapper can not wrapper " + orgHandler.getClass().getSimpleName());
        }
    }

    @Override
    public FullHttpResponse handle(Channel channel, FullHttpRequest httpRequest) {<FILL_FUNCTION_BODY>}

    /**
     * is service switcher close. http status will be 503 when switcher is close
     */
    private boolean isSwitchOpen() {
        return MotanSwitcherUtil.isOpen(switcherName);
    }
}

        QueryStringDecoder decoder = new QueryStringDecoder(httpRequest.uri());
        String path = decoder.path();

        // check badRequest
        if (BAD_REQUEST.equals(path)) {
            return NettyHttpUtil.buildDefaultResponse("bad request!", HttpResponseStatus.BAD_REQUEST);
        }

        // service status
        if (ROOT_PATH.equals(path) || STATUS_PATH.equals(path)) {
            if (isSwitchOpen()) {// 200
                return NettyHttpUtil.buildDefaultResponse("ok!", HttpResponseStatus.OK);
            }
            //503
            return NettyHttpUtil.buildErrorResponse("service not available!");
        }

        Map<String, String> attachments = null;
        if (!decoder.parameters().isEmpty()) {
            attachments = new HashMap<>(decoder.parameters().size());
            for (Map.Entry<String, List<String>> entry : decoder.parameters().entrySet()) {
                attachments.put(entry.getKey(), entry.getValue().get(0));
            }
        }
        YarResponse yarResponse;
        String packagerName = "JSON";
        try {
            ByteBuf buf = httpRequest.content();
            final byte[] contentBytes = new byte[buf.readableBytes()];
            buf.getBytes(0, contentBytes);
            YarRequest yarRequest = new AttachmentRequest(YarProtocol.buildRequest(contentBytes), attachments);
            yarRequest.setRequestPath(path);
            yarResponse = (YarResponse) orgHandler.handle(channel, yarRequest);
        } catch (Exception e) {
            LoggerUtil.error("YarMessageHandlerWrapper handle yar request fail.", e);
            yarResponse = YarProtocolUtil.buildDefaultErrorResponse(e.getMessage(), packagerName);
        }
        byte[] responseBytes;
        try {
            responseBytes = YarProtocol.toProtocolBytes(yarResponse);
        } catch (IOException e) {
            throw new MotanFrameworkException("convert yar response to bytes fail.", e);
        }
        FullHttpResponse httpResponse =
                new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(responseBytes));
        httpResponse.headers().set(HttpHeaderNames.CONTENT_TYPE, "application/x-www-form-urlencoded");
        httpResponse.headers().set(HttpHeaderNames.CONTENT_LENGTH, httpResponse.content().readableBytes());

        if (HttpUtil.isKeepAlive(httpRequest)) {
            httpResponse.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
        } else {
            httpResponse.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE);
        }
        return httpResponse;
    
<no_super_class>