You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stephen Turner <st...@MIT.EDU> on 2010/08/24 16:23:55 UTC

Interceptor - Dynamically Add Result Config to Action Config

I have a Struts 2.0 interceptor that dynamically creates a result config  
and adds it to the action config. It does it like this:

   String newResult = "shRes";
   ResultConfig cfg = new ResultConfig(newResult,  
ServletRedirectResult.class.getName());
   cfg.addParam("location", "SearchHelp.action?"+request.getQueryString());
			
   actionInvocation.getProxy().getConfig().addResultConfig(cfg);

   return newResult;

Now I'm upgrading to Struts 2.2 and I'm finding that this no longer  
compiles due to Struts/Xwork refactoring.

I've been able to create a ResultConfig object using ResultConfig.Builder  
but I can't find how to add this to the interceptor's action config /  
context.

Can anyone give me a pointer?

Thanks,
Steve

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


Re: Interceptor - Dynamically Add Result Config to Action Config

Posted by Dave Newton <da...@gmail.com>.
On Tue, Aug 24, 2010 at 11:34 AM, Martin Gainty <mg...@hotmail.com> wrote:

> someone promoted 2.2 from Alpha to GA while i was working on something else
> ...we need to take a look at this asap how did this bug slip between the
> cracks of the testcases?
>

What makes you think it's a bug? "Someone" promoted from alpha?! While you
were working on something else? Are you a committer now?

Dave

RE: Interceptor - Dynamically Add Result Config to Action Config

Posted by Martin Gainty <mg...@hotmail.com>.
someone promoted 2.2 from Alpha to GA while i was working on something else ...we need to take a look at this asap
how did this bug slip between the cracks of the testcases?
 
thanks for catching this bug steve!
Martin 
______________________________________________ 
Note de déni et de confidentialité

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.



 

> To: user@struts.apache.org; mgainty@hotmail.com
> Subject: Re: Interceptor - Dynamically Add Result Config to Action Config
> Date: Tue, 24 Aug 2010 11:17:47 -0400
> From: sturner@MIT.EDU
> 
> On Tue, 24 Aug 2010 10:59:29 -0400, Martin Gainty <mg...@hotmail.com> 
> wrote:
> 
> >
> > //reiterate 2.1.8 functionality:
> > com.opensymphony.xwork2.ActionInvocation action_invocation;
> > ActionProxy proxy=action_invocation.getProxy()
> > ActionConfig config =proxy.getConfig();
> 
> > //where ActionConfig contains the addResultConfig method
> > public Builder addResultConfig(ResultConfig resultConfig) {
> > target.results.put(resultConfig.getName(), resultConfig);
> > return this;
> > }
> 
> There's my problem - ActionConfig no longer exposes addResultConfig. This 
> method is now in the Builder inner class and only operates on a new 
> ActionConfig object (as far as I can see), whereas I want to add a result 
> to an existing ActionConfig.
> 
> Steve
> 
> 
> > //Struts 2.2 is in Alpha Stage if the functionality is absent can you 
> > file a JIRA?
> 
> Struts 2.2. is now a GA release.
> 
> Steve
 		 	   		  

Re: Interceptor - Dynamically Add Result Config to Action Config

Posted by Stephen Turner <st...@MIT.EDU>.
On Tue, 24 Aug 2010 10:59:29 -0400, Martin Gainty <mg...@hotmail.com>  
wrote:

>
> //reiterate 2.1.8 functionality:
> com.opensymphony.xwork2.ActionInvocation action_invocation;
> ActionProxy proxy=action_invocation.getProxy()
> ActionConfig config =proxy.getConfig();

> //where ActionConfig contains the addResultConfig method
>         public Builder addResultConfig(ResultConfig resultConfig) {
>             target.results.put(resultConfig.getName(), resultConfig);
>             return this;
>         }

There's my problem - ActionConfig no longer exposes addResultConfig. This  
method is now in the Builder inner class and only operates on a new  
ActionConfig object (as far as I can see), whereas I want to add a result  
to an existing ActionConfig.

Steve


> //Struts 2.2 is in Alpha Stage if the functionality is absent can you  
> file a JIRA?

Struts 2.2. is now a GA release.

Steve

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


Re: Interceptor - Dynamically Add Result Config to Action Config

Posted by Dave Newton <da...@gmail.com>.
On Tue, Aug 24, 2010 at 10:59 AM, Martin Gainty <mg...@hotmail.com> wrote:

> //Struts 2.2 is in Alpha Stage if the functionality is absent can you file
> a JIRA?
>

If by "alpha" you mean "has a 2.2.1 point GA release", sure.

Dave

RE: Interceptor - Dynamically Add Result Config to Action Config

Posted by Martin Gainty <mg...@hotmail.com>.
//reiterate 2.1.8 functionality:
com.opensymphony.xwork2.ActionInvocation action_invocation;
ActionProxy proxy=action_invocation.getProxy()
ActionConfig config =proxy.getConfig();
//where ActionConfig contains the addResultConfig method
        public Builder addResultConfig(ResultConfig resultConfig) {
            target.results.put(resultConfig.getName(), resultConfig);
            return this;
        }
//Struts 2.2 is in Alpha Stage if the functionality is absent can you file a JIRA?
https://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&mode=hide&sorter/order=DESC&sorter/field=priority&resolution=-1&pid=12311041&fixfor=12315200
 
