You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Peter Kelley (JIRA)" <ji...@apache.org> on 2009/03/07 07:30:45 UTC

[jira] Created: (WW-3024) Validation XML file names when action name has slashes

Validation XML file names when action name has slashes
------------------------------------------------------

                 Key: WW-3024
                 URL: https://issues.apache.org/struts/browse/WW-3024
             Project: Struts 2
          Issue Type: Bug
          Components: XML Validators
    Affects Versions: 2.1.6
         Environment: struts 2.1.6, Tomcat 6.0, Spring 2.5.6
            Reporter: Peter Kelley


I have a generic struts.xml action configuration as follows:
...
    <constant name="struts.enable.SlashesInActionNames" value="true"/>
...
        <action name="*/*/*" method="{3}"
                class="{1}Controller">
                <result name="Search">/{1}/search{2}.jsp</result>
                <result name="Not Found">/{1}/search{2}.jsp</result>
                <result name="List">/{1}/list{2}.jsp</result>
                <result name="Show">/{1}/show{2}.jsp</result>
                <result name="Edit">/{1}/edit{2}.jsp</result>
                <result name="input">/{1}/edit{2}.jsp</result>
        </action>

I want to add validation XML for specific contexts by setting up validation.xml files. Unfortunately the invocation context in this case contains slashes so that the name of the file that the validation framework is looking for is invalid. For instance if I was executing the action posting/Posting/save on the action class PostingController then I want the validation.xml to be named:

PostingController-posting-Posting-save-validation.xml rather

rather than:

PostingController-posting/Posting/save-validation.xml

which is an invalid file name. To achieve this I propose that the following method defined at line 205 of com.opensymphony.xwork2.validator.AnnotationActionValidatorManager be changed from:

    private  List<ValidatorConfig> buildAliasValidatorConfigs(Class aClass, String context, boolean checkFile) {
        String fileName = aClass.getName().replace('.', '/') + "-" + context + VALIDATION_CONFIG_SUFFIX;
 	
        return loadFile(fileName, aClass, checkFile);
    }

to

    private  List<ValidatorConfig> buildAliasValidatorConfigs(Class aClass, String context, boolean checkFile) {
        String fileName = aClass.getName().replace('.', '/') + "-" + context.replace('/', '-') + VALIDATION_CONFIG_SUFFIX;

        return loadFile(fileName, aClass, checkFile);
    }


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-3024) Validation XML file names when action name has slashes

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-3024?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso updated WW-3024:
--------------------------------

    Fix Version/s: 2.1.7

I agree with the proposed solution. Moving to 2.1.7

> Validation XML file names when action name has slashes
> ------------------------------------------------------
>
>                 Key: WW-3024
>                 URL: https://issues.apache.org/struts/browse/WW-3024
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.1.6
>         Environment: struts 2.1.6, Tomcat 6.0, Spring 2.5.6
>            Reporter: Peter Kelley
>             Fix For: 2.1.7
>
>
> I have a generic struts.xml action configuration as follows:
> ...
>     <constant name="struts.enable.SlashesInActionNames" value="true"/>
> ...
>         <action name="*/*/*" method="{3}"
>                 class="{1}Controller">
>                 <result name="Search">/{1}/search{2}.jsp</result>
>                 <result name="Not Found">/{1}/search{2}.jsp</result>
>                 <result name="List">/{1}/list{2}.jsp</result>
>                 <result name="Show">/{1}/show{2}.jsp</result>
>                 <result name="Edit">/{1}/edit{2}.jsp</result>
>                 <result name="input">/{1}/edit{2}.jsp</result>
>         </action>
> I want to add validation XML for specific contexts by setting up validation.xml files. Unfortunately the invocation context in this case contains slashes so that the name of the file that the validation framework is looking for is invalid. For instance if I was executing the action posting/Posting/save on the action class PostingController then I want the validation.xml to be named:
> PostingController-posting-Posting-save-validation.xml rather
> rather than:
> PostingController-posting/Posting/save-validation.xml
> which is an invalid file name. To achieve this I propose that the following method defined at line 205 of com.opensymphony.xwork2.validator.AnnotationActionValidatorManager be changed from:
>     private  List<ValidatorConfig> buildAliasValidatorConfigs(Class aClass, String context, boolean checkFile) {
>         String fileName = aClass.getName().replace('.', '/') + "-" + context + VALIDATION_CONFIG_SUFFIX;
>  	
>         return loadFile(fileName, aClass, checkFile);
>     }
> to
>     private  List<ValidatorConfig> buildAliasValidatorConfigs(Class aClass, String context, boolean checkFile) {
>         String fileName = aClass.getName().replace('.', '/') + "-" + context.replace('/', '-') + VALIDATION_CONFIG_SUFFIX;
>         return loadFile(fileName, aClass, checkFile);
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-3024) Validation XML file names when action name has slashes

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-3024?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-3024.
---------------------------------

    Resolution: Fixed

Fixed in xwork trunk r1973. thanks for reporting

> Validation XML file names when action name has slashes
> ------------------------------------------------------
>
>                 Key: WW-3024
>                 URL: https://issues.apache.org/struts/browse/WW-3024
>             Project: Struts 2
>          Issue Type: Bug
>          Components: XML Validators
>    Affects Versions: 2.1.6
>         Environment: struts 2.1.6, Tomcat 6.0, Spring 2.5.6
>            Reporter: Peter Kelley
>             Fix For: 2.1.7
>
>
> I have a generic struts.xml action configuration as follows:
> ...
>     <constant name="struts.enable.SlashesInActionNames" value="true"/>
> ...
>         <action name="*/*/*" method="{3}"
>                 class="{1}Controller">
>                 <result name="Search">/{1}/search{2}.jsp</result>
>                 <result name="Not Found">/{1}/search{2}.jsp</result>
>                 <result name="List">/{1}/list{2}.jsp</result>
>                 <result name="Show">/{1}/show{2}.jsp</result>
>                 <result name="Edit">/{1}/edit{2}.jsp</result>
>                 <result name="input">/{1}/edit{2}.jsp</result>
>         </action>
> I want to add validation XML for specific contexts by setting up validation.xml files. Unfortunately the invocation context in this case contains slashes so that the name of the file that the validation framework is looking for is invalid. For instance if I was executing the action posting/Posting/save on the action class PostingController then I want the validation.xml to be named:
> PostingController-posting-Posting-save-validation.xml rather
> rather than:
> PostingController-posting/Posting/save-validation.xml
> which is an invalid file name. To achieve this I propose that the following method defined at line 205 of com.opensymphony.xwork2.validator.AnnotationActionValidatorManager be changed from:
>     private  List<ValidatorConfig> buildAliasValidatorConfigs(Class aClass, String context, boolean checkFile) {
>         String fileName = aClass.getName().replace('.', '/') + "-" + context + VALIDATION_CONFIG_SUFFIX;
>  	
>         return loadFile(fileName, aClass, checkFile);
>     }
> to
>     private  List<ValidatorConfig> buildAliasValidatorConfigs(Class aClass, String context, boolean checkFile) {
>         String fileName = aClass.getName().replace('.', '/') + "-" + context.replace('/', '-') + VALIDATION_CONFIG_SUFFIX;
>         return loadFile(fileName, aClass, checkFile);
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.