Package net.sourceforge.stripes.config

Examples of net.sourceforge.stripes.config.Configuration


     *        type conversion should occur
     * @return a Resolution if the error handling code determines that some kind of resolution
     *         should be processed in favor of continuing on to handler invocation
     */
    public static Resolution invokeEventHandler(ExecutionContext ctx) throws Exception {
        final Configuration config = StripesFilter.getConfiguration();
        final Method handler = ctx.getHandler();
        final ActionBean bean = ctx.getActionBean();

        // Finally execute the handler method!
        ctx.setLifecycleStage(LifecycleStage.EventHandling);
        ctx.setInterceptors(config.getInterceptors(LifecycleStage.EventHandling));

        return ctx.wrap( new Interceptor() {
            public Resolution intercept(ExecutionContext ctx) throws Exception {
                Object returnValue = handler.invoke(bean);
                fillInValidationErrors(ctx);
View Full Code Here


     * @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

    private static final Log log = Log.getInstance(SpringInjectionPostProcessor.class);
    private ServletContext servletContext;

    /** Get the servlet context from the object factory's configuration. */
    public void setObjectFactory(DefaultObjectFactory factory) {
        Configuration configuration = factory.getConfiguration();
        if (configuration == null) {
            final String name = getClass().getSimpleName();
            throw new IllegalStateException("The object factory passed to " + name
                    + " has no configuration. The configuration is required by " + name
                    + " to get the servlet context.");
        }

        ServletContext servletContext = configuration.getServletContext();
        if (this.servletContext != null && this.servletContext != servletContext) {
            final String name = getClass().getSimpleName();
            throw new IllegalStateException("An attempt was made to use a single instance of "
                    + name + " in two different servlet contexts. " + name + " instances "
                    + "cannot be shared across servlet contexts.");
View Full Code Here

            for (int i = 0; i < count; i++) {
            Map<String, String> params = new HashMap<String, String>();
            params.put("ActionResolver.Packages", "foo.bar");
            MockServletContext mockServletContext = StripesTestFixture.createServletContext();
            try {
                Configuration config = StripesFilter.getConfiguration();
                Assert.assertNotNull(config, "config is null for context " + mockServletContext.getServletContextName());
            } finally {
                mockServletContext.close();
            }
        }
View Full Code Here

        public TestBean getBean() { return bean; }
    }

    @Test(groups = "fast", dependsOnMethods = "testExplicitSetterInjection")
    public void testInjectionViaObjectPostProcessor() throws Exception {
        Configuration configuration = StripesTestFixture.getDefaultConfiguration();
        ServletContext sc = configuration.getServletContext();
        sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, this.ctx);
        DefaultObjectFactory factory = new DefaultObjectFactory();
        factory.init(configuration);
        factory.addPostProcessor(new SpringInjectionPostProcessor());
        PostProcessorTarget target = factory.newInstance(PostProcessorTarget.class);
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.