Example usage for org.apache.wicket.devutils.inspector RenderPerformanceListener RenderPerformanceListener

List of usage examples for org.apache.wicket.devutils.inspector RenderPerformanceListener RenderPerformanceListener

Introduction

In this page you can find the example usage for org.apache.wicket.devutils.inspector RenderPerformanceListener RenderPerformanceListener.

Prototype

RenderPerformanceListener

Source Link

Usage

From source file:de.inren.frontend.application.InRenApplication.java

License:Apache License

@Override
public void init() {
    super.init();

    /* Spring injection. */
    this.getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    /* Performance measurement */
    if (false) {// w  w  w. j a  v a 2s. c  o m
        getComponentInstantiationListeners().add(new RenderPerformanceListener());
    }

    configureBootstrap();

    initializeServices();

    getSecuritySettings().setAuthorizationStrategy(new MetaDataRoleAuthorizationStrategy(this));

    initializeFailSafeLocalize();
    new AnnotatedMountScanner().scanPackage("de.inren").mount(this);

    mountResource("/" + PictureResource.PICTURE_RESOURCE + "/${" + PictureResource.ID + "}/${"
            + PictureResource.SIZE + "}", PictureResource.asReference());

    // Access to Images by url
    // mount(createImageURIRequestTargetUrlCodingStrategy());
    // mount(createLayoutURIRequestTargetUrlCodingStrategy());
    // mount(createThumbnailURIRequestTargetUrlCodingStrategy());

    // Render hints in html to navigate from firebug to eclipse
    // WicketSource.configure(this);

    // TODO gehrt ins codeflower package. => Init fr Wicket
    // module/packages machen.
    final IPackageResourceGuard packageResourceGuard = getResourceSettings().getPackageResourceGuard();
    if (packageResourceGuard instanceof SecurePackageResourceGuard) {
        ((SecurePackageResourceGuard) packageResourceGuard).addPattern("+*.json");
        ((SecurePackageResourceGuard) packageResourceGuard).addPattern("+**.ttf");
    }

    /** for ajax progressbar on upload */
    getApplicationSettings().setUploadProgressUpdatesEnabled(true);

    // I don't like messy html code.
    this.getMarkupSettings().setStripWicketTags(true);
    this.getMarkupSettings().setStripComments(true);

    // This application can be reached from internet, but you must know the
    // right port.
    // So I like to know who else besides me tries to connect.

    getRequestCycleListeners().add(new AbstractRequestCycleListener() {
        @Override
        public void onBeginRequest(RequestCycle cycle) {
            WebClientInfo ci = new WebClientInfo(cycle);
            log.debug("Request info: " + ci.getProperties().getRemoteAddress() + ", "
                    + ("".equals(DnsUtil.lookup(ci.getProperties().getRemoteAddress())) ? ""
                            : DnsUtil.lookup(ci.getProperties().getRemoteAddress()) + ", ")
                    + (cycle.getRequest().getUrl().getPath() == null
                            || "".equals(cycle.getRequest().getUrl().getPath()) ? ""
                                    : cycle.getRequest().getUrl().getPath() + ", ")
                    + ci.getUserAgent());
        }
    });

    getSecuritySettings().setAuthorizationStrategy(new InRenAuthorizationStrategy());

    // MetaDataRoleAuthorizationStrategy.authorize(AdminOnlyPage.class,
    // Roles.ADMIN);
    // mountPage("admin", AdminOnlyPage.class);

    // TODO das funzzt nur auf Class

    // LIST<COMPONENTACCESS> COMPONENTACCESS =
    // COMPONENTACCESSSERVICE.GETCOMPONENTACCESSLIST();
    // FOR (COMPONENTACCESS CA : COMPONENTACCESS) {
    // COLLECTION<ROLE> ROLES = CA.GETGRANTEDROLES();
    // STRINGBUFFER ROLESTRING = NEW STRINGBUFFER();
    // FOR (ROLE ROLE : ROLES) {
    // ROLESTRING.APPEND(ROLE);
    // }
    // METADATAROLEAUTHORIZATIONSTRATEGY.AUTHORIZE(CA.GETNAME(),
    // ROLESTRING.TOSTRING());
    // }
}