public static void init(WebApplication application) {
   application.getComponentPreOnBeforeRenderListeners().add(PRE_ON_BEFORE_RENDER_LISTENER);
   application.getComponentPostOnBeforeRenderListeners().add(POST_ON_BEFORE_RENDER_LISTENER);
   application.getComponentOnAfterRenderListeners().add(ON_AFTER_RENDER_LISTENER);
   application.getAjaxRequestTargetListeners().add(AJAX_LISTENER);
   FormProcessedListener.init(application);
 }
예제 #2
0
 /** @see org.apache.wicket.jmx.RequestLoggerMBean#restart() */
 @Override
 public void restart() throws IOException {
   if (webApplication != null) {
     webApplication.getRequestLoggerSettings().setRequestLoggerEnabled(false);
     webApplication.getRequestLogger();
     webApplication.getRequestLoggerSettings().setRequestLoggerEnabled(true);
   }
 }
예제 #3
0
 @Override
 public void process(IFormSubmitter component) {
   final WebRequest request = (WebRequest) RequestCycle.get().getRequest();
   if (request.isAjax() && RequestCycle.get().find(AjaxRequestTarget.class) == null) {
     WebApplication app = (WebApplication) getComponent().getApplication();
     AjaxRequestTarget target = app.newAjaxRequestTarget(getComponent().getPage());
     RequestCycle.get().scheduleRequestHandlerAfterCurrent(target);
   }
   super.process(component);
 }
 /**
  * Inits the application configuration for global, development and deployment.
  *
  * @see org.apache.wicket.Application#init()
  */
 @Override
 public final void init() {
   this.startupDate = new DateTime();
   super.init();
   // set application configuration...
   onApplicationConfigurations();
 }
  @Override
  protected void init() {
    super.init();
    configureBootstrap();

    initSpring();

    // customized auth strategy
    getSecuritySettings().setAuthorizationStrategy(new SimpleUserAuthorizationStrategy());

    // don't throw exceptions for missing translations
    getResourceSettings().setThrowExceptionOnMissingResource(false);

    // enable ajax debug etc.
    getDebugSettings().setDevelopmentUtilitiesEnabled(true);

    new AnnotatedMountScanner().scanPackage("de.atomfrede.mate.application.*").mount(this);

    setRootRequestMapper(
        new HttpsMapper(getRootRequestMapper(), new HttpsConfig(8080, 8443)) {

          @Override
          protected Scheme getDesiredSchemeFor(Class pageClass) {
            if (getConfigurationType() == RuntimeConfigurationType.DEVELOPMENT) {
              return Scheme.HTTP;
            } else {
              return Scheme.HTTPS;
            }
          }
        });

    // addDummyUsers();
  }
  @Override
  public void init() {
    super.init();
    eventBus = new EventBus(this);
    eventBus.addRegistrationListener(
        new ResourceRegistrationListener() {

          @Override
          public void resourceUnregistered(String uuid) {
            System.out.println("Unregistered " + uuid);
          }

          @Override
          public void resourceRegistered(String uuid, Page page) {
            System.out.println("Registered " + uuid);
          }
        });

    ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
    final Runnable beeper =
        new Runnable() {
          @Override
          public void run() {
            try {
              eventBus.post(new Date());
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        };
    scheduler.scheduleWithFixedDelay(beeper, 2, 2, TimeUnit.SECONDS);
  }
예제 #7
0
  @Override
  protected void init() {
    super.init();
    addComponentInstantiationListener(new SpringComponentInjector(this));

    mountBookmarkablePage("home", HomePage.class);
  }
  /** @see org.apache.wicket.Application#init() */
  @Override
  public void init() {
    super.init();
    ClientSideLoggingSettings.install(this);

    // add your configuration here
  }
예제 #9
0
  /** @see org.apache.wicket.Application#init() */
  @Override
  public void init() {
    super.init();

    // レスポンスのエンコーディング設定
    getRequestCycleSettings().setResponseRequestEncoding("UTF-8");
  }
  /**
   * Initializes the application; in particular, bootstrapping the Isis backend, and initializing
   * the {@link ComponentFactoryRegistry} to be used for rendering.
   */
  @Override
  protected void init() {
    super.init();

    // 6.0.0 rather than overriding getRequestCycleSettings
    // TODO: reinstate REDIRECT_TO_RENDER once WICKET-4773 implemented (Wicket 6.1.0)
    getRequestCycleSettings().setRenderStrategy(RenderStrategy.REDIRECT_TO_BUFFER);
    // 6.0.0 instead of subclassing newRequestCycle
    getRequestCycleListeners().add(new WebRequestCycleForIsis());

    getResourceSettings().setParentFolderPlaceholder("$up$");
    final DeploymentType deploymentType = determineDeploymentType();

    final IsisConfigurationBuilder isisConfigurationBuilder =
        createConfigBuilder(getServletContext());

    final IsisInjectModule isisModule =
        new IsisInjectModule(deploymentType, isisConfigurationBuilder);
    final Injector injector = Guice.createInjector(isisModule, newIsisWicketModule());
    injector.injectMembers(this);

    this.bookmarkedPagesModel = new BookmarkedPagesModel();

    initWicketComponentInjection(injector);
  }
예제 #11
0
 @Override
 public void init() {
   super.init();
   mountPage("/login", LoginPage.class);
   mountPage("/callback", OAuthCallbackPage.class);
   mountPage("/start", StartPage.class);
   mountPage("/result", ResultPage.class);
 }
 @Override
 public void init(WebApplication webApplication) {
   HtmlCompressor compressor = new HtmlCompressor();
   setFeatureConfiguration(compressor);
   webApplication
       .getMarkupSettings()
       .setMarkupFactory(new HtmlCompressingMarkupFactory(compressor));
 }
예제 #13
0
  /** @see org.apache.wicket.Application#init() */
  @Override
  public void init() {
    super.init();

    WebjarsSettings settings = new WebjarsSettings();
    settings.useCdnResources(true);

    WicketWebjars.install(this, settings);
  }
예제 #14
0
  /** {@inheritDoc} */
  public void mountPages(final WebApplication webApplication) {

    final Logger log = ShopCodeContext.getLog(this);

    for (Map.Entry<String, Map<String, Class<IRequestablePage>>> pageMappingEntry :
        pageMapping.entrySet()) {
      final String url = pageMappingEntry.getKey();
      final Map<String, Class<IRequestablePage>> pages = pageMappingEntry.getValue();
      final ClassProvider classProvider;
      if (pages.size() == 1) {
        // there is only default mapping for this url
        classProvider = ClassProvider.of(pages.entrySet().iterator().next().getValue());
        if (log.isInfoEnabled()) {
          log.info("Mounting url '{}' to page '{}'", url, classProvider.get().getCanonicalName());
        }
      } else {
        // more than one mapping - need a theme dependent class provider
        classProvider = new ThemePageProvider(pages);
        if (log.isInfoEnabled()) {
          log.info("Mounting url '{}' to pages:", url);
          for (final Map.Entry<String, Class<IRequestablePage>> entry : pages.entrySet()) {
            log.info("theme: '{}', page: '{}'", entry.getKey(), entry.getValue());
          }
        }
      }
      if (encoderEnabledUrls.contains(url)) {
        webApplication.mount(new MountedMapper(url, classProvider, encoder));
      } else {
        webApplication.mount(new MountedMapper(url, classProvider));
      }
      if (loginUrl.equals(url)) {
        loginPage = classProvider;
        if (log.isInfoEnabled()) {
          log.info("This is a login url");
        }
      } else if ("/".equals(url)) {
        homePage = classProvider;
        if (log.isInfoEnabled()) {
          log.info("This is a home url");
        }
      }
    }
  }
예제 #15
0
  /** @see org.apache.wicket.Application#init() */
  @Override
  public void init() {
    super.init();

    if (RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) {
      getDebugSettings().setAjaxDebugModeEnabled(true);
      getDebugSettings().setDevelopmentUtilitiesEnabled(true);
    }
    // add your configuration here
    // TODO - create profilers filesystem
  }
예제 #16
0
  @Override
  public void init() {
    super.init();

    // markup settings
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setDefaultMarkupEncoding("UTF-8");

    // exception settings
    getResourceSettings().setThrowExceptionOnMissingResource(false);
  }
  /*
   * (non-Javadoc)
   *
   * @see org.apache.wicket.protocol.http.WebApplication#init() ページのブックマーク?
   */
  @Override
  protected void init() {
    super.init();
    getRequestCycleSettings().setResponseRequestEncoding("UTF-8");
    getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
    getMarkupSettings().setStripWicketTags(true); // wicket:idタグを消すための設定

    mountBookmarkablePage("/login", LoginPage.class);
    mountBookmarkablePage("/filelist", FileListPage.class);
    mountBookmarkablePage("/uploader", UploadPage.class);
  }
예제 #18
0
  @Override
  protected void internalInit() {
    super.internalInit();

    // set page and session store providers
    setSessionStoreProvider(MockSessionStore::new);
    setPageManagerProvider((pageManagerContext) -> new MockPageManager());

    // for test cases we usually want stable resource names
    getResourceSettings().setCachingStrategy(NoOpResourceCachingStrategy.INSTANCE);
  }
  @Override
  public void init() {
    LOG.info("Init");

    super.init();

    getDebugSettings().setDevelopmentUtilitiesEnabled(true);

    getRequestLoggerSettings().setRequestLoggerEnabled(true);

    getMarkupSettings().setCompressWhitespace(false);
    getMarkupSettings().setStripWicketTags(true);

    getComponentInstantiationListeners().add(new SpringComponentInjector(this));
  }
  @Override
  protected void init() {
    //		System.setProperty("file.encoding", "UTF-8");

    // TODO Auto-generated method stub
    super.init();
    String path = getServletContext().getRealPath("/");

    getMarkupSettings().setDefaultMarkupEncoding("UTF-8");
    getRequestCycleSettings().setResponseRequestEncoding("UTF-8");

    IApplicationSettings settings = getApplicationSettings();
    // settings.setAccessDeniedPage(CheesrAccessDeniedPage.class);
    settings.setPageExpiredErrorPage(PageExpiration.class);
    // settings.setInternalErrorPage(CheesrInternalErrorPage.class);
  }
  protected void init() {
    super.init();

    // Configure general Wicket application settings
    addComponentInstantiationListener(new SpringComponentInjector(this));
    getResourceSettings().setThrowExceptionOnMissingResource(false);
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(MyProfile.class);
    getApplicationSettings().setAccessDeniedPage(MyProfile.class);

    // Custom resource loader since our properties are not in the default location
    getResourceSettings().addStringResourceLoader(new ProfileStringResourceLoader());
  }
예제 #22
0
  @Override
  protected void init() {
    super.init();

    // Enable CDI
    BeanManager bm;
    try {
      bm = (BeanManager) new InitialContext().lookup("java:comp/BeanManager");
    } catch (NamingException e) {
      throw new IllegalStateException("Unable to obtain CDI BeanManager", e);
    }

    // Configure CDI, disabling Conversations as we aren't using them
    new CdiConfiguration(bm).setPropagation(NONE).configure(this);

    // Mount the InsertContact page at /insert
    mountPage("/insert", InsertContact.class);
  }
예제 #23
0
  protected void init() {
    super.init();

    // Configure general wicket application settings
    addComponentInstantiationListener(new SpringComponentInjector(this));
    getResourceSettings().setThrowExceptionOnMissingResource(true);
    getMarkupSettings().setStripWicketTags(true);
    getDebugSettings()
        .setAjaxDebugModeEnabled(
            ServerConfigurationService.getBoolean("feeds.ajaxDebugEnabled", false));

    // Home page
    mountBookmarkablePage("/home", MainPage.class);

    // On wicket session timeout or wicket exception, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(MainPage.class);
    getApplicationSettings().setInternalErrorPage(MainPage.class);

    // show internal error page rather than default developer page
    getExceptionSettings()
        .setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
  }
 @Override
 public void init(WebApplication webApplication) {
   if (properties.isEnableLiveSessionsPage()) {
     webApplication.mountPage(properties.getLiveSessionPageMount(), LiveSessionsPage.class);
   }
 }
예제 #25
0
  @Override
  public void init() {

    super.init();
    mountPage("/user", getHomePage());
  }
예제 #26
0
 private void init() {
   add(new BookmarkablePageLink<Void>("homeLink", WebApplication.get().getHomePage()));
   add(new Label("title", Model.of(getClass().getSimpleName())));
   add(new TestPageLinksPanel("links"));
   add(new FeedbackPanel("feedback"));
 }
 @Override
 protected void init() {
   super.init();
   mountPage("initiallymounted", InitiallyMountedPage.class);
 }
 /** Convenience locator, downcasts inherited functionality. */
 public static IsisWicketUnsecuredApplication get() {
   return (IsisWicketUnsecuredApplication) WebApplication.get();
 }
예제 #29
0
  @Override
  protected void init() {
    super.init();

    addComponentInstantiationListener(new GuiceComponentInjector(this, new RumorModule()));
  }
 @Override
 public void respond(IRequestCycle requestCycle) {
   Page page = (Page) Application.get().getMapperContext().getPageInstance(pageKey.getPageId());
   AjaxRequestTarget target = WebApplication.get().newAjaxRequestTarget(page);
   executeHandlers(target, page);
 }