Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
artdaw opened this issue May 30, 2013 · 2 comments
Closed

Comments

@artdaw
Copy link
Contributor

artdaw commented May 30, 2013

Original author: kamilsk...@gmail.com (August 08, 2011 18:42:29)

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: http://code.google.com/p/activeweb/issues/detail?id=50

@artdaw
Copy link
Contributor Author

artdaw commented May 30, 2013

From ipolevoy@gmail.com on August 12, 2011 01:53:45
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);    
}

@ipolevoy
Copy link
Member

ipolevoy commented Oct 8, 2019

this does not produce an exception anymore, closing

@ipolevoy ipolevoy closed this as completed Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants