/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.nplusc.izc.iZpl;

import com.sun.net.httpserver.Headers;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import de.nplusc.izc.iZpl.GUI.PlayListManagingBackend;
import java.io.IOException;
import java.io.OutputStream;

/**
 *
 * @author LH
 */
public class EditorLoader implements HttpHandler
{
    public EditorLoader()
    { 
    }
    
    @Override
    public void handle(HttpExchange t) throws IOException
    {
        PlayListManagingBackend.loadPLEditor();
       String response = "Loaded GUI....";
       t.sendResponseHeaders(200, response.length());
        Headers responseHeaders = t.getResponseHeaders();
        responseHeaders.set("Content-Type", "text/plain");

        OutputStream os = t.getResponseBody();
        os.write(response.getBytes());
        os.flush();
        try
        {
            Thread.sleep(10);
        }
        catch (InterruptedException ex)
        {
            ex.printStackTrace();
        }
        os.close();
    }
    
}