当前位置: 首页>>代码示例>>Java>>正文


Java AbstractRequestCycleListener类代码示例

本文整理汇总了Java中org.apache.wicket.request.cycle.AbstractRequestCycleListener的典型用法代码示例。如果您正苦于以下问题:Java AbstractRequestCycleListener类的具体用法?Java AbstractRequestCycleListener怎么用?Java AbstractRequestCycleListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AbstractRequestCycleListener类属于org.apache.wicket.request.cycle包,在下文中一共展示了AbstractRequestCycleListener类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.apache.wicket.request.cycle.AbstractRequestCycleListener; //导入依赖的package包/类
@Override
protected void init() {
    super.init();

    getRequestCycleListeners().add(new AbstractRequestCycleListener() {
        @Override
        public void onBeginRequest(RequestCycle cycle) {
            super.onBeginRequest(cycle);

            if (cycle.getRequest() instanceof ServletWebRequest) {
                ServletWebRequest req = (ServletWebRequest) cycle.getRequest();
                AttributePrincipal principal = (AttributePrincipal) req.getContainerRequest().getUserPrincipal();
                String user = req.getContainerRequest().getRemoteUser();
                System.out.println("Principal: " + principal);
                System.out.println("Attributes:");
                for (Entry<String, Object> e : principal.getAttributes().entrySet()) {
                    System.out.println(e.getKey() + ":" + e.getValue() + "(" + e.getValue().getClass() + ")");
                }
                System.out.println("Principal Name: " + principal.getName());
                System.out.println("Principal Class: " + principal.getClass());
                System.out.println("Remote User: " + user);
            }
        }
    });
}
 
开发者ID:merzlikinvs,项目名称:cas-playground,代码行数:26,代码来源:ExampleApplication.java

示例2: init

import org.apache.wicket.request.cycle.AbstractRequestCycleListener; //导入依赖的package包/类
/**
 * @see org.apache.wicket.Application#init()
 */
@Override
public void init()
{
	super.init();

	// TODO STEP 7b: uncomment to enable injection of fortress spring beans:
	getComponentInstantiationListeners().add(new SpringComponentInjector(this));

	// Catch runtime exceptions this way:
	getRequestCycleListeners().add( new AbstractRequestCycleListener()
	{
		@Override
		public IRequestHandler onException( RequestCycle cycle, Exception e )
		{
			return new RenderPageRequestHandler( new PageProvider( new ErrorPage( e ) ) );
		}
	} );
	getMarkupSettings().setStripWicketTags(true);

	getRequestCycleSettings().setRenderStrategy( RequestCycleSettings.RenderStrategy.ONE_PASS_RENDER);
}
 
开发者ID:shawnmckinney,项目名称:fortress-saml-demo,代码行数:25,代码来源:WicketApplication.java

示例3: getCache

import org.apache.wicket.request.cycle.AbstractRequestCycleListener; //导入依赖的package包/类
private Map<JCasCacheKey, JCasCacheEntry> getCache()
{
    RequestCycle requestCycle = RequestCycle.get();
    Map<JCasCacheKey, JCasCacheEntry> cache = requestCycle.getMetaData(CACHE);
    if (cache == null) {
        cache = new HashMap<>();
        requestCycle.setMetaData(CACHE, cache);
        requestCycle.getListeners().add(new AbstractRequestCycleListener() {
            @Override
            public void onEndRequest(RequestCycle aCycle)
            {
                Map<JCasCacheKey, JCasCacheEntry> _cache = aCycle.getMetaData(CACHE);
                if (_cache != null) {
                    for (Entry<JCasCacheKey, JCasCacheEntry> entry : _cache.entrySet()) {
                        log.debug("{} - reads: {}  writes: {}", entry.getKey(),
                                entry.getValue().reads, entry.getValue().writes);
                    }
                }
            }
        });
    }
    return cache;
}
 
开发者ID:webanno,项目名称:webanno,代码行数:24,代码来源:CasStorageServiceImpl.java

示例4: init

import org.apache.wicket.request.cycle.AbstractRequestCycleListener; //导入依赖的package包/类
@Override
public void init()
{
    super.init();
    getComponentInstantiationListeners().add( new SpringComponentInjector( this ) );

    // Catch runtime exceptions this way:
    getRequestCycleListeners().add( new AbstractRequestCycleListener()
    {
        @Override
        public IRequestHandler onException( RequestCycle cycle, Exception e )
        {
            return new RenderPageRequestHandler( new PageProvider( new ErrorPage( e ) ) );
        }
    } );
    getMarkupSettings().setStripWicketTags( true );
}
 
