Examples of CWConfig


Examples of com.planet_ink.coffee_web.util.CWConfig

 
 
  @Test
  public void testExecutor()
  {
    CWConfig config=new CWConfig();
    config.setLogger(Log.instance());
    CWThreadExecutor executor = new CWThreadExecutor("test", config, 1, 10, 1000, TimeUnit.SECONDS, 10, 500);
    final LinkedList<Integer> todo=new LinkedList<Integer>();
    int total=0;
    final int numObjects=500;
    for(int i=1;i<=numObjects;i++)
View Full Code Here

Examples of com.planet_ink.coffee_web.util.CWConfig

  }

  @Test
  public void requestStatsTester()
  {
    CWConfig config=new CWConfig();
    config.setLogger(Log.instance());
    CWThreadExecutor executor = new CWThreadExecutor("test", config, 1, 5, 100, TimeUnit.SECONDS, 10, 500);
    final RequestStats stats = new RequestStats();
    int numRequests=500;
    for(int i=0;i<numRequests;i++)
    {
View Full Code Here

Examples of com.planet_ink.coffee_web.util.CWConfig

   * @return a standard issue exception
   */
  public static final HTTPException standardException(final HTTPStatus status)
  {
    Map<CWConfig,HTTPException> xMap=factoryExceptions.get(status);
    final CWConfig config = ((CWThread)Thread.currentThread()).getConfig();
    if(xMap != null)
    {
      if((config != null)&&(xMap.containsKey(config)))
        return xMap.get(config);
    }
View Full Code Here

Examples of com.planet_ink.coffee_web.util.CWConfig

   * @param iniInputStream the ini data to load further settings from
   * @return a populated configuration object to create a server from
   */
  public static CWConfig createConfig(java.util.logging.Logger log, InputStream iniInputStream) throws IOException
  {
    final CWConfig config=new CWConfig();
    return initConfig(config,log,iniInputStream);
  }
View Full Code Here

Examples of com.planet_ink.coffee_web.util.CWConfig

    {
      if(arg.startsWith("BOOT="))
        iniFilename=arg.substring(5);
    }
   
    CWConfig config;
    try
    {
      config=WebServer.createConfig(Log.instance(), new FileInputStream(iniFilename));
    }
    catch (final Exception e)
    {
      e.printStackTrace();
      System.exit(-1);
      return; // an unhit operation, but my ide is argueing with me over it.
    }
   
    debug=config.getDebugFlag();
   
    for(final String arg : args)
    {
      if(arg.equalsIgnoreCase("DEBUG"))
      {
        debug="BOTH";
        config.setDebugFlag(debug);
      }
    }
    Log.instance().configureLog(Log.Type.info, "BOTH");
    Log.instance().configureLog(Log.Type.error, "BOTH");
    Log.instance().configureLog(Log.Type.warning, "BOTH");
    Log.instance().configureLog(Log.Type.debug, debug);
    Log.instance().configureLog(Log.Type.access, config.getAccessLogFlag());
    config.getLogger().info("Starting "+NAME+" "+VERSION);
   
    final WebServer server = new WebServer("server", config);
    config.setCoffeeWebServer(server);
    final Thread t = new CWThread(config, server, NAME);
    t.start();
    try
    {
      t.join();
View Full Code Here

Examples of com.planet_ink.coffee_web.util.CWConfig

    {
      response.setMimeType(MIMEType.html.getType());
      response.getOutputStream().write("<html><body>".getBytes());
      if(Thread.currentThread() instanceof CWThread)
      {
        final CWConfig config=((CWThread)Thread.currentThread()).getConfig();
        response.getOutputStream().write("<table width=\"500\"><tr><td><b>Field</b></td><td>Value</td></tr>".getBytes());
        response.getOutputStream().write(("<tr><td>Bind address</td><td>"+config.getBindAddress()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Debug flag</td><td>"+config.getDebugFlag()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Default page</td><td>"+config.getDefaultPage()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Error page</td><td>"+config.getErrorPage()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Browse page</td><td>"+config.getBrowsePage()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>File cache expire ms</td><td>"+config.getFileCacheExpireMs()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>File cache max bytes</td><td>"+config.getFileCacheMaxBytes()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>File cache max file bytes</td><td>"+config.getFileCacheMaxFileBytes()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>File compression max bytes</td><td>"+config.getFileCompMaxFileBytes()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Thread core pool size</td><td>"+config.getCoreThreadPoolSize()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Thread max idle ms</td><td>"+config.getMaxThreadIdleMs()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Thread max pool size</td><td>"+config.getMaxThreadPoolSize()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Thread max queue size</td><td>"+config.getMaxThreadQueueSize()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Thread max timeout secs</td><td>"+config.getMaxThreadTimeoutSecs()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Request line buf size</td><td>"+config.getRequestLineBufBytes()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Request max alive secs</td><td>"+config.getRequestMaxAliveSecs()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Request max body size bytes</td><td>"+config.getRequestMaxBodyBytes()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>Request max idle ms</td><td>"+config.getRequestMaxIdleMs()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>SSL Key Encoding</td><td>"+config.getSslKeyManagerEncoding()+"</td></tr>").getBytes());
        //response.getOutputStream().write(("<tr><td> </td><td>"+config.getSslKeystorePassword()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>SSL Key path</td><td>"+config.getSslKeystorePath()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>SSL Keystore type</td><td>"+config.getSslKeystoreType()+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>HTTP ports</td><td>"+Arrays.toString(config.getHttpListenPorts())+"</td></tr>").getBytes());
        response.getOutputStream().write(("<tr><td>HTTPS ports</td><td>"+Arrays.toString(config.getHttpsListenPorts())+"</td></tr>").getBytes());
        response.getOutputStream().write("</table>".getBytes());
      }
      response.getOutputStream().write("</body></html>".getBytes());
    }
    catch (final IOException e)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.