class GetQiniuUploadTokenHandler extends IMHandler<Byte> {
    @Override
    public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, Byte request, Qos1PublishHandler.IMCallback callback) {<FILL_FUNCTION_BODY>}
}

        int type = request;
        String token;

        WFCMessage.GetUploadTokenResult.Builder resultBuilder = WFCMessage.GetUploadTokenResult.newBuilder();

        if (MediaServerConfig.USER_QINIU) {
            Auth auth = Auth.create(MediaServerConfig.QINIU_ACCESS_KEY, MediaServerConfig.QINIU_SECRET_KEY);

//#Media_Type_GENERAL = 0,
//#Media_Type_IMAGE = 1,
//#Media_Type_VOICE = 2,
//#Media_Type_VIDEO = 3,
//#Media_Type_FILE = 4,
//#Media_Type_PORTRAIT = 5,
//#Media_Type_FAVORITE = 6

            String bucketName;
            String bucketDomain;
            switch (type) {
                case 0:
                    bucketName = MediaServerConfig.QINIU_BUCKET_GENERAL_NAME;
                    bucketDomain = MediaServerConfig.QINIU_BUCKET_GENERAL_DOMAIN;
                    break;
                case 1:
                    bucketName = MediaServerConfig.QINIU_BUCKET_IMAGE_NAME;
                    bucketDomain = MediaServerConfig.QINIU_BUCKET_IMAGE_DOMAIN;
                    break;
                case 2:
                    bucketName = MediaServerConfig.QINIU_BUCKET_VOICE_NAME;
                    bucketDomain = MediaServerConfig.QINIU_BUCKET_VOICE_DOMAIN;
                    break;
                case 3:
                    bucketName = MediaServerConfig.QINIU_BUCKET_VIDEO_NAME;
                    bucketDomain = MediaServerConfig.QINIU_BUCKET_VIDEO_DOMAIN;
                    break;
                case 4:
                    bucketName = MediaServerConfig.QINIU_BUCKET_FILE_NAME;
                    bucketDomain = MediaServerConfig.QINIU_BUCKET_FILE_DOMAIN;
                    break;
                case 5:
                    bucketName = MediaServerConfig.QINIU_BUCKET_PORTRAIT_NAME;
                    bucketDomain = MediaServerConfig.QINIU_BUCKET_PORTRAIT_DOMAIN;
                    break;
                case 6:
                    bucketName = MediaServerConfig.QINIU_BUCKET_FAVORITE_NAME;
                    bucketDomain = MediaServerConfig.QINIU_BUCKET_FAVORITE_DOMAIN;
                    break;
                case 7:
                    bucketName = MediaServerConfig.QINIU_BUCKET_STICKER_NAME;
                    bucketDomain = MediaServerConfig.QINIU_BUCKET_STICKER_DOMAIN;
                    break;
                case 8:
                     bucketName = MediaServerConfig.QINIU_BUCKET_MOMENTS_NAME;
                     bucketDomain = MediaServerConfig.QINIU_BUCKET_MOMENTS_DOMAIN;
                     break;
                default:
                    bucketName = MediaServerConfig.QINIU_BUCKET_GENERAL_NAME;
                    bucketDomain = MediaServerConfig.QINIU_BUCKET_GENERAL_DOMAIN;
                    break;
            }

            token = auth.uploadToken(bucketName);
            resultBuilder.setDomain(bucketDomain)
                .setServer(MediaServerConfig.QINIU_SERVER_URL);
            resultBuilder.setPort(80);
        } else {
            token = UploadFileAction.getToken(type);
            resultBuilder.setDomain("http://" + MediaServerConfig.SERVER_IP + ":" + MediaServerConfig.HTTP_SERVER_PORT)
                .setServer(MediaServerConfig.SERVER_IP);
            resultBuilder.setPort(MediaServerConfig.HTTP_SERVER_PORT);
        }

        resultBuilder.setToken(token);

        byte[] data = resultBuilder.buildPartial().toByteArray();
        ackPayload.ensureWritable(data.length).writeBytes(data);
        return ErrorCode.ERROR_CODE_SUCCESS;
    
<methods>public void <init>() ,public abstract cn.wildfirechat.common.ErrorCode action(ByteBuf, java.lang.String, java.lang.String, cn.wildfirechat.proto.ProtoConstants.RequestSourceType, java.lang.Byte, io.moquette.spi.impl.Qos1PublishHandler.IMCallback) ,public void afterAction(java.lang.String, java.lang.String, java.lang.String, io.moquette.spi.impl.Qos1PublishHandler.IMCallback) ,public void doHandler(java.lang.String, java.lang.String, java.lang.String, byte[], io.moquette.spi.impl.Qos1PublishHandler.IMCallback, cn.wildfirechat.proto.ProtoConstants.RequestSourceType) ,public static io.moquette.spi.impl.MessagesPublisher getPublisher() ,public static void init(io.moquette.spi.IMessagesStore, io.moquette.spi.ISessionsStore, io.moquette.spi.impl.MessagesPublisher, cn.wildfirechat.server.ThreadPoolExecutorWrapper, io.moquette.server.Server) ,public cn.wildfirechat.common.ErrorCode preAction(java.lang.String, java.lang.String, java.lang.String, io.moquette.spi.impl.Qos1PublishHandler.IMCallback, cn.wildfirechat.proto.ProtoConstants.RequestSourceType) <variables>protected static final Logger LOG,protected static java.lang.String actionName,private Class#RAW dataCls,private static win.liyufan.im.RateLimiter mLimitCounter,protected static io.moquette.server.Server mServer,private static cn.wildfirechat.server.ThreadPoolExecutorWrapper m_imBusinessExecutor,protected static io.moquette.spi.IMessagesStore m_messagesStore,protected static io.moquette.spi.ISessionsStore m_sessionsStore,private java.lang.reflect.Method parseDataMethod,protected static io.moquette.spi.impl.MessagesPublisher publisher