开发者ID:apache,项目名称:directory-fortress-commander,代码行数:18,代码来源:ApplicationContext.java

示例5: init

import org.apache.wicket.request.cycle.AbstractRequestCycleListener; //导入依赖的package包/类
/**
 * @see org.apache.wicket.Application#init()
 */
@Override
public void init()
{
	super.init();

	// Enable injection of fortress spring beans:
	getComponentInstantiationListeners().add(new SpringComponentInjector(this));

	// Catch runtime exceptions this way:
	getRequestCycleListeners().add( new AbstractRequestCycleListener()
	{
		@Override
		public IRequestHandler onException( RequestCycle cycle, Exception e )
		{
			return new RenderPageRequestHandler( new PageProvider( new ErrorPage( e ) ) );
		}
	} );
	getMarkupSettings().setStripWicketTags(true);
	getRequestCycleSettings().setRenderStrategy( RequestCycleSettings.RenderStrategy.ONE_PASS_RENDER);
}
 
开发者ID:shawnmckinney,项目名称:role-engineering-sample,代码行数:24,代码来源:WicketApplication.java

示例6: init

import org.apache.wicket.request.cycle.AbstractRequestCycleListener; //导入依赖的package包/类
/**
 * @see org.apache.wicket.Application#init()
 */
@Override
public void init()
{
	super.init();
	// add your configuration here
       getComponentInstantiationListeners().add(new SpringComponentInjector(this));

       // Catch runtime exceptions this way:
       getRequestCycleListeners().add( new AbstractRequestCycleListener()
       {
           @Override
           public IRequestHandler onException( RequestCycle cycle, Exception e )
           {
               return new RenderPageRequestHandler( new PageProvider( new ErrorPage( e ) ) );
           }
       } );

       getMarkupSettings().setStripWicketTags(true);
}
 
开发者ID:shawnmckinney,项目名称:fortressdemo2,代码行数:23,代码来源:WicketApplication.java

示例7: init

import org.apache.wicket.request.cycle.AbstractRequestCycleListener; //导入依赖的package包/类
@Override
protected void init() {
	super.init();

	// Configure general wicket application settings
	getComponentInstantiationListeners().add(new SpringComponentInjector(this));
	getResourceSettings().setThrowExceptionOnMissingResource(false);
	getMarkupSettings().setStripWicketTags(true);
	getResourceSettings().getStringResourceLoaders().add(new SiteStatsStringResourceLoader());
	getResourceSettings().getResourceFinders().add(new WebApplicationPath(getServletContext(), "html"));
	getResourceSettings().setResourceStreamLocator(new SiteStatsResourceStreamLocator());
	getDebugSettings().setAjaxDebugModeEnabled(debug);

	// Home page
	mountPage("/home", OverviewPage.class);
	
	// On wicket session timeout, redirect to main page
	getApplicationSettings().setPageExpiredErrorPage(OverviewPage.class);
	getApplicationSettings().setAccessDeniedPage(OverviewPage.class);

	// Debugging
	debug = ServerConfigurationService.getBoolean("sitestats.debug", false);
	if(debug) {
		getDebugSettings().setComponentUseCheck(true);
		getDebugSettings().setAjaxDebugModeEnabled(true);
	    getDebugSettings().setLinePreciseReportingOnAddComponentEnabled(true);
	    getDebugSettings().setLinePreciseReportingOnNewComponentEnabled(true);
	    getDebugSettings().setOutputComponentPath(true);
	    getDebugSettings().setOutputMarkupContainerClassName(true);
		getDebugSettings().setDevelopmentUtilitiesEnabled(true);
	    getMarkupSettings().setStripWicketTags(false);
		getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_EXCEPTION_PAGE);
		// register standard debug contributors so that just setting the sitestats.debug property is enough to turn these on
		// otherwise, you have to turn wicket development mode on to get this populated due to the order methods are called
		DebugBar.registerContributor(VersionDebugContributor.DEBUG_BAR_CONTRIB, this);
		DebugBar.registerContributor(InspectorDebugPanel.DEBUG_BAR_CONTRIB, this);
		DebugBar.registerContributor(SessionSizeDebugPanel.DEBUG_BAR_CONTRIB, this);
		DebugBar.registerContributor(PageSizeDebugPanel.DEBUG_BAR_CONTRIB, this);
	}
	else
	{
		// Throw RuntimeDeceptions so they are caught by the Sakai ErrorReportHandler
		getRequestCycleListeners().add(new AbstractRequestCycleListener()
		{
			@Override
			public IRequestHandler onException(RequestCycle cycle, Exception ex)
			{
				if (ex instanceof RuntimeException)
				{
					throw (RuntimeException) ex;
				}
				return null;
			}
		});
	}

	// Encrypt URLs. This immediately sets up a session (note that things like CSS now becomes bound to the session)
	getSecuritySettings().setCryptFactory(new KeyInSessionSunJceCryptFactory()); // Different key per user
	final IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this); 
	setRootRequestMapper(cryptoMapper);
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:62,代码来源:SiteStatsApplication.java

