All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fastchar.systemtool.FastSystemToolWeb Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
package com.fastchar.systemtool;

import com.fastchar.core.FastEngine;
import com.fastchar.interfaces.IFastWebRun;
import com.fastchar.systemtool.interceptor.FastSystemToolAfterInterceptor;
import com.fastchar.systemtool.provider.*;

/**
 * @author 沈建(Janesen)
 * @date 2021/6/3 15:15
 */
public class FastSystemToolWeb implements IFastWebRun {
    @Override
    public void onInit(FastEngine engine) throws Exception {
        engine.getOverrides()
                .add(FastExceptionProvider.class)
                .add(FastBaseMenuProvider.class)
                .add(FastJobMenuProvider.class);

    }

    @Override
    public void onDestroy(FastEngine engine) throws Exception {

    }

    @Override
    public void onRun(FastEngine engine) throws Exception {
        FastSystemToolConfig config = engine.getConfig(FastSystemToolConfig.class);
        if (config.isLogActionRequest() && config.getLogActionRequestUrlPatterns().size() > 0) {
            engine.getInterceptors()
                    .addAfter(FastSystemToolAfterInterceptor.class,
                            config.getLogActionRequestUrlPatterns().toArray(new String[]{}));
        }
        if (config.isLogSql()) {
            engine.getOverrides()
                    .add(FastSqlListener.class);
        }

        if (config.isLogHttp()) {
            if (engine.getFindClass().test("com.fastchar.http.core.FastHttpRequest")) {
                engine.getOverrides()
                        .add(FastHttpListener.class);
            }
        }

        if (config.isLogSelenium()) {
            if (engine.getFindClass().test("com.fastchar.selenium.FastSeleniumConfig")) {
                engine.getOverrides()
                        .add(FastSeleniumListener.class);
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy