Example usage for org.apache.wicket.request.cycle PageRequestHandlerTracker PageRequestHandlerTracker

List of usage examples for org.apache.wicket.request.cycle PageRequestHandlerTracker PageRequestHandlerTracker

Introduction

In this page you can find the example usage for org.apache.wicket.request.cycle PageRequestHandlerTracker PageRequestHandlerTracker.

Prototype

PageRequestHandlerTracker

Source Link

Usage

From source file:gr.interamerican.wicket.bo2.protocol.http.Bo2WicketApplication.java

License:Open Source License

@Override
protected void init() {
    super.init();
    getRequestCycleListeners().add(new PageRequestHandlerTracker());
    getRequestCycleListeners().add(new Bo2RequestCycleListener());
}

From source file:net.rrm.ehour.ui.EhourWebApplication.java

License:Open Source License

@Override
public void init() {
    if (!initialized) {
        super.init();
        springInjection();//from   www. j  a va 2s .  com

        setUACHeaderPriority();

        getMarkupSettings().setStripWicketTags(true);
        mountPages();
        mountResources();

        getRequestCycleSettings().setResponseRequestEncoding("UTF-8");
        setupSecurity();

        registerEhourHomeResourceLoader();

        getRequestCycleListeners().add(new PageRequestHandlerTracker());

        cacheStrategy();

        initialized = true;
    }

    if (isInTestMode()) {
        LOGGER.info("*** Running in test mode ***");
        getDebugSettings().setOutputComponentPath(true);
        getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
    }

    if (version != null) { // dont spoil the log during junit tests
        LOGGER.info(String.format("*** %s version %s started!", getAppName(), version));
    }
}

From source file:org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.java

License:Apache License

/**
 * Initializes the application; in particular, bootstrapping the Isis
 * backend, and initializing the {@link ComponentFactoryRegistry} to be used
 * for rendering.//from w  w w  .  ja  v  a  2s .com
 */
@Override
protected void init() {
    try {
        super.init();

        configureWebJars();
        configureWicketBootstrap();
        configureWicketSelect2();

        String isisConfigDir = getServletContext().getInitParameter("isis.config.dir");

        configureLogging(isisConfigDir);

        getRequestCycleSettings().setRenderStrategy(RenderStrategy.REDIRECT_TO_RENDER);

        getResourceSettings().setParentFolderPlaceholder("$up$");

        determineDeploymentTypeIfRequired();

        RequestCycleListenerCollection requestCycleListeners = getRequestCycleListeners();
        IRequestCycleListener requestCycleListenerForIsis = newWebRequestCycleForIsis();
        requestCycleListeners.add(requestCycleListenerForIsis);
        requestCycleListeners.add(new PageRequestHandlerTracker());

        final IsisConfigurationBuilder isisConfigurationBuilder = createConfigBuilder();

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

        if (requestCycleListenerForIsis instanceof WebRequestCycleForIsis) {
            WebRequestCycleForIsis webRequestCycleForIsis = (WebRequestCycleForIsis) requestCycleListenerForIsis;
            webRequestCycleForIsis.setPageClassRegistry(pageClassRegistry);
        }

        final IsisConfiguration configuration = isisConfigurationBuilder.getConfiguration();
        this.getMarkupSettings().setStripWicketTags(determineStripWicketTags(configuration));

        getDebugSettings().setAjaxDebugModeEnabled(determineAjaxDebugModeEnabled(configuration));

        // must be done after injected componentFactoryRegistry into the app itself
        buildCssBundle();

        filterJavascriptContributions();

        configureWicketSourcePluginIfNecessary(configuration);

        // TODO ISIS-987 Either make the API better (no direct access to the map) or use DB records
        int maxEntries = 1000;
        setMetaData(AccountConfirmationMap.KEY, new AccountConfirmationMap(maxEntries, Duration.days(1)));

        mountPages();

        @SuppressWarnings("unused")
        SharedResources sharedResources = getSharedResources();

    } catch (RuntimeException ex) {
        List<MetaModelInvalidException> mmies = locateMetaModelInvalidExceptions(ex);
        if (!mmies.isEmpty()) {
            final MetaModelInvalidException mmie = mmies.get(0);
            log("");
            logBanner();
            log("");
            validationErrors.addAll(mmie.getValidationErrors());
            for (String validationError : validationErrors) {
                logError(validationError);
            }
            log("");
            log("Please inspect the above messages and correct your domain model.");
            log("");
            logBanner();
            log("");
        } else {
            // because Wicket's handling in its WicketFilter (that calls this method) does not log the exception.
            LOG.error("Failed to initialize", ex);
            throw ex;
        }
    }
}

From source file:org.wicketstuff.jeeweb.ajax.JEEWebGlobalAjaxHandler.java

License:Apache License

/**
 * Configures the handler to the given application.
 * //from  w ww.ja  v a  2 s . c  o  m
 * @param application
 *            the application to configure the handler to
 */
public static void configure(WebApplication application) {
    application.getRequestCycleListeners().add(new PageRequestHandlerTracker());
    application.mountResource("/" + JEEWebGlobalAjaxHandler.class.getSimpleName(),
            new JEEWebGlobalAjaxHandler());
    application.getHeaderContributorListeners().add(new IHeaderContributor() {

        private static final long serialVersionUID = 1644041155625458328L;

        @Override
        public void renderHead(IHeaderResponse response) {
            JavaScriptResourceReference forReference = new JavaScriptResourceReference(
                    JEEWebGlobalAjaxHandler.class, JEEWebGlobalAjaxHandler.class.getSimpleName() + ".js") {

                private static final long serialVersionUID = -3649384632770480975L;

                @Override
                public List<HeaderItem> getDependencies() {
                    return new ArrayList<HeaderItem>() {
                        private static final long serialVersionUID = 1L;
                        {

                            add(JavaScriptHeaderItem.forReference(WicketAjaxJQueryResourceReference.get()));
                        }
                    };
                }
            };
            response.render(JavaScriptHeaderItem.forReference(forReference));
            addAJaxBaseUrl(response);
        }

        private void addAJaxBaseUrl(IHeaderResponse response) {
            // render ajax base url. It's required by Wicket Ajax support.
            Url baseUrl = RequestCycle.get().getUrlRenderer().getBaseUrl();
            CharSequence ajaxBaseUrl = Strings.escapeMarkup(baseUrl.toString());
            response.render(JavaScriptHeaderItem.forScript("Wicket.Ajax.baseUrl=\"" + ajaxBaseUrl + "\";",
                    "wicket-ajax-base-url"));

        }
    });
}