While i have you on the line I got pinged for this Struts job in greater DC area (i cannot go as i have doctors appts in Mass until Oct 1)
 
To: mgainty@hotmail.com
Date: Thu, 19 Aug 2010 16:27:15 -0400
Subject: CareerBuilder: Sr Java/Struts 2.x Developer Opening!!!













 











CareerBuilder: Sr Java/Struts 2.x Developer Opening!!!
 






Hi Martin Gainty

My name is Tyrone Houston and I am a Senior IT Recruiter for CDI IT Solutions (www.cdicorp.com)

We are currently looking for a Sr Java/Struts 2.x Developer for a contract to permanent position with this Fortune 500 company.

PLEASE NO H1-Visa's or CORP2CORP!!!

Location: Columbia, MD

Hourly Rate: up to $60/hr, depending on experience

Base Salary: $95,000 to $104,000 plus benefits








Job Duties & Responsibilities:     70% developement/coding, 30% lead experience.
We are seeking a Senior Java developer with +7 years experience in web front end and services development and support in our Columbia, MD office. 

The candidate should have the following skills: 
- +7 years of Java Development with +5 years working on large complex systems 
- Experience serving as a senior developer, architect, and technical lead 
- Excellent problem solving and debugging skills 
- Experience with system architecture and design 
- Ability to integrate complex financial systems 
- Experience with Java 5 or higher 
- Experience with common Java application development related technologies - Struts 2.0, Servlets, MVC, and OO Design Patterns    
Required Skills:     Skills ranked in order:
1. Java 5 & 6
2. Object Oriented Design
3. Struts v2.x, Google Webtools, SPring MVC
4. Ajax
-Front End Web developement
-Worked in either the financial inducstry or worked on LARGE e-Commerce sites
- Self starter with the initiative to work with little supervision 
- Ability to work both independently and within a team environment 
- Ability to review, oversee, and mentor junior java developers 
- Excellent written, verbal, and communication skills 
- Ability to meet frequent deadlines in a fast moving environment 
   
# of Years Required:     5+ years of Java experience in web front end and services development with 3+ years working on large complex systems.
Experience with Java 5 or higher.    
Preferred Skills:     - Recent financial services experience 
- Experience with JDBC, SQL, JavaScript, and JSP
Work within JBoss, WebLogic, and WebSphere application server environments

INTERESTED!!! 
Then please email me a MS Word version of your resume and I will contact you should your qualifications be a match for this job requirement. 

Tyrone Houston 
Senior IT Recruiter
CDI IT Solutions 
1040 Crown Pointe Parkway 
Suite 600
Atlanta, GA  30338 
Direct: 770-481-4690
Toll Free: 866-210-1773 ext. 4690
tyrone.houston@cdicorp.com
HTH,
Martin Gainty 
______________________________________________ 
Note de déni et de confidentialité

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.



 

> To: user@struts.apache.org
> Date: Tue, 24 Aug 2010 10:23:55 -0400
> Subject: Interceptor - Dynamically Add Result Config to Action Config
> From: sturner@MIT.EDU
> 
> I have a Struts 2.0 interceptor that dynamically creates a result config 
> and adds it to the action config. It does it like this:
> 
> String newResult = "shRes";
> ResultConfig cfg = new ResultConfig(newResult, 
> ServletRedirectResult.class.getName());
> cfg.addParam("location", "SearchHelp.action?"+request.getQueryString());
> 
> actionInvocation.getProxy().getConfig().addResultConfig(cfg);
> 
> return newResult;
> 
> Now I'm upgrading to Struts 2.2 and I'm finding that this no longer 
> compiles due to Struts/Xwork refactoring.
> 
> I've been able to create a ResultConfig object using ResultConfig.Builder 
> but I can't find how to add this to the interceptor's action config / 
> context.
> 
> Can anyone give me a pointer?
> 
> Thanks,
> Steve
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
 		 	   		  

Re: Interceptor - Dynamically Add Result Config to Action Config

Posted by Stephen Turner <st...@MIT.EDU>.
On Tue, 24 Aug 2010 12:44:36 -0400, Dale Newfield <da...@newfield.org>  
wrote:

> The execAndWait interceptor used to do something like this for the
> "wait" result--I'd look there for how it works around the change
> requiring these be immutable.
>
> -Dale

Thanks Dale - that helped me figure it out.

We can no longer alter the config inside an interceptor; this is a feature  
(see WW-3068).

What I now do in my case (I was inserting a redirect result into the  
config) is inject the redirect result into the container:

   ServletRedirectResult srd = new ServletRedirectResult();
   container.inject(srd);
   srd.setLocation("SearchHelp.action?"+request.getQueryString());
   srd.setPrependServletContext(true);
   srd.execute(actionInvocation);		
   return Action.NONE;

This is similar to the injection of the FreeMarkerResult in execAndWait.

Thanks,
Steve

-- 
Stephen Turner
Senior Programmer/Analyst - MIT IS&T

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


Re: Interceptor - Dynamically Add Result Config to Action Config

Posted by Dale Newfield <da...@newfield.org>.
The execAndWait interceptor used to do something like this for the 
"wait" result--I'd look there for how it works around the change 
requiring these be immutable.

-Dale

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