Search in sources :

Example 1 with RequestParameterHandlerURLPathNamed

use of com.helger.photon.core.requestparam.RequestParameterHandlerURLPathNamed in project phoss-smp by phax.

the class SMPWebAppListener method initGlobalSettings.

@Override
protected void initGlobalSettings() {
    s_aStartupDateTime = PDTFactory.getCurrentOffsetDateTimeUTC();
    // Enable JaxWS debugging?
    if (SMPWebAppConfiguration.isGlobalDebugJaxWS())
        WSHelper.setMetroDebugSystemProperties(true);
    // JUL to SLF4J
    SLF4JBridgeHandler.removeHandlersForRootLogger();
    SLF4JBridgeHandler.install();
    if (SMPServerConfiguration.isForceRoot()) {
        // Enforce an empty context path according to the specs!
        ServletContextPathHolder.setCustomContextPath("");
    }
    RequestParameterManager.getInstance().setParameterHandler(new RequestParameterHandlerURLPathNamed());
    if (!GlobalDebug.isProductionMode()) {
        RequestTrackerSettings.setLongRunningRequestsCheckEnabled(false);
        RequestTrackerSettings.setParallelRunningRequestsCheckEnabled(false);
    }
    // Handled via the XServletSettings instead
    UnifiedResponseDefaultSettings.setReferrerPolicy(null);
    UnifiedResponseDefaultSettings.setXFrameOptions(null, null);
    if (SMPServerConfiguration.getRESTType().isPeppol()) {
        // Peppol SMP is always http only
        UnifiedResponseDefaultSettings.removeStrictTransportSecurity();
    }
    // Avoid writing unnecessary stuff
    setHandleStatisticsOnEnd(SMPWebAppConfiguration.isPersistStatisticsOnEnd());
    // Check SMP ID
    final String sSMPID = SMPServerConfiguration.getSMLSMPID();
    if (StringHelper.hasNoText(sSMPID))
        throw new IllegalArgumentException("The SMP ID is missing. It must match the regular expression '" + CSMPServer.PATTERN_SMP_ID + "'!");
    if (!RegExHelper.stringMatchesPattern(CSMPServer.PATTERN_SMP_ID, sSMPID))
        throw new IllegalArgumentException("The provided SMP ID '" + sSMPID + "' is not valid when used as a DNS name. It must match the regular expression '" + CSMPServer.PATTERN_SMP_ID + "'!");
    if (LOGGER.isInfoEnabled())
        LOGGER.info("This SMP has the ID '" + sSMPID + "'");
    if (SMPWebAppConfiguration.isImprintEnabled() && StringHelper.hasNoText(SMPWebAppConfiguration.getImprintText()))
        LOGGER.warn("The custom Imprint is enabled in the configuration file, but no imprint text is configured. Therefore no imprint will be shown.");
}
Also used : RequestParameterHandlerURLPathNamed(com.helger.photon.core.requestparam.RequestParameterHandlerURLPathNamed)

Example 2 with RequestParameterHandlerURLPathNamed

use of com.helger.photon.core.requestparam.RequestParameterHandlerURLPathNamed in project phoss-directory by phax.

the class AppWebAppListener method initGlobalSettings.

