/*
 * @Author: Kane
 * @Date: 2022-12-15 19:40:12
 * @LastEditors: Kane
 * @LastEditTime: 2022-12-16 10:14:54
 * @FilePath: \AdminSys\src\main\java\com\cpic\xim\web\listener\ContextLoaderListener.java
 * @Description: 
 * 
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 */
package com.cpic.xim.web.listener;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import com.fasterxml.jackson.databind.ObjectMapper;

@SuppressWarnings(
{ "unused"})
public class ContextLoaderListener implements ServletContextListener
{
    private static final int BUFFER_SIZE = 1024;
    private static final String CONFIG_FILE_CHARSET = "UTF-8";

    @Override
    public void contextInitialized( ServletContextEvent event )
    {
        ServletContext context = event.getServletContext();

        String configFileLocation = context.getInitParameter( "config_file_location" );

        // loadConfig( configFileLocation );


    }

    private void loadConfig( String configFileLocation )
    {
        ObjectMapper mapper = new ObjectMapper();
        FileInputStream configFile = null;
        InputStreamReader in = null;
        StringBuilder json = null;
        char[] buffer = new char[BUFFER_SIZE];

        try
        {
            configFile = new FileInputStream( configFileLocation );
        }
        catch ( IOException exception )
        {

        }
    }
}
