struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Musachy Barroso <musa...@gmail.com>
Subject Re: 2.1.6 slams a few doors shut, doesn't it?
Date Wed, 04 Feb 2009 19:07:58 GMT
Lets take one step back, are you adding this param in an interceptor
or in your action?

musachy

On Wed, Feb 4, 2009 at 1:49 PM, Adam Hardy
<ahardy.struts@cyberspaceroad.com> wrote:
> Now that 2.1.6 won't let me add to the resultConfig to add my redirect
> httpParameters myself, I figured I'd have to obtain the actual Result
> object.
>
> The way that DefaultActionInvocation is programmed to do this though makes
> it impossible, despite the Javadocs explicitly stating otherwise e.g.
> http://struts.apache.org/2.1.6/struts2-core/apidocs/com/opensymphony/xwork2/ActionInvocation.html#getResult()
>
> Then I can't call the create result method since it's not on the interface.
>
> Even when I cast the ActionInvocation and call the create method and
> faithfully add my redirect parameter, the result gets overwritten later
> anyway.
>
> It looks like I must downgrade from here - unless anyone can think of
> another way of programmatically adding the parameters to the redirect URL.
>
>
> Adam
>
>
>
>
>
> Adam Hardy on 04/02/09 16:34, wrote:
>>
>>  From the ActionConfig.Builder#build() javadoc:
>>
>> "The builder for this object.  An instance of this object is the only way
>> to construct a new instance.  The purpose is to enforce the immutability of
>> the object.  The methods are structured in a way to support chaining. After
>> setting any values you need, call the {@link #build()} method to create
>> the object."
>>
>>
>> I assume there was some issue behind the scenes with robustness.
>>
>> For the long term it would be good to have an official struts method to
>> set the HTTP params programmatically.
>>
>> What I'm going to do now is code up a Result class to extend
>> ServletActionRedirectResult - someone give me a shout if I'm barking up the
>> wrong tree.
>>
>> Thanks
>> Adam
>>
>>
>> Adam Hardy (struts) on 04/02/09 15:16, wrote:
>>>
>>> I'm prevented from adding my redirect parameter programmatically with
>>> 2.1.6!
>>>
>>> Look:
>>>
>>> Map<String, ResultConfig> resultsMap =
>>>    ServletActionContext.getActionContext(getRequest())
>>>        .getActionInvocation().getProxy().getConfig().getResults();
>>> ResultConfig config = resultsMap.get(resultName);
>>> Map<String, String> params = config.getParams();
>>> params.put(paramName, paramValue.toString());
>>>  causes:
>>> java.lang.UnsupportedOperationException
>>>    at java.util.Collections$UnmodifiableMap.put(Collections.java:1285)
>>>
>>> Or am I jumping to conclusions again?
>>>
>>> Adam
>>>
>>> --- original message author="Musachy Barroso"
>>>>
>>>> I think just need to pass a string, instead of an object in the value
>>>
>>> param.
>>>>
>>>> musachy
>>>>
>>>> On Mon, Jan 26, 2009 at 10:37 AM, Adam Hardy wrote:
>>>> Hi,
>>>>
>>>> got a compilation error after upgrading from 2.0.11 to 2.1.6 due to
>>>> changes
>>>> in com.opensymphony.xwork2.config.entities.ResultConfig
>>>>
>>>> I am doing this:
>>>>
>>>>   public boolean addRedirectParameter(String resultName, String
>>>> paramName,
>>>>       Object paramValue)
>>>>   {
>>>>       Map<String, ResultConfig> resultsMap =
>>>>           ServletActionContext.getActionContext(getRequest())
>>>>
>>>> .getActionInvocation().getProxy().getConfig().getResults();
>>>>       ResultConfig config = resultsMap.get(resultName);
>>>>       if (config == null)
>>>>       {
>>>>           return false;
>>>>       }
>>>>       else
>>>>       {
>>>>           config.addParam(paramName, paramValue);  // 2.1.6 COMPILE
>>>> ERROR
>>>>           return true;
>>>>       }
>>>>   }
>>>>
>>>>
>>>> which I can call in my actions in order to put another parameter onto
>>>> the
>>>> redirect URL of my result.
>>>>
>>>> In 2.1.6, ResultConfig has no addParam() method anymore.
>>>>
>>>> After checking the upgrade troubleshooting guide and the user lists, it
>>>> seems nobody else is suffering from this problem. Could somebody give me
an
>>>>  idea how to deal with this?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Mime
View raw message