You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Alexander Klimetschek (JIRA)" <ji...@apache.org> on 2013/03/29 16:29:16 UTC

[jira] [Comment Edited] (SLING-2803) Create a Validation module capable of validating POST requests or Resources

    [ https://issues.apache.org/jira/browse/SLING-2803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13617427#comment-13617427 ] 

Alexander Klimetschek edited comment on SLING-2803 at 3/29/13 3:28 PM:
-----------------------------------------------------------------------

Since it's based on resource types already, I could imagine to hook this into the sling POST servlet by having a post processor that will look up validators based on the resource types of modified nodes. Then it's a clear simple approach at least for JCR based Sling apps, which are encouraged to use the sling POST servlet.

If you have to support validators for arbitrary servlets with arbitrary request parameters, that's a much more complex field, and then it's simpler to have those specific servlets implement their validation directly (maybe there is some validation utility code to share here). But for a full-blown validation system, I'd go for the post servlet, acting based on what was written to the transient session, but not saved yet.

I can imagine that the resource type might not always be available, so I could imagine that preprocessing servlets that forward internally to the sling post servlet (good practice IMHO, reusing the post servlet) might set specific configured validators to use in a request attribute, which would be picked up by that post processor.

WDYT?

And I wonder if that's something that could later be hooked into Oak (Jackrabbit 3) which has pluggable validators (on session commits) AFAIK.
                
      was (Author: alexander.klimetschek):
    Since it's based on resource types already, I could imagine to hook this into the sling POST servlet by having a post processor that will look up validators based on the resource types of modified nodes. Then it's a clear simple approach at least for JCR based Sling apps, which are encouraged to use the sling POST servlet all the time.

If you have to support validators for arbitrary servlets with arbitrary request parameters, that's a much more complex field, and then it's simpler to have those specific servlets implement their validation directly (maybe there is some validation utility code to share here). But for a full-blown validation system, I'd go for the post servlet, acting based on what was written to the transient session, but not saved yet.

I can imagine that the resource type might not always be available, so I could imagine that preprocessing servlets that forward internally to the sling post servlet (good practice IMHO, reusing the post servlet) might set specific configured validators to use in a request attribute, which would be picked up by that post processor.

WDYT?

And I wonder if that's something that could later be hooked into Oak (Jackrabbit 3) which has pluggable validators (on session commits) AFAIK.
                  
> Create a Validation module capable of validating POST requests or Resources
> ---------------------------------------------------------------------------
>
>                 Key: SLING-2803
>                 URL: https://issues.apache.org/jira/browse/SLING-2803
>             Project: Sling
>          Issue Type: New Feature
>            Reporter: Radu Cotescu
>
> Several Sling users have asked in the past [1] about a Validation mechanism in Sling that's able to validate data coming from the user. However, such a module is still missing.
> This issue is meant to track the work progress on such a module.
> Ideally the module should be able to validate both request parameters and Resources, by obtaining their properties via a ValueMap and provide feedback in case of a validation error.
> [1] - http://sling.markmail.org/search/?q=validation

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira