-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Using Validator to change fields
PostPosted: Fri Apr 13, 2012 12:30 pm 
Pro
Pro

Joined: Wed Nov 05, 2003 7:22 pm
Posts: 211
Hi,

I use Validator to check for some things such as XSS style attacks and HTML tags that I don't like in some content.
@CheckXSS

In these cases, I need to filter this content and I'm doing that after the validation executes. However, the problems is that if I execute both a HTML Filter and a Length validator, the Lenght validator executes on the original textual content and not the filtered content and may therefore generate a constraint violation when it shouldn't.

Changing the order of the validation doesn't matter because it doesn't the filtering happens after validation. Ideally, I would change the field during the validation process. However, the field value is a copy of the original and not a reference itself. Besides, doing that seems like an ugly hack.

The most reasonable solution I can think of is to create a group interface(ChangeContent.class) and execute this validation before everything else, filter based on the results and then run normal validation. But that would mean adding that group interface to all @CheckXSS(groups={ChangeContent.class}) style tags. A bit ugly also.

Any better suggestions out there?

Kind regards,
Marc


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.