You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by georz1 <re...@gmail.com> on 2008/09/12 21:33:44 UTC

ParametersInterceptor replacing spaces with %20

I've run into an odd issue recently where data posted from a form is being
saved with %20 where a space is present.

Let's say I have a form with a field named company.  The value submitted is:
Acme Company
Watching the call stack I can see that prepare is being called and the data
passed in is correct (Acme Company).  After Prepare my method of Save is
being called by the time the data gets there it is now Acme%20Company.  
Debugging through the call stack it seems that the value gets changed
somewhere between the ParametersInterceptor.setParameters() and
ParametersInterceptor.doIntercept().  

My app has been working for about a year and I have never seen this
happening and I don't recall changing something that would cause this.  I'm
hoping someone here can point me in the right direction.

This is the stack from struts.xml
       
                        <interceptor-stack name="crudStack">
                                <interceptor-ref name="exception" />
                                <interceptor-ref name="checkbox" />
                                <interceptor-ref name="params" />
                                <interceptor-ref name="login" />
                                <interceptor-ref name="static-params" />
                                <interceptor-ref name="defaultStack" />

                        </interceptor-stack>
     
Thanks,
G- 
-- 
View this message in context: http://www.nabble.com/ParametersInterceptor-replacing-spaces-with--20-tp19462652p19462652.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: ParametersInterceptor replacing spaces with %20

Posted by georz1 <re...@gmail.com>.
I figured the issue.  My form uses cookies and the cookie interceptor.  Is
it possible that the cookies interceptor is not deurlencoding values when
spaces are present

On Fri, Sep 12, 2008 at 4:07 PM, georz1 <re...@gmail.com> wrote:

> I completely agree that something that was working shouldn't all of a
> sudden stop.   I was kind of hoping someone has run into an issue like this
> before and might have pointed out some subtle change that I might have made
> and I'm just overlooking.   I've been working in the code base adding things
> like Compass/Lucene searching - I just find it strange that from calling
> Prepare -> Save the values would change and some other component like
> Compass would be the culprit.  Compass doesn't step in until it's saved to
> the database and these changes are happening before the save action is being
> called.
>
>
>
> On Fri, Sep 12, 2008 at 3:54 PM, Dave Newton <ne...@yahoo.com>wrote:
>
>> --- On Fri, 9/12/08, georz1 wrote:
>> > It's a post.  And since posting to this group I've changed
>> > from Struts 2.0.11 -> 2.0.11.2 still with the same results.
>>
>> I'm still reasonably certain it's not an S2 issue--if it were me I'd be
>> checking the change logs. If it's been working for a year and suddenly
>> stopped the framework isn't the first place I'd look.
>>
>> > About the stack that was not my intention - Are those given
>> > by struts-default?  Is that why they would be included twice.
>>
>> Yes; they're included twice because you're including them twice. The
>> interceptor-ref "defaultStack" includes the "defaultStack".
>>
>> http://struts.apache.org/2.x/docs/struts-defaultxml.html
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>

Re: ParametersInterceptor replacing spaces with %20

Posted by georz1 <re...@gmail.com>.
I completely agree that something that was working shouldn't all of a sudden
stop.   I was kind of hoping someone has run into an issue like this before
and might have pointed out some subtle change that I might have made and I'm
just overlooking.   I've been working in the code base adding things like
Compass/Lucene searching - I just find it strange that from calling Prepare
-> Save the values would change and some other component like Compass would
be the culprit.  Compass doesn't step in until it's saved to the database
and these changes are happening before the save action is being called.



On Fri, Sep 12, 2008 at 3:54 PM, Dave Newton <ne...@yahoo.com> wrote:

> --- On Fri, 9/12/08, georz1 wrote:
> > It's a post.  And since posting to this group I've changed
> > from Struts 2.0.11 -> 2.0.11.2 still with the same results.
>
> I'm still reasonably certain it's not an S2 issue--if it were me I'd be
> checking the change logs. If it's been working for a year and suddenly
> stopped the framework isn't the first place I'd look.
>
> > About the stack that was not my intention - Are those given
> > by struts-default?  Is that why they would be included twice.
>
> Yes; they're included twice because you're including them twice. The
> interceptor-ref "defaultStack" includes the "defaultStack".
>
> http://struts.apache.org/2.x/docs/struts-defaultxml.html
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: ParametersInterceptor replacing spaces with %20

Posted by Dave Newton <ne...@yahoo.com>.
--- On Fri, 9/12/08, georz1 wrote:
> It's a post.  And since posting to this group I've changed 
> from Struts 2.0.11 -> 2.0.11.2 still with the same results.

I'm still reasonably certain it's not an S2 issue--if it were me I'd be checking the change logs. If it's been working for a year and suddenly stopped the framework isn't the first place I'd look.

> About the stack that was not my intention - Are those given
> by struts-default?  Is that why they would be included twice.

Yes; they're included twice because you're including them twice. The interceptor-ref "defaultStack" includes the "defaultStack".

http://struts.apache.org/2.x/docs/struts-defaultxml.html

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: ParametersInterceptor replacing spaces with %20

Posted by georz1 <re...@gmail.com>.
Thanks for the reply Dave -

It's a post.  And since posting to this group I've changed from Struts
2.0.11 -> 2.0.11.2 still with the same results.  

About the stack that was not my intention - Are those given by
struts-default?  Is that why they would be included twice.  



newton.dave wrote:
> 
> --- On Fri, 9/12/08, georz1 wrote:
>> I've run into an odd issue recently where data posted
>> from a form is being saved with %20 where a space is present.
> 
> Is it a GET or POST form? -- It's a 
> 
>> My app has been working for about a year and I have never
>> seen this happening and I don't recall changing something 
>> that would cause this.
> 
> I'm reasonably certain that the libraries wouldn't just up and change what
> they're doing without some reason to do so: I'd check your change logs.
> 
>> This is the stack from struts.xml
>> <interceptor-stack name="crudStack">
>>   <interceptor-ref name="exception" />
>>   <interceptor-ref name="checkbox" />
>>   <interceptor-ref name="params" />
>>   <interceptor-ref name="login" />
>>   <interceptor-ref name="static-params" />
>>   <interceptor-ref name="defaultStack" />
>> </interceptor-stack>
> 
> This stack will include the "exception", "checkbox", "params", and
> "static-params" interceptors twice--is that your intention?
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ParametersInterceptor-replacing-spaces-with--20-tp19462652p19463859.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: ParametersInterceptor replacing spaces with %20

Posted by Dave Newton <ne...@yahoo.com>.
--- On Fri, 9/12/08, georz1 wrote:
> I've run into an odd issue recently where data posted
> from a form is being saved with %20 where a space is present.

Is it a GET or POST form?

> My app has been working for about a year and I have never
> seen this happening and I don't recall changing something 
> that would cause this.

I'm reasonably certain that the libraries wouldn't just up and change what they're doing without some reason to do so: I'd check your change logs.

> This is the stack from struts.xml
> <interceptor-stack name="crudStack">
>   <interceptor-ref name="exception" />
>   <interceptor-ref name="checkbox" />
>   <interceptor-ref name="params" />
>   <interceptor-ref name="login" />
>   <interceptor-ref name="static-params" />
>   <interceptor-ref name="defaultStack" />
> </interceptor-stack>

This stack will include the "exception", "checkbox", "params", and "static-params" interceptors twice--is that your intention?

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org