示例8: init

import org.apache.wicket.request.cycle.AbstractRequestCycleListener; //导入依赖的package包/类
@Override
public void init() {
	super.init();

	// page mounting for bookmarkable URLs
	mountPage("/grades", GradebookPage.class);
	mountPage("/settings", SettingsPage.class);
	mountPage("/importexport", ImportExportPage.class);
	mountPage("/permissions", PermissionsPage.class);
	mountPage("/gradebook", StudentPage.class);

	// remove the version number from the URL so that browser refreshes re-render the page
	getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER);

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

	// Add ResourceLoader that integrates with Sakai's Resource Loader
	getResourceSettings().getStringResourceLoaders().add(0, new GradebookNgStringResourceLoader());

	// Don't throw an exception if we are missing a property, just fallback
	getResourceSettings().setThrowExceptionOnMissingResource(false);

	// Remove the wicket specific tags from the generated markup
	getMarkupSettings().setStripWicketTags(true);

	// Don't add any extra tags around a disabled link (default is <em></em>)
	getMarkupSettings().setDefaultBeforeDisabledLink(null);
	getMarkupSettings().setDefaultAfterDisabledLink(null);

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

	// show internal error page rather than default developer page
	// for production, set to SHOW_NO_EXCEPTION_PAGE
	getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_EXCEPTION_PAGE);

	// Intercept any unexpected error stacktrace and take to our page
	getRequestCycleListeners().add(new AbstractRequestCycleListener() {
		@Override
		public IRequestHandler onException(final RequestCycle cycle, final Exception e) {
			return new RenderPageRequestHandler(new PageProvider(new ErrorPage(e)));
		}
	});

	// Disable Wicket's loading of jQuery - we load Sakai's preferred version in BasePage.java
	getJavaScriptLibrarySettings().setJQueryReference(new PackageResourceReference(GradebookNgApplication.class, "empty.js"));

	// cleanup the HTML
	getMarkupSettings().setStripWicketTags(true);
	getMarkupSettings().setStripComments(true);
	getMarkupSettings().setCompressWhitespace(true);

}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:55,代码来源:GradebookNgApplication.java

示例9: init

import org.apache.wicket.request.cycle.AbstractRequestCycleListener; //导入依赖的package包/类
@Override
public void init() {
	super.init();
	
	//page mounting for bookmarkable URLs
	//mountPage("/gradebook", GradebookPage.class);
	//mountPage("/settings", SettingsPage.class);
	//mountPage("/importexport", ImportExportPage.class);
	//mountPage("/permissions", PermissionsPage.class);
	
	//remove the version number from the URL so that browser refreshes re-render the page
	//getRequestCycleSettings().setRenderStrategy(IRequestCycleSettings.RenderStrategy.ONE_PASS_RENDER); 
	
	//Configure for Spring injection
       getComponentInstantiationListeners().add(new SpringComponentInjector(this));

	//Don't throw an exception if we are missing a property, just fallback
	getResourceSettings().setThrowExceptionOnMissingResource(false);
	
	//Remove the wicket specific tags from the generated markup
	getMarkupSettings().setStripWicketTags(true);
	
	//Don't add any extra tags around a disabled link (default is <em></em>)
	getMarkupSettings().setDefaultBeforeDisabledLink(null);
	getMarkupSettings().setDefaultAfterDisabledLink(null);
			
	// On Wicket session timeout, redirect to main page
	//getApplicationSettings().setPageExpiredErrorPage(getHomePage());
			
	// show internal error page rather than default developer page
	// for production, set to SHOW_NO_EXCEPTION_PAGE
	getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_EXCEPTION_PAGE);
	
	// Intercept any unexpected error stacktrace and take to our page
	getRequestCycleListeners().add(new AbstractRequestCycleListener() {
           @Override
           public IRequestHandler onException(RequestCycle cycle, Exception e) {
               return new RenderPageRequestHandler(new PageProvider(new ErrorPage(e)));
           }
	});
	
	

  
	//to put this app into deployment mode, see web.xml
}
 
开发者ID:steveswinsburg,项目名称:gradebookNG,代码行数:47,代码来源:GradebookNgApplication.java

示例10: init

import org.apache.wicket.request.cycle.AbstractRequestCycleListener; //导入依赖的package包/类
@Override
public void init() {
    super.init();

    IBootstrapSettings settings = new BootstrapSettings();
    settings.setAutoAppendResources(false);
    settings.setThemeProvider(new GizmoThemeProvider());
    Bootstrap.install(this, settings);
    BootstrapLess.install(this);

    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    IResourceSettings resourceSettings = getResourceSettings();

    resourceSettings.setThrowExceptionOnMissingResource(false);
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setDefaultBeforeDisabledLink("");
    getMarkupSettings().setDefaultAfterDisabledLink("");

    if (RuntimeConfigurationType.DEVELOPMENT.equals(getConfigurationType())) {
        getDebugSettings().setAjaxDebugModeEnabled(true);
        getDebugSettings().setDevelopmentUtilitiesEnabled(true);
    }

    //exception handling an error pages
    IApplicationSettings appSettings = getApplicationSettings();
    appSettings.setAccessDeniedPage(PageError401.class);
    appSettings.setInternalErrorPage(PageError.class);
    appSettings.setPageExpiredErrorPage(PageError.class);

    new AnnotatedMountScanner().scanPackage(PageTemplate.class.getPackage().getName()).mount(this);

    mount(new MountedMapper("/error", PageError.class, new UrlPathPageParametersEncoder()));
    mount(new MountedMapper("/error/401", PageError401.class, new UrlPathPageParametersEncoder()));
    mount(new MountedMapper("/error/403", PageError403.class, new UrlPathPageParametersEncoder()));
    mount(new MountedMapper("/error/404", PageError404.class, new UrlPathPageParametersEncoder()));

    getRequestCycleListeners().add(new AbstractRequestCycleListener() {

        @Override
        public IRequestHandler onException(RequestCycle cycle, Exception ex) {
            LOGGER.error("Error occurred during page rendering, reason: {} (more on DEBUG level)", ex.getMessage());
            LOGGER.debug("Error occurred during page rendering", ex);

            return new RenderPageRequestHandler(new PageProvider(new PageError(ex)));
        }
    });
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:49,代码来源:GizmoApplication.java

示例11: initExceptionPages

import org.apache.wicket.request.cycle.AbstractRequestCycleListener; //导入依赖的package包/类
public static final void initExceptionPages(WebApplication application) {
    application.getExceptionSettings().setUnexpectedExceptionDisplay(
            IExceptionSettings.SHOW_EXCEPTION_PAGE);
    application.getExceptionSettings().setThreadDumpStrategy(
            ThreadDumpStrategy.ALL_THREADS);
    application.getExceptionSettings().setAjaxErrorHandlingStrategy(
            AjaxErrorStrategy.REDIRECT_TO_ERROR_PAGE);

    application.getApplicationSettings().setAccessDeniedPage(
            AccessDeniedPage.class);
    application.getApplicationSettings().setInternalErrorPage(
            InternalErrorPage.class);
    application.getApplicationSettings().setPageExpiredErrorPage(
            PageExpiredErrorPage.class);

    application.getRequestCycleListeners().add(
            new AbstractRequestCycleListener() {
                @Override
                public IRequestHandler onException(RequestCycle cycle,
                        Exception e) {

                    Page currentPage = null;

                    IRequestHandler handler = cycle
                            .getActiveRequestHandler();

                    if (handler == null) {
                        handler = cycle
                                .getRequestHandlerScheduledAfterCurrent();
                    }

                    if (handler instanceof IPageRequestHandler) {
                        IPageRequestHandler pageRequestHandler = (IPageRequestHandler) handler;
                        currentPage = (Page) pageRequestHandler.getPage();
                    }

                    return new RenderPageRequestHandler(new PageProvider(
                            new ExceptionErrorPage(e, currentPage)));
                }
            });

}
 
开发者ID:PkayJava,项目名称:pluggable,代码行数:43,代码来源:FrameworkUtilities.java


注:本文中的org.apache.wicket.request.cycle.AbstractRequestCycleListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。