@Override
  public void configureComponent(Configuration configuration) {
    super.configureComponent(configuration);

    Activity activity = getComponentContext().getActivity();

    webSocketUriPrefix =
        configuration.getPropertyString(CONFIGURATION_WEBAPP_WEB_SERVER_WEBSOCKET_URI);

    webServerPort =
        configuration.getPropertyInteger(
            CONFIGURATION_WEBAPP_WEB_SERVER_PORT, WEB_SERVER_PORT_DEFAULT);
    WebServerService webServerService =
        activity
            .getSpaceEnvironment()
            .getServiceRegistry()
            .getService(WebServerService.SERVICE_NAME);
    webServer =
        webServerService.newWebServer(
            String.format("%sWebServer", activity.getName()), webServerPort, activity.getLog());

    String webServerHost =
        configuration.getPropertyString(
            InteractiveSpacesEnvironment.CONFIGURATION_HOST_ADDRESS, WEB_SERVER_DEFAULT_HOST);

    webContentPath = "/" + activity.getName();
    webContentUrl = "http://" + webServerHost + ":" + webServer.getPort() + webContentPath;

    webInitialPage =
        webContentUrl
            + "/"
            + configuration.getPropertyString(
                BasicWebBrowserActivityComponent.CONFIGURATION_INITIAL_PAGE, DEFAULT_INITIAL_PAGE);

    String contentLocation = configuration.getPropertyString(CONFIGURATION_WEBAPP_CONTENT_LOCATION);
    if (contentLocation != null) {
      webContentBaseDir =
          new File(activity.getActivityFilesystem().getInstallDirectory(), contentLocation);

      webServer.addStaticContentHandler(webContentPath, webContentBaseDir);
    }

    for (StaticContent content : staticContent) {
      webServer.addStaticContentHandler(content.getUriPrefix(), content.getBaseDir());
    }

    for (DynamicContent content : dynamicContent) {
      webServer.addDynamicContentHandler(
          content.getUriPrefix(), content.isUsePath(), content.getRequestHandler());
    }

    if (webSocketHandlerFactory != null) {
      setWebServerWebSocketHandlerFactory();
    }

    if (httpFileUploadListener != null) {
      webServer.setHttpFileUploadListener(httpFileUploadListener);
    }
  }
  @Override
  public WebServerActivityComponent addStaticContent(String uriPrefix, File baseDir) {
    if (webServer != null) {
      webServer.addStaticContentHandler(uriPrefix, baseDir);
    } else {
      staticContent.add(new StaticContent(uriPrefix, baseDir));
    }

    return this;
  }