Пример #1
0
  @Override
  public void contextInitialized(ServletContextEvent sce) {
    try {
      final ServletContext context = sce.getServletContext();
      System.out.println("Servlet context initialized...");

      if (context == null) {
        throw new RuntimeException("Failed to initialize context. Visallo is not running.");
      }
      VisalloLoggerFactory.setProcessType("web");

      final Configuration config =
          ConfigurationLoader.load(
              context.getInitParameter(APP_CONFIG_LOADER), getInitParametersAsMap(context));
      config.setDefaults(WebConfiguration.DEFAULTS);
      LOGGER = VisalloLoggerFactory.getLogger(ApplicationBootstrap.class);
      LOGGER.info("Running application with configuration:\n%s", config);

      setupInjector(context, config);
      verifyGraphVersion();
      setupGraphAuthorizations();
      setupWebApp(context, config);

      Iterable<ApplicationBootstrapInitializer> initializers =
          ServiceLoaderUtil.load(ApplicationBootstrapInitializer.class, config);
      for (ApplicationBootstrapInitializer initializer : initializers) {
        initializer.initialize();
      }
    } catch (Throwable ex) {
      LOGGER.error("Could not startup context", ex);
      throw new VisalloException("Could not startup context", ex);
    }
  }
Пример #2
0
  private void addSecurityConstraint(
      ServletRegistration.Dynamic servletRegistration, Configuration config) {
    ServletSecurity.TransportGuarantee transportGuarantee =
        ServletSecurity.TransportGuarantee.CONFIDENTIAL;
    String constraintType = config.get(CONFIG_HTTP_TRANSPORT_GUARANTEE, null);
    if (constraintType != null) {
      transportGuarantee = ServletSecurity.TransportGuarantee.valueOf(constraintType);
    }

    HttpConstraintElement httpConstraintElement = new HttpConstraintElement(transportGuarantee);
    ServletSecurityElement securityElement = new ServletSecurityElement(httpConstraintElement);
    servletRegistration.setServletSecurity(securityElement);
  }
Пример #3
0
 @Inject
 public VertexDeleteProperty(
     final Graph graph,
     final WorkspaceHelper workspaceHelper,
     final OntologyRepository ontologyRepository,
     final ACLProvider aclProvider,
     final Configuration configuration) {
   this.graph = graph;
   this.workspaceHelper = workspaceHelper;
   this.ontologyRepository = ontologyRepository;
   this.aclProvider = aclProvider;
   this.autoPublishComments =
       configuration.getBoolean(
           Configuration.COMMENTS_AUTO_PUBLISH, Configuration.DEFAULT_COMMENTS_AUTO_PUBLISH);
 }