You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Johno Crawford (JIRA)" <ji...@apache.org> on 2011/06/27 13:08:47 UTC
[jira] [Created] (WW-3655) Freemarker result loads request uri as
template
Freemarker result loads request uri as template
-----------------------------------------------
Key: WW-3655
URL: https://issues.apache.org/jira/browse/WW-3655
Project: Struts 2
Issue Type: Bug
Affects Versions: 2.2.3
Reporter: Johno Crawford
If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
example url, http://localhost:8080/com/acme/actions/Action.class/
the check below seems a little exotic, however someone may be relying on it eg. same actions handling stuff in different directories?
if (!locationArg.startsWith("/")) {
String base = ResourceUtil.getResourceBase(req);
locationArg = base + "/" + locationArg;
}
I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (WW-3655) Freemarker result loads
request uri as template
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057740#comment-13057740 ]
Lukasz Lenart edited comment on WW-3655 at 6/30/11 2:16 PM:
------------------------------------------------------------
I was thinking about something like this, we have an action as below in namespace /app
{code}
<action name="index" class="org.demo.IndexAction">
<result type="freemarker"/>
</action>
{code}
so the result will be resolved to:
*/app/index.ftl*
or
*/app/index-success.ftl* (as success is the default result name)
if the result name will be specified
{code}
<action name="index" class="org.demo.IndexAction">
<result name="error" type="freemarker"/>
</action>
{code}
the result would be:
*/app/index-error.ftl*
Could you check if is doable ?
was (Author: lukaszlenart):
I was thinking about something like this, we have an action as below in namespace /app
{code}
<action name="index" class="org.demo.IndexAction">
<result type="freemarker"/>
</action>
{code}
so the result will be resolved to:
*/app/index.ftl*
or
*/app/index-success.ftl* (as success is the default result name)
if the result name will be specified
{code}
<action name="index" class="org.demo.IndexAction">
<result name="error" type="freemarker"/>
</action>
{code}
the result would be:
*/app/index-error.ftl*
Could you check if is doable ?
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WW-3655) Freemarker result loads request uri as
template
Posted by "Johno Crawford (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Johno Crawford updated WW-3655:
-------------------------------
Description:
If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
if (!locationArg.startsWith("/")) {
String base = ResourceUtil.getResourceBase(req);
locationArg = base + "/" + locationArg;
}
To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
was:
If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
The check / culprit below seems a little exotic, however someone may be relying on it eg. same actions handling stuff in different directories?
if (!locationArg.startsWith("/")) {
String base = ResourceUtil.getResourceBase(req);
locationArg = base + "/" + locationArg;
}
To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WW-3655) Freemarker result loads request uri as
template
Posted by "Johno Crawford (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Johno Crawford updated WW-3655:
-------------------------------
Description:
If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
The check / culprit below seems a little exotic, however someone may be relying on it eg. same actions handling stuff in different directories?
if (!locationArg.startsWith("/")) {
String base = ResourceUtil.getResourceBase(req);
locationArg = base + "/" + locationArg;
}
To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
was:
If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
the check / culprit below seems a little exotic, however someone may be relying on it eg. same actions handling stuff in different directories?
if (!locationArg.startsWith("/")) {
String base = ResourceUtil.getResourceBase(req);
locationArg = base + "/" + locationArg;
}
I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The check / culprit below seems a little exotic, however someone may be relying on it eg. same actions handling stuff in different directories?
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WW-3655) Freemarker result loads request uri as
template
Posted by "Johno Crawford (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13056786#comment-13056786 ]
Johno Crawford commented on WW-3655:
------------------------------------
Would the action namespace be enough Lukasz? At least the unit tests pass.. I have split my proposed fix and improvement into separate patches / pull requests.
https://github.com/apache/struts2/pull/2/files
https://github.com/apache/struts2/pull/3/files
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WW-3655) Freemarker result loads request uri as
template
Posted by "Johno Crawford (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Johno Crawford updated WW-3655:
-------------------------------
Description:
If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
the check / culprit below seems a little exotic, however someone may be relying on it eg. same actions handling stuff in different directories?
if (!locationArg.startsWith("/")) {
String base = ResourceUtil.getResourceBase(req);
locationArg = base + "/" + locationArg;
}
I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
was:
If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
example url, http://localhost:8080/com/acme/actions/Action.class/
the check below seems a little exotic, however someone may be relying on it eg. same actions handling stuff in different directories?
if (!locationArg.startsWith("/")) {
String base = ResourceUtil.getResourceBase(req);
locationArg = base + "/" + locationArg;
}
I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> the check / culprit below seems a little exotic, however someone may be relying on it eg. same actions handling stuff in different directories?
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WW-3655) Freemarker result loads request uri as
template
Posted by "Johno Crawford (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Johno Crawford updated WW-3655:
-------------------------------
Description:
If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
{code}
if (!locationArg.startsWith("/")) {
String base = ResourceUtil.getResourceBase(req);
locationArg = base + "/" + locationArg;
}
{code}
To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
was:
If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
if (!locationArg.startsWith("/")) {
String base = ResourceUtil.getResourceBase(req);
locationArg = base + "/" + locationArg;
}
To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> {code}
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> {code}
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (WW-3655) Freemarker result loads
request uri as template
Posted by "Johno Crawford (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13058598#comment-13058598 ]
Johno Crawford edited comment on WW-3655 at 7/1/11 3:29 PM:
------------------------------------------------------------
Perhaps I am missing the point, but isn't the purpose of the feature in question suppose to generate a prefix for the result location based on the request uri path? The following example should trigger the use case.
{code}
<action name="index" class="com.acme.IndexAction">
<result name="success" type="freemarker">com/acme/nested.ftl</result>
</action>
{code}
was (Author: johno):
Perhaps I am missing the point, but isn't the purpose of the feature in question suppose to generate a prefix for the result location based on the request uri path?
{code}
<action name="index" class="com.acme.IndexAction">
<result name="success" type="freemarker">com/acme/nested.ftl</result>
</action>
{code}
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> {code}
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> {code}
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (WW-3655) Freemarker result loads
request uri as template
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057740#comment-13057740 ]
Lukasz Lenart edited comment on WW-3655 at 6/30/11 2:14 PM:
------------------------------------------------------------
I was thinking about something like this, we have an action as below in namespace /app
{{
<action name="index" class="org.demo.IndexAction">
<result type="freemarker"/>
</action>
}}
so the result will be resolved to:
*/app/index.ftl*
or
*/app/index-success.ftl* (as success is the default result name)
if the result name will be specified
{{
<action name="index" class="org.demo.IndexAction">
<result name="error" type="freemarker"/>
</action>
}}
the result would be:
*/app/index-error.ftl*
Could you check if is doable ?
was (Author: lukaszlenart):
I was thinking about something like this, we have an action as below in namespace /app
<action name="index" class="org.demo.IndexAction">
<result type="freemarker"/>
</action>
so the result will be resolved to:
*/app/index.ftl*
or
*/app/index-success.ftl* (as success is the default result name)
if the result name will be specified
<action name="index" class="org.demo.IndexAction">
<result name="error" type="freemarker"/>
</action>
the result would be:
*/app/index-error.ftl*
Could you check if is doable ?
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (WW-3655) Freemarker result loads
request uri as template
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057740#comment-13057740 ]
Lukasz Lenart edited comment on WW-3655 at 6/30/11 2:15 PM:
------------------------------------------------------------
I was thinking about something like this, we have an action as below in namespace /app
{code}
<action name="index" class="org.demo.IndexAction">
<result type="freemarker"/>
</action>
{code}
so the result will be resolved to:
*/app/index.ftl*
or
*/app/index-success.ftl* (as success is the default result name)
if the result name will be specified
{code}
<action name="index" class="org.demo.IndexAction">
<result name="error" type="freemarker"/>
</action>
{code}
the result would be:
*/app/index-error.ftl*
Could you check if is doable ?
was (Author: lukaszlenart):
I was thinking about something like this, we have an action as below in namespace /app
{{
<action name="index" class="org.demo.IndexAction">
<result type="freemarker"/>
</action>
}}
so the result will be resolved to:
*/app/index.ftl*
or
*/app/index-success.ftl* (as success is the default result name)
if the result name will be specified
{{
<action name="index" class="org.demo.IndexAction">
<result name="error" type="freemarker"/>
</action>
}}
the result would be:
*/app/index-error.ftl*
Could you check if is doable ?
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Issue Comment Edited] (WW-3655) Freemarker result loads
request uri as template
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057740#comment-13057740 ]
Lukasz Lenart edited comment on WW-3655 at 6/30/11 2:10 PM:
------------------------------------------------------------
I was thinking about something like this, we have an action as below in namespace /app
<action name="index" class="org.demo.IndexAction">
<result type="freemarker"/>
</action>
so the result will be resolved to:
*/app/index.ftl*
or
*/app/index-success.ftl* (as success is the default result name)
if the result name will be specified
<action name="index" class="org.demo.IndexAction">
<result name="error" type="freemarker"/>
</action>
the result would be:
*/app/index-error.ftl*
Could you check if is doable ?
was (Author: lukaszlenart):
I was thinking about something like this, we have an action as below in namespace /app
<action name="index" class="org.demo.IndexAction">
<result type="freemarker"/>
</action>
so the result will be resolved to:
/app/index.ftl
or
/app/index-success.ftl (as success is the default result name)
if the result name will be specified
<action name="index" class="org.demo.IndexAction">
<result name="error" type="freemarker"/>
</action>
the result would be:
/app/index-error.ftl
Could you check if is doable ?
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WW-3655) Freemarker result loads request uri as
template
Posted by "Johno Crawford (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13058598#comment-13058598 ]
Johno Crawford commented on WW-3655:
------------------------------------
Perhaps I am missing the point, but isn't the purpose of the feature in question suppose to generate a prefix for the result location based on the request uri path?
{code}
<action name="index" class="com.acme.IndexAction">
<result name="success" type="freemarker">com/acme/nested.ftl</result>
</action>
{code}
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> {code}
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> {code}
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (WW-3655) Freemarker result loads request uri as
template
Posted by "Maurizio Cucchiara (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Maurizio Cucchiara reassigned WW-3655:
--------------------------------------
Assignee: Maurizio Cucchiara
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WW-3655) Freemarker result loads request uri as
template
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13059353#comment-13059353 ]
Lukasz Lenart commented on WW-3655:
-----------------------------------
It can be, but that can also be solved by convention. So, location doesn't have to be defined and it should work
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> {code}
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> {code}
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (WW-3655) Freemarker result loads request uri as
template
Posted by "Lukasz Lenart (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart updated WW-3655:
------------------------------
Fix Version/s: 3.x
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
> Fix For: 3.x
>
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> {code}
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> {code}
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WW-3655) Freemarker result loads request uri as
template
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13056340#comment-13056340 ]
Lukasz Lenart commented on WW-3655:
-----------------------------------
Maybe it would be better to add some convention here base on ActionInvocation and ActionName ?
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (WW-3655) Freemarker result loads request uri as
template
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057740#comment-13057740 ]
Lukasz Lenart commented on WW-3655:
-----------------------------------
I was thinking about something like this, we have an action as below in namespace /app
<action name="index" class="org.demo.IndexAction">
<result type="freemarker"/>
</action>
so the result will be resolved to:
/app/index.ftl
or
/app/index-success.ftl (as success is the default result name)
if the result name will be specified
<action name="index" class="org.demo.IndexAction">
<result name="error" type="freemarker"/>
</action>
the result would be:
/app/index-error.ftl
Could you check if is doable ?
> Freemarker result loads request uri as template
> -----------------------------------------------
>
> Key: WW-3655
> URL: https://issues.apache.org/jira/browse/WW-3655
> Project: Struts 2
> Issue Type: Bug
> Affects Versions: 2.2.3
> Reporter: Johno Crawford
> Assignee: Maurizio Cucchiara
>
> If the template location is either null or an empty string "" FreemarkerResult will take the request uri org.apache.struts2.views.freemarker.FreemarkerResult#doExecute and load it as a template.
> Example url, http://localhost:8080/com/acme/actions/Action.class/ would load /com/acme/actions/Action.class/ as a template and dump the bytecode in the response.
> The "feature" / culprit below seems a little exotic, however someone may be relying on it.. (same actions handling stuff in different directories?)
> if (!locationArg.startsWith("/")) {
> String base = ResourceUtil.getResourceBase(req);
> locationArg = base + "/" + locationArg;
> }
> To mitigate the problem and maintain previous functionality we could throw an exception if the template location is empty, I have created a pull request with my proposed fix https://github.com/apache/struts2/pull/1
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira