package page.misc;


import org.wikiwebserver.core.WareHouse;
import org.wikiwebserver.handler.http.HTTPException;
import org.wikiwebserver.handler.http.interfaces.HTTPResponder;
import page.config.SiteTemplatedPage;
import page.image.Overview;

import static org.wikiwebserver.html.HTMLHelper.*;

public class CoreOverview extends SiteTemplatedPage implements HTTPResponder {
	
    public void generate() throws HTTPException {
        
        setTitle("Core Overview - WikiWebServer");       
        
        Overview overview = new Overview();
        
        String map = overview.getOverviewMap();
        
        String imageUrl = WareHouse.getUrlPathForClass(Overview.class);
        
        // Return the String to be sent to the requested browser
        append(h(1, "HTTP Core Overview") +
               p("WikiWebServer uses 13 classes to implement core" +
               " web serving functionality:") +
               image(imageUrl, "Core overview", "usemap='#overviewImage'") + map +
               p("URL paths map directly to files on the filing system." +
               " Files are returned to the requester from the mapped" +
               " location with the exception of class files implementing the " +
               " HTTPResponder interface, these are executed to generate a " +
               " dynamic response.") +
               h(2, "Examples"));
        
        append(ul(new String[] { 
              "/templates/default/screen.css<br/>" +
              "Returns the file named screen.css directly from the" +
              " filing system at the specified location.",                   
              
              WareHouse.getUrlPathForClass(page.example.HelloWorld.class) + "<br/>" +
              "Triggers the HelloWorld HTTPResponder to generate dynamic" +
              " content.",
              
              "/page/example/HelloWorld.java<br/>" +
              "Returns the Java source code used to create the" +
              " HelloWorld class.",
              
              WareHouse.getUrlPathForClass(page.image.Pie.class) + "?d=1,2,4,8<br/>" +
              "Triggers the Pie HTTPResponder to generate content" +
              " using the parameters, d=1,2,4,8." }));
       
    } 
}

