Package net.sourceforge.stripes.config

Examples of net.sourceforge.stripes.config.Configuration


     * @param ctx the current execution context representing the request
     * @param resolution the resolution to be executed unless another is substituted by an
     *        interceptor before calling ctx.proceed()
     */
    public static void executeResolution(ExecutionContext ctx, Resolution resolution) throws Exception {
        final Configuration config = StripesFilter.getConfiguration();

        ctx.setLifecycleStage(LifecycleStage.ResolutionExecution);
        ctx.setInterceptors(config.getInterceptors(LifecycleStage.ResolutionExecution));
        ctx.setResolution(resolution);

        Resolution retval = ctx.wrap( new Interceptor() {
            public Resolution intercept(ExecutionContext context) throws Exception {
                ActionBeanContext abc = context.getActionBeanContext();
View Full Code Here


        PageContext pageContext = null;
        final ExecutionContext ctx = new ExecutionContext();

        try {
            final Configuration config = StripesFilter.getConfiguration();

            // First manufacture an ActionBeanContext
            final ActionBeanContext context =
                    config.getActionBeanContextFactory().getContextInstance(request, response);
            context.setServletContext(getServletContext());

            // Then setup the ExecutionContext that we'll use to process this request
            ctx.setActionBeanContext(context);
View Full Code Here

     * @param key the exact resource key to lookup
     * @return the resource String or null
     */
    public static String getErrorMessage(Locale locale, String key) {
        try {
            Configuration config = StripesFilter.getConfiguration();
            ResourceBundle bundle = config.getLocalizationBundleFactory().getErrorMessageBundle(locale);
            return bundle.getString(key);
        }
        catch (MissingResourceException mre) {
            return null;
        }
View Full Code Here

    public static String encrypt(String input) {
        if (input == null)
            input = "";

        // encryption is disabled in debug mode
        Configuration configuration = StripesFilter.getConfiguration();
        if (configuration != null && configuration.isDebugMode())
            return input;

        try {
            // First size the output
            Cipher cipher = getCipher(Cipher.ENCRYPT_MODE);
View Full Code Here

    public static String decrypt(String input) {
        if (input == null)
            return null;

        // encryption is disabled in debug mode
        Configuration configuration = StripesFilter.getConfiguration();
        if (configuration != null && configuration.isDebugMode())
            return input;

        // First un-base64 the String
        byte[] bytes = Base64.decode(input, BASE64_OPTIONS);
        if (bytes == null || bytes.length < 1) {
View Full Code Here

     *
     * @return a byte[] of key material, or null
     */
    protected static byte[] getKeyMaterialFromConfig() {
        try {
            Configuration config = StripesFilter.getConfiguration();
            if (config != null) {
                String key = config.getBootstrapPropertyResolver().getProperty(CONFIG_ENCRYPTION_KEY);
                if (key != null) {
                    return key.getBytes();
                }
            }
        }
View Full Code Here

     * @param isForPage true if the URL is to be embedded in a page (e.g. in an anchor of img tag),
     *            false if for some other purpose.
     */
    public UrlBuilder(Locale locale, Class<? extends ActionBean> beanType, boolean isForPage) {
        this(locale, isForPage);
        Configuration configuration = StripesFilter.getConfiguration();
        if (configuration != null) {
            this.baseUrl = configuration.getActionResolver().getUrlBinding(beanType);
        }
        else {
            throw new StripesRuntimeException("Unable to lookup URL binding for ActionBean class "
                    + "because there is no Configuration object available.");
        }
View Full Code Here

     * @param value the object to be formatted
     * @return a formatter, if one can be found; null otherwise
     */
    @SuppressWarnings("unchecked")
  protected Formatter getFormatter(Object value) {
        Configuration configuration = StripesFilter.getConfiguration();
        if (configuration == null)
            return null;

        FormatterFactory factory = configuration.getFormatterFactory();
        if (factory == null)
            return null;

        return factory.getFormatter(value.getClass(), locale, null, null);
    }
View Full Code Here

     * @return a map of ActionBean property names to their validation metadata
     * @see ValidationMetadataProvider#getValidationMetadata(Class)
     */
    protected Map<String, ValidationMetadata> getValidationMetadata() {
        Map<String, ValidationMetadata> validations = null;
        Configuration configuration = StripesFilter.getConfiguration();
        if (configuration != null) {
            Class<? extends ActionBean> beanType = null;
            try {
                beanType = configuration.getActionResolver().getActionBeanType(this.baseUrl);
            }
            catch (UrlBindingConflictException e) {
                // This can be safely ignored
            }

            if (beanType != null) {
                validations = configuration.getValidationMetadataProvider().getValidationMetadata(
                        beanType);
            }
        }

        if (validations == null)
View Full Code Here

     * @param ctx the ExecutionContext being used to process the current request
     * @return a Resolution if any interceptor determines that the request processing should
     *         be aborted in favor of another Resolution, null otherwise.
     */
    public static Resolution resolveActionBean(final ExecutionContext ctx) throws Exception {
        final Configuration config = StripesFilter.getConfiguration();
        ctx.setLifecycleStage(LifecycleStage.ActionBeanResolution);
        ctx.setInterceptors(config.getInterceptors(LifecycleStage.ActionBeanResolution));
        return  ctx.wrap( new Interceptor() {
            public Resolution intercept(ExecutionContext ctx) throws Exception {
                // Look up the ActionBean and set it on the context
                ActionBeanContext context = ctx.getActionBeanContext();
                ActionBean bean = StripesFilter.getConfiguration().getActionResolver().getActionBean(context);
View Full Code Here

TOP

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

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.