[jira] [Commented] (WW-4930) SMI cannot be diasabled for action-packages found via the convention-plugin

2018-04-05 Thread Philipp Heidelbach (JIRA)

[ 
https://issues.apache.org/jira/browse/WW-4930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16427031#comment-16427031
 ] 

Philipp Heidelbach commented on WW-4930:


h3.  *Example Action:*
{code:java}
public class JsonImportAction extends BaseAction {

    private static final long serialVersionUID = 1L;

    private static final String ACTION_NAMESPACE = "stammdaten/";

    private static final String FORM = "json-import-form";

    private static final String UPLOAD_ID = "upload";

    @Getter
    @Setter
    private File upload;

    @Getter
    @Setter
    private String uploadFileName;

    @Inject
    private JsonImportService jsonImport;

    public void validateImportJson() {
    setResult(ACTION_NAMESPACE + FORM);
    commonValidate(UPLOAD_ID);
    }

    public String importJson() {
    try {
    jsonImport.jsonImport(upload);
    } catch (final SQLException e) {
    e.printStackTrace();
    }
    addActionMessage(getText("jsonImport.success"));
    return INPUT;
    }

    private void commonValidate(final String uploadId) {
    if (upload == null) {
    addFieldError(uploadId, getText("jsonImport.chooseFile"));
    } else if (!StringUtils.equalsIgnoreCase("json", 
FilenameUtils.getExtension(uploadFileName))) {
    addFieldError(uploadId, getText("jsonImport.chooseFile.error"));
    } else if (upload.length() == 0) {
    addFieldError(uploadId, getText("jsonImport.empty"));
    }
    }
}

{code}
*Beginning of our BaseAction:*
{code:java}
@ParentPackage("default")
@Result(name = Action.INPUT, location = "/WEB-INF/jsp/${result}.jsp")
public class BaseAction extends ActionSupport
implements ServletContextAware, ServletRequestAware, 
ServletResponseAware {
{code}
*And the corresponding view component:*
{code:java}
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ include file="../../includes/taglib.jsp" %>










{code}

> SMI cannot be diasabled for action-packages found via the convention-plugin
> ---
>
> Key: WW-4930
> URL: https://issues.apache.org/jira/browse/WW-4930
> Project: Struts 2
>  Issue Type: Bug
>  Components: Plugin - Convention
>Affects Versions: 2.5.16
> Environment: Windows 10
> Java 1.8
>Reporter: Philipp Heidelbach
>Priority: Major
> Fix For: 2.6
>
>
> I'm trying to update Struts 2.3.34 to 2.5.16 and disabling SMI doesn't seem 
> to work.
> I debuged XmlConfigurationProvider but in the packageConfig of our package 
> (named default see below) SMI is correctly set to false. Debugging 
> PackageBaseActionConfigBuilder shows that our default-package is used as 
> parent package and in the parentPkg SMI is set to false. The pkgConfig 
> however is alwasy null (line: 1043) and so a new package config is created in 
> which SMI is set to true.
> Thus for all these actions methods i get the error that these methods aren't 
> allowed.
> If I use @AllowedMethod-annotations it works fine.
> Below the beginning of our struts.xml
> {code:xml}
> 
>  "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
> "http://struts.apache.org/dtds/struts-2.5.dtd;>
> 
> 
>  value="jar,zip,vfsfile,vfszip" />
>  value=".*/newd[-.\w]*\.jar(!/)?" />
>  value="org.apache.struts.*,org.apache.struts2.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*"
>  />
> 
>  value="applicationResources" />
> 
> 
> 
> 
> 
> 
> 
> 
>  strict-method-invocation="false">
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (WW-4930) SMI cannot be diasabled for action-packages found via the convention-plugin

2018-04-05 Thread Lukasz Lenart (JIRA)

[ 
https://issues.apache.org/jira/browse/WW-4930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16426855#comment-16426855
 ] 

Lukasz Lenart commented on WW-4930:
---

This we done on purpose as far I remember. Can you share a code of the example 
action?

> SMI cannot be diasabled for action-packages found via the convention-plugin
> ---
>
> Key: WW-4930
> URL: https://issues.apache.org/jira/browse/WW-4930
> Project: Struts 2
>  Issue Type: Bug
>  Components: Plugin - Convention
>Affects Versions: 2.5.16
> Environment: Windows 10
> Java 1.8
>Reporter: Philipp Heidelbach
>Priority: Major
> Fix For: 2.6
>
>
> I'm trying to update Struts 2.3.34 to 2.5.16 and disabling SMI doesn't seem 
> to work.
> I debuged XmlConfigurationProvider but in the packageConfig of our package 
> (named default see below) SMI is correctly set to false. Debugging 
> PackageBaseActionConfigBuilder shows that our default-package is used as 
> parent package and in the parentPkg SMI is set to false. The pkgConfig 
> however is alwasy null (line: 1043) and so a new package config is created in 
> which SMI is set to true.
> Thus for all these actions methods i get the error that these methods aren't 
> allowed.
> If I use @AllowedMethod-annotations it works fine.
> Below the beginning of our struts.xml
> {code:xml}
> 
>  "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
> "http://struts.apache.org/dtds/struts-2.5.dtd;>
> 
> 
>  value="jar,zip,vfsfile,vfszip" />
>  value=".*/newd[-.\w]*\.jar(!/)?" />
>  value="org.apache.struts.*,org.apache.struts2.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*"
>  />
> 
>  value="applicationResources" />
> 
> 
> 
> 
> 
> 
> 
> 
>  strict-method-invocation="false">
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (WW-4930) SMI cannot be diasabled for action-packages found via the convention-plugin

2018-04-05 Thread Philipp Heidelbach (JIRA)

[ 
https://issues.apache.org/jira/browse/WW-4930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16426780#comment-16426780
 ] 

Philipp Heidelbach edited comment on WW-4930 at 4/5/18 12:17 PM:
-

We actually don't use @Action at all. I tired it and it didn't sovle the issue. 
So to guarantee that in the pkgConfig SMI is set to the SMI value of the parent 
package i change the line 1095  in the PackageBasedActionConfigBuilder
{code:java}
    pkgConfig = new 
PackageConfig.Builder(name).namespace(actionNamespace).addParent(parentPkg);
{code}
to

 

 
{code:java}
    pkgConfig = new 
PackageConfig.Builder(name).namespace(actionNamespace).addParent(parentPkg)
    
.strictMethodInvocation(parentPkg.isStrictMethodInvocation());
{code}
which seems to solve my issue.

 

My question is therefore: Is it intended that the created pkgConfig doesn't 
inherit the SMI value of it's parent or is it a bug?

 


was (Author: heidelbach):
We actual don't use @Action at all. I tired it and it didn't sovle the issue. 
So to guarantee that in the pkgConfig SMI is set to the SMI value of the parent 
package i change the line 1095  in the PackageBasedActionConfigBuilder
{code:java}
    pkgConfig = new 
PackageConfig.Builder(name).namespace(actionNamespace).addParent(parentPkg);
{code}
to

 

 
{code:java}
    pkgConfig = new 
PackageConfig.Builder(name).namespace(actionNamespace).addParent(parentPkg)
    
.strictMethodInvocation(parentPkg.isStrictMethodInvocation());
{code}
which seems to solve my issue.

 

My question is therefore: Is it intended that the created pkgConfig doesn't 
inherit the SMI value of it's parent or is it a bug?

 

> SMI cannot be diasabled for action-packages found via the convention-plugin
> ---
>
> Key: WW-4930
> URL: https://issues.apache.org/jira/browse/WW-4930
> Project: Struts 2
>  Issue Type: Bug
>  Components: Plugin - Convention
>Affects Versions: 2.5.16
> Environment: Windows 10
> Java 1.8
>Reporter: Philipp Heidelbach
>Priority: Major
> Fix For: 2.6
>
>
> I'm trying to update Struts 2.3.34 to 2.5.16 and disabling SMI doesn't seem 
> to work.
> I debuged XmlConfigurationProvider but in the packageConfig of our package 
> (named default see below) SMI is correctly set to false. Debugging 
> PackageBaseActionConfigBuilder shows that our default-package is used as 
> parent package and in the parentPkg SMI is set to false. The pkgConfig 
> however is alwasy null (line: 1043) and so a new package config is created in 
> which SMI is set to true.
> Thus for all these actions methods i get the error that these methods aren't 
> allowed.
> If I use @AllowedMethod-annotations it works fine.
> Below the beginning of our struts.xml
> {code:xml}
> 
>  "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
> "http://struts.apache.org/dtds/struts-2.5.dtd;>
> 
> 
>  value="jar,zip,vfsfile,vfszip" />
>  value=".*/newd[-.\w]*\.jar(!/)?" />
>  value="org.apache.struts.*,org.apache.struts2.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*"
>  />
> 
>  value="applicationResources" />
> 
> 
> 
> 
> 
> 
> 
> 
>  strict-method-invocation="false">
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (WW-4930) SMI cannot be diasabled for action-packages found via the convention-plugin

2018-04-05 Thread Philipp Heidelbach (JIRA)

[ 
https://issues.apache.org/jira/browse/WW-4930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16426780#comment-16426780
 ] 

Philipp Heidelbach commented on WW-4930:


We actual don't use @Action at all. I tired it and it didn't sovle the issue. 
So to guarantee that in the pkgConfig SMI is set to the SMI value of the parent 
package i change the line 1095  in the PackageBasedActionConfigBuilder
{code:java}
    pkgConfig = new 
PackageConfig.Builder(name).namespace(actionNamespace).addParent(parentPkg);
{code}
to

 

 
{code:java}
    pkgConfig = new 
PackageConfig.Builder(name).namespace(actionNamespace).addParent(parentPkg)
    
.strictMethodInvocation(parentPkg.isStrictMethodInvocation());
{code}
which seems to solve my issue.

 

My question is therefore: Is it intended that the created pkgConfig doesn't 
inherit the SMI value of it's parent or is it a bug?

 

> SMI cannot be diasabled for action-packages found via the convention-plugin
> ---
>
> Key: WW-4930
> URL: https://issues.apache.org/jira/browse/WW-4930
> Project: Struts 2
>  Issue Type: Bug
>  Components: Plugin - Convention
>Affects Versions: 2.5.16
> Environment: Windows 10
> Java 1.8
>Reporter: Philipp Heidelbach
>Priority: Major
> Fix For: 2.6
>
>
> I'm trying to update Struts 2.3.34 to 2.5.16 and disabling SMI doesn't seem 
> to work.
> I debuged XmlConfigurationProvider but in the packageConfig of our package 
> (named default see below) SMI is correctly set to false. Debugging 
> PackageBaseActionConfigBuilder shows that our default-package is used as 
> parent package and in the parentPkg SMI is set to false. The pkgConfig 
> however is alwasy null (line: 1043) and so a new package config is created in 
> which SMI is set to true.
> Thus for all these actions methods i get the error that these methods aren't 
> allowed.
> If I use @AllowedMethod-annotations it works fine.
> Below the beginning of our struts.xml
> {code:xml}
> 
>  "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
> "http://struts.apache.org/dtds/struts-2.5.dtd;>
> 
> 
>  value="jar,zip,vfsfile,vfszip" />
>  value=".*/newd[-.\w]*\.jar(!/)?" />
>  value="org.apache.struts.*,org.apache.struts2.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*"
>  />
> 
>  value="applicationResources" />
> 
> 
> 
> 
> 
> 
> 
> 
>  strict-method-invocation="false">
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (WW-4930) SMI cannot be diasabled for action-packages found via the convention-plugin

2018-04-05 Thread Philipp Heidelbach (JIRA)

[ 
https://issues.apache.org/jira/browse/WW-4930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16426605#comment-16426605
 ] 

Philipp Heidelbach commented on WW-4930:


With SMI enabled I would have to use  or @AllowedMethods for 
all our none default action-methods which are quite a lot so I hoped with SMI 
disabled I wouldn't have to do it. All action-methodes I annotated so far are 
working fine however.

> SMI cannot be diasabled for action-packages found via the convention-plugin
> ---
>
> Key: WW-4930
> URL: https://issues.apache.org/jira/browse/WW-4930
> Project: Struts 2
>  Issue Type: Bug
>  Components: Plugin - Convention
>Affects Versions: 2.5.16
> Environment: Windows 10
> Java 1.8
>Reporter: Philipp Heidelbach
>Priority: Major
> Fix For: 2.6
>
>
> I'm trying to update Struts 2.3.34 to 2.5.16 and disabling SMI doesn't seem 
> to work.
> I debuged XmlConfigurationProvider but in the packageConfig of our package 
> (named default see below) SMI is correctly set to false. Debugging 
> PackageBaseActionConfigBuilder shows that our default-package is used as 
> parent package and in the parentPkg SMI is set to false. The pkgConfig 
> however is alwasy null (line: 1043) and so a new package config is created in 
> which SMI is set to true.
> Thus for all these actions methods i get the error that these methods aren't 
> allowed.
> If I use @AllowedMethod-annotations it works fine.
> Below the beginning of our struts.xml
> {code:xml}
> 
>  "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
> "http://struts.apache.org/dtds/struts-2.5.dtd;>
> 
> 
>  value="jar,zip,vfsfile,vfszip" />
>  value=".*/newd[-.\w]*\.jar(!/)?" />
>  value="org.apache.struts.*,org.apache.struts2.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*"
>  />
> 
>  value="applicationResources" />
> 
> 
> 
> 
> 
> 
> 
> 
>  strict-method-invocation="false">
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (WW-4930) SMI cannot be diasabled for action-packages found via the convention-plugin

2018-04-05 Thread Philipp Heidelbach (JIRA)

[ 
https://issues.apache.org/jira/browse/WW-4930?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16426575#comment-16426575
 ] 

Philipp Heidelbach commented on WW-4930:


Yes I tried that but the result was the same. The parent of pkgConfig is the 
default package with SMI set to false but in the pkgConfig itself SMI is set to 
true.

> SMI cannot be diasabled for action-packages found via the convention-plugin
> ---
>
> Key: WW-4930
> URL: https://issues.apache.org/jira/browse/WW-4930
> Project: Struts 2
>  Issue Type: Bug
>  Components: Plugin - Convention
>Affects Versions: 2.5.16
> Environment: Windows 10
> Java 1.8
>Reporter: Philipp Heidelbach
>Priority: Major
> Fix For: 2.6
>
>
> I'm trying to update Struts 2.3.34 to 2.5.16 and disabling SMI doesn't seem 
> to work.
> I debuged XmlConfigurationProvider but in the packageConfig of our package 
> (named default see below) SMI is correctly set to false. Debugging 
> PackageBaseActionConfigBuilder shows that our default-package is used as 
> parent package and in the parentPkg SMI is set to false. The pkgConfig 
> however is alwasy null (line: 1043) and so a new package config is created in 
> which SMI is set to true.
> Thus for all these actions methods i get the error that these methods aren't 
> allowed.
> If I use @AllowedMethod-annotations it works fine.
> Below the beginning of our struts.xml
> {code:xml}
> 
>  "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
> "http://struts.apache.org/dtds/struts-2.5.dtd;>
> 
> 
>  value="jar,zip,vfsfile,vfszip" />
>  value=".*/newd[-.\w]*\.jar(!/)?" />
>  value="org.apache.struts.*,org.apache.struts2.*,org.springframework.web.struts.*,org.springframework.web.struts2.*,org.hibernate.*"
>  />
> 
>  value="applicationResources" />
> 
> 
> 
> 
> 
> 
> 
> 
>  strict-method-invocation="false">
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)