google-code-export / activeweb

Automatically exported from code.google.com/p/activeweb
0 stars 0 forks source link

render(String, Map) requires an absolute file path, and it should not #50

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.render("activity_content").noLayout(); //this works
2.render("activity_content", new HashMap()).noLayout(); //this all of the 
sudden breaks with FileNotFound exception

We expect the render(String, Map) to act the same way as render(String) does so 
if i decide to add a map to my previous render() method then nothing should 
break.

What version of the product are you using? On what operating system?
1.1

Original issue reported on code.google.com by kamilsk...@gmail.com on 8 Aug 2011 at 6:42

GoogleCodeExporter commented 9 years ago
Proposed implementation:

    /**
     * Renders results with a template.
     *
     * This call must be the last call in the action.
     *
     @param template - template name, can be "list"  - for a view whose name is different than the name of this action, or
     *             "/another_controller/any_view" - this is a reference to a view from another controller. The format of this
     * parameter should be either a single word or words separated by slash: '/'. If this is a single word, than
     * it is assumed that template belongs to current controller, if there is a slash used as a separator, then the
     * first word is assumed to be a name of another controller.
     * @param values map with values to pass to view.
     * @return instance of {@link RenderBuilder}, which is used to provide additional parameters.
     */
    @Override
    protected RenderBuilder render(String template, Map values) {
        String targetTemplate = template.startsWith("/")? template: Router.getControllerPath(getClass())
                + "/" + template;
        return super.render(targetTemplate, values);    
    }

Original comment by ipolevoy@gmail.com on 12 Aug 2011 at 1:53