Package net.sourceforge.stripes.config

Examples of net.sourceforge.stripes.config.BootstrapPropertyResolver


     * Configuration.
     *
     * @throws ServletException thrown if a problem is encountered initializing Stripes
     */
    public void init(FilterConfig filterConfig) throws ServletException {
        BootstrapPropertyResolver bootstrap = new BootstrapPropertyResolver(filterConfig);

        // Set up the Configuration - if one isn't found by the bootstrapper then
        // we'll just use the default: RuntimeConfiguration
        Class<? extends Configuration> clazz = bootstrap.getClassProperty(CONFIG_CLASS,
                Configuration.class);

        if (clazz == null)
            clazz = RuntimeConfiguration.class;

View Full Code Here


     * Configuration using the {@link ResolverUtil} class.
     *
     * @return a set of Class objects that represent subclasses of ActionBean
     */
    protected Set<Class<? extends ActionBean>> findClasses() {
        BootstrapPropertyResolver bootstrap = getConfiguration().getBootstrapPropertyResolver();
        if (bootstrap.getProperty(URL_FILTERS) != null || bootstrap.getProperty(PACKAGE_FILTERS) != null) {
            log.error("The configuration properties '", URL_FILTERS, "' and '", PACKAGE_FILTERS,
                      "' are deprecated, and NO LONGER SUPPORTED. Please read the upgrade ",
                      "documentation for Stripes 1.5 for how to resolve this situation. In short ",
                      "you should specify neither ", URL_FILTERS, " or ", PACKAGE_FILTERS,
                      ". Instead you should specify a comma separated list of package roots ",
                      "(e.g. com.myco.web) that should be scanned for implementations of ",
                      "ActionBean, using the configuration parameter '", PACKAGES,  "'.");
        }

        String packages = bootstrap.getProperty(PACKAGES);
        if (packages == null) {
            throw new StripesRuntimeException(
                "You must supply a value for the configuration parameter '" + PACKAGES + "'. The " +
                "value should be a list of one or more package roots (comma separated) that are " +
                "to be scanned for ActionBean implementations. The packages specified and all " +
View Full Code Here

     * Configuration using the {@link ResolverUtil} class.
     *
     * @return a set of Class objects that represent subclasses of AutoExceptionHandler
     */
    protected Set<Class<? extends AutoExceptionHandler>> findClasses() {
        BootstrapPropertyResolver bootstrap = getConfiguration().getBootstrapPropertyResolver();
        if (bootstrap.getProperty(URL_FILTERS) != null || bootstrap.getProperty(PACKAGE_FILTERS) != null) {
            log.error("The configuration properties '", URL_FILTERS, "' and '", PACKAGE_FILTERS,
                      "' are deprecated, and NO LONGER SUPPORTED. Please read the upgrade ",
                      "documentation for Stripes 1.5 for how to resolve this situation. In short ",
                      "you should specify neither ", URL_FILTERS, " nor ", PACKAGE_FILTERS,
                      ". Instead you should specify a comma separated list of package roots ",
                      "(e.g. com.myco.web) that should be scanned for implementations of ",
                      "AutoExceptionHandler, using the configuration parameter '", PACKAGES,
                      "', or include the packages along with other extension packages using the ",
                      "configuration parameter '", BootstrapPropertyResolver.PACKAGES, "'.");
        }

        // Try the config param that is specific to this class
        String[] packages = StringUtil.standardSplit(bootstrap.getProperty(PACKAGES));
        if (packages == null || packages.length == 0) {
            // Config param not found so try autodiscovery
            log.info("No config parameter '", PACKAGES, "' found. Trying autodiscovery instead.");
            List<Class<? extends AutoExceptionHandler>> classes = bootstrap
                    .getClassPropertyList(AutoExceptionHandler.class);
            if (!classes.isEmpty()) {
                return new HashSet<Class<? extends AutoExceptionHandler>>(classes);
            }
            else {
                // Autodiscovery found nothing so resort to looking at the ActionBean packages
                log.info("Autodiscovery found no implementations of AutoExceptionHandler. Using ",
                        "the value of '", AnnotatedClassActionResolver.PACKAGES, "' instead.");
                packages = StringUtil.standardSplit(bootstrap
                        .getProperty(AnnotatedClassActionResolver.PACKAGES));
            }
        }

        if (packages != null && packages.length > 0) {
View Full Code Here

     * Configuration using the {@link ResolverUtil} class.
     *
     * @return a set of Class objects that represent subclasses of ActionBean
     */
    protected Set<Class<? extends ActionBean>> findClasses() {
        BootstrapPropertyResolver bootstrap = getConfiguration().getBootstrapPropertyResolver();
        if (bootstrap.getProperty(URL_FILTERS) != null || bootstrap.getProperty(PACKAGE_FILTERS) != null) {
            log.error("The configuration properties '", URL_FILTERS, "' and '", PACKAGE_FILTERS,
                      "' are deprecated, and NO LONGER SUPPORTED. Please read the upgrade ",
                      "documentation for Stripes 1.5 for how to resolve this situation. In short ",
                      "you should specify neither ", URL_FILTERS, " or ", PACKAGE_FILTERS,
                      ". Instead you should specify a comma separated list of package roots ",
                      "(e.g. com.myco.web) that should be scanned for implementations of ",
                      "ActionBean, using the configuration parameter '", PACKAGES,  "'.");
        }

        String packages = bootstrap.getProperty(PACKAGES);
        if (packages == null) {
            throw new StripesRuntimeException(
                "You must supply a value for the configuration parameter '" + PACKAGES + "'. The " +
                "value should be a list of one or more package roots (comma separated) that are " +
                "to be scanned for ActionBean implementations. The packages specified and all " +
View Full Code Here

     * Configuration.
     *
     * @throws ServletException thrown if a problem is encountered initializing Stripes
     */
    public void init(FilterConfig filterConfig) throws ServletException {
        BootstrapPropertyResolver bootstrap = new BootstrapPropertyResolver(filterConfig);

        // Set up the Configuration - if one isn't found by the bootstrapper then
        // we'll just use the default: RuntimeConfiguration
        Class<? extends Configuration> clazz = bootstrap.getClassProperty(CONFIG_CLASS,
                Configuration.class);

        if (clazz == null)
            clazz = RuntimeConfiguration.class;

View Full Code Here

            MockFilterConfig filterConfig = new MockFilterConfig();
            filterConfig.addAllInitParameters(getDefaultFilterParams());
            MockServletContext mockServletContext = createServletContext();
            try {
                filterConfig.setServletContext(mockServletContext);
                configuration.setBootstrapPropertyResolver(new BootstrapPropertyResolver(filterConfig));
                configuration.init();
                StripesTestFixture.configuration = configuration;
            } finally {
                mockServletContext.close();
            }
View Full Code Here

     * @return The new configuration instance.
     * @throws ServletException If the configuration cannot be created.
     */
    protected static Configuration createConfiguration(FilterConfig filterConfig)
            throws ServletException {
        BootstrapPropertyResolver bootstrap = new BootstrapPropertyResolver(filterConfig);

        // Set up the Configuration - if one isn't found by the bootstrapper then
        // we'll just use the default: RuntimeConfiguration
        Class<? extends Configuration> clazz = bootstrap.getClassProperty(CONFIG_CLASS,
                Configuration.class);

        if (clazz == null)
            clazz = RuntimeConfiguration.class;

View Full Code Here

     * Configuration using the {@link ResolverUtil} class.
     *
     * @return a set of Class objects that represent subclasses of AutoExceptionHandler
     */
    protected Set<Class<? extends AutoExceptionHandler>> findClasses() {
        BootstrapPropertyResolver bootstrap = getConfiguration().getBootstrapPropertyResolver();

        // Try the config param that is specific to this class
        String[] packages = StringUtil.standardSplit(bootstrap.getProperty(PACKAGES));
        if (packages == null || packages.length == 0) {
            // Config param not found so try autodiscovery
            log.info("No config parameter '", PACKAGES, "' found. Trying autodiscovery instead.");
            List<Class<? extends AutoExceptionHandler>> classes = bootstrap
                    .getClassPropertyList(AutoExceptionHandler.class);
            if (!classes.isEmpty()) {
                return new HashSet<Class<? extends AutoExceptionHandler>>(classes);
            }
            else {
                // Autodiscovery found nothing so resort to looking at the ActionBean packages
                log.info("Autodiscovery found no implementations of AutoExceptionHandler. Using ",
                        "the value of '", AnnotatedClassActionResolver.PACKAGES, "' instead.");
                packages = StringUtil.standardSplit(bootstrap
                        .getProperty(AnnotatedClassActionResolver.PACKAGES));
            }
        }

        if (packages != null && packages.length > 0) {
View Full Code Here

     * Configuration using the {@link ResolverUtil} class.
     *
     * @return a set of Class objects that represent subclasses of ActionBean
     */
    protected Set<Class<? extends ActionBean>> findClasses() {
        BootstrapPropertyResolver bootstrap = getConfiguration().getBootstrapPropertyResolver();

        String packages = bootstrap.getProperty(PACKAGES);
        if (packages == null) {
            throw new StripesRuntimeException(
                "You must supply a value for the configuration parameter '" + PACKAGES + "'. The " +
                "value should be a list of one or more package roots (comma separated) that are " +
                "to be scanned for ActionBean implementations. The packages specified and all " +
View Full Code Here

TOP

Related Classes of net.sourceforge.stripes.config.BootstrapPropertyResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.