@Override
protected void initGlobalSettings() {
    // Internal stuff:
    VendorInfo.setVendorName("Philip Helger");
    VendorInfo.setVendorURL("http://www.helger.com");
    VendorInfo.setVendorEmail("pd@helger.com");
    VendorInfo.setVendorLocation("Vienna, Austria");
    VendorInfo.setInceptionYear(2015);
    if (PDServerConfiguration.isForceRoot()) {
        // Enforce an empty context path according to the specs!
        ServletContextPathHolder.setCustomContextPath("");
    }
    if (GlobalDebug.isProductionMode())
        ValueEnforcer.setEnabled(false);
    // By disabling these settings, less audits are created hence less calls are
    // blocking
    RequestTrackerSettings.setLongRunningRequestsCheckEnabled(false);
    RequestTrackerSettings.setParallelRunningRequestsCheckEnabled(false);
    RequestParameterManager.getInstance().setParameterHandler(new RequestParameterHandlerURLPathNamed());
    AppInternalErrorHandler.doSetup();
    final ConfigurationFileManager aCfgMgr = ConfigurationFileManager.getInstance();
    aCfgMgr.registerConfigurationFile(new ConfigurationFile(new ClassPathResource("log4j2.xml")).setDescription("log4j configuration file").setSyntaxHighlightLanguage(EConfigurationFileSyntax.XML));
    aCfgMgr.registerAll(PDServerConfiguration.getConfig());
    // Job scheduling etc
    if (GlobalDebug.isDebugMode())
        GlobalQuartzScheduler.getInstance().addJobListener(new LoggingJobListener());
}
Also used : ConfigurationFileManager(com.helger.photon.core.configfile.ConfigurationFileManager) RequestParameterHandlerURLPathNamed(com.helger.photon.core.requestparam.RequestParameterHandlerURLPathNamed) ConfigurationFile(com.helger.photon.core.configfile.ConfigurationFile) LoggingJobListener(com.helger.schedule.quartz.listener.LoggingJobListener) ClassPathResource(com.helger.commons.io.resource.ClassPathResource)

Example 3 with RequestParameterHandlerURLPathNamed

use of com.helger.photon.core.requestparam.RequestParameterHandlerURLPathNamed in project peppol-practical by phax.

the class AppCommonUI method init.

public static void init() {
    RequestParameterManager.getInstance().setParameterHandler(new RequestParameterHandlerURLPathNamed());
    BootstrapDataTables.setConfigurator((aLEC, aTable, aDataTables) -> {
        final IRequestWebScopeWithoutResponse aRequestScope = aLEC.getRequestScope();
        aDataTables.setAutoWidth(false).setLengthMenu(LENGTH_MENU).setAjaxBuilder(new JQueryAjaxBuilder().url(CAjax.DATATABLES.getInvocationURL(aRequestScope)).data(new JSAssocArray().add(AjaxExecutorDataTables.OBJECT_ID, aTable.getID()))).setServerFilterType(EDataTablesFilterType.ALL_TERMS_PER_ROW).setTextLoadingURL(CAjax.DATATABLES_I18N.getInvocationURL(aRequestScope), AjaxExecutorDataTablesI18N.LANGUAGE_ID).addPlugin(new DataTablesPluginSearchHighlight());
    });
    // By default allow markdown in system message
    BootstrapSystemMessage.setDefaultUseMarkdown(true);
    // Register comment handlers
    CommentThreadManager.getInstance().registerObjectType(CPPApp.OT_PAGE);
}
Also used : IRequestWebScopeWithoutResponse(com.helger.web.scope.IRequestWebScopeWithoutResponse) JQueryAjaxBuilder(com.helger.html.jquery.JQueryAjaxBuilder) RequestParameterHandlerURLPathNamed(com.helger.photon.core.requestparam.RequestParameterHandlerURLPathNamed) JSAssocArray(com.helger.html.jscode.JSAssocArray) DataTablesPluginSearchHighlight(com.helger.photon.uictrls.datatables.plugins.DataTablesPluginSearchHighlight)

Aggregations

RequestParameterHandlerURLPathNamed (com.helger.photon.core.requestparam.RequestParameterHandlerURLPathNamed)3 ClassPathResource (com.helger.commons.io.resource.ClassPathResource)1 JQueryAjaxBuilder (com.helger.html.jquery.JQueryAjaxBuilder)1 JSAssocArray (com.helger.html.jscode.JSAssocArray)1 ConfigurationFile (com.helger.photon.core.configfile.ConfigurationFile)1 ConfigurationFileManager (com.helger.photon.core.configfile.ConfigurationFileManager)1 DataTablesPluginSearchHighlight (com.helger.photon.uictrls.datatables.plugins.DataTablesPluginSearchHighlight)1 LoggingJobListener (com.helger.schedule.quartz.listener.LoggingJobListener)1 IRequestWebScopeWithoutResponse (com.helger.web.scope.IRequestWebScopeWithoutResponse)1