You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marco Mistroni <mm...@waersystems.com> on 2005/05/03 10:26:57 UTC

Struts 1.3 & custom controller

Hello all,
	I have downloaded strutsws by Frank Zammetti, which
Enables struts app to be exposed as a webservice..
It uses a custom controller(pls frank correct me if I m wrong) that
Detects if request is an XML request...customizing then output so that
it
Will be an XML response that matches form data.

Application works fine with Struts 1.1.. I have just written a
<controller>
Tag in struts-config and a  plugin used by strutsws.

I found problems however with Struts 1.3, and I was wondering if, in
Struts 1.3, was enough to define a  <controller> tag in
struts-config.xml
Or something else was needed..


Thanx in advance and regards
	Marco



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


RE: Struts 1.3 & custom controller

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Yep, that's exactly what you should be able to do.  And if you decide to
go off and do it, do feel free to feed it back to me for release on the
strusws SF project :)

Here's some links to get you started:

http://www.onjava.com/pub/a/onjava/2005/03/02/commonchains.html
http://www.onjava.com/pub/a/onjava/2005/03/02/commonchains2.html

Your really looking at Commons Chain, which forms the basis of 1.3.  As I
said, I haven't toyed with 1.3 much, so in terms of how this really
applies to 1.3 in detail I don't know of any link to help there.  Maybe
one of the struts team members can direct you...

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Tue, May 3, 2005 10:24 am, Marco Mistroni said:
> Hello Frank,
> 	If  Str1.3 RP is implemented as set of commands, then shouldn't
> I be able to extend It to add my own commands (such as one that does the
> trick
> In your request processor)..
>
> I think it should be possible.... at least I would like to support J2ME
> clients (via strutsws), HTML clients and WML clients for my
> application..
>
> So I could define a RP which contains set of commands for handling
> request depending on the user agent..
>
> I need just some docs for Struts 1.3 Request Processor.......
>
> Any good links (other than sourcecode)?
>
> Thanx in advance and regards
> 	Marco
>
>
> -----Original Message-----
> From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
> Sent: 03 May 2005 14:40
> To: Marco Mistroni
> Cc: 'Struts Users Mailing List'
> Subject: Re: Struts 1.3 & custom controller
>
> Hi Marco,
>
> You are correct, the custom controller is at the heart of strutsws.
>
> I hesitate to answer about 1.3 because I've only looked at it very
> briefly.  But, I'll try and answer and if someone more knowledgable sees
> me flub something, please correct me...
>
> Remember that 1.3 uses the CoR pattern to break down the request
> processor
> into a chain of functions.  It is designed to be functionally equivalent
> to the "current" request processor, but defined as a chain of Commands.
>
> I seem to recall a thread at one point that said you still could in fact
> use a custom monolithic processor... if that's not true than the bottom
> line is simply that no, strutsws as it exists today will not be usable
> with 1.3.
>
> Let's assume however that I am remembering correctly and you CAN do
> that... you'd still be inserting the 1.1 RP into the mix, which I'd bet
> isn't what you really want to do.  It is also worth noting that I never
> did a strutsws version for the Tiles processor, so Tiles and strutsws
> don't mix at this point.  This hasn't been a big problem for most people
> apparently (I guess they just set up a separate module for the web
> services, I don't really know)...
>
> ...which does kind of raise an interesting question... assuming you can
> use a non-chain RP in 1.3, it might be possible to just use the 1.1 RP
> in
> a module for your web services.  If it's a module expressly for strutsws
> functions, which RP you use might not matter as much (I could be wrong
> though... there could have been some changes between 1.1 and 1.3 that
> makes it not work, I frankly don't know).  I've never tied such a setup,
> so I have no idea if it'll actually work.
>
> Lastly, I do have the intention of updating strutsws specifically for
> 1.3
> (it should be a piece of cake to insert a command or two into the chain
> to
> perform the necessary functions), but I won't do that until 1.3 is a GA
> release.  I actualy thought I wrote it against 1.2.4, I didn't realize
> it
> was 1.1, so the first chance I get I will update it for 1.2.4 at
> least...
> I only intend to support GA releases for strutsws as well as ajaxtags by
> the way.
>
> Hope that helps!
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
> On Tue, May 3, 2005 4:26 am, Marco Mistroni said:
>> Hello all,
>> 	I have downloaded strutsws by Frank Zammetti, which
>> Enables struts app to be exposed as a webservice..
>> It uses a custom controller(pls frank correct me if I m wrong) that
>> Detects if request is an XML request...customizing then output so that
>> it
>> Will be an XML response that matches form data.
>>
>> Application works fine with Struts 1.1.. I have just written a
>> <controller>
>> Tag in struts-config and a  plugin used by strutsws.
>>
>> I found problems however with Struts 1.3, and I was wondering if, in
>> Struts 1.3, was enough to define a  <controller> tag in
>> struts-config.xml
>> Or something else was needed..
>>
>>
>> Thanx in advance and regards
>> 	Marco
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


RE: Struts 1.3 & custom controller

Posted by Marco Mistroni <mm...@waersystems.com>.
Hello all,
	I have an app that was using  strutsws from Frank Zammetti, and
I am trying to port it to Struts 1.3..
The current version of strutsws override Struts's result processor, and
in particular it overrides those following methods:
- processPreprocess
- processValidate
- processActionPerform
- processMapping
- processException

I had a look at Struts 1.3 core, and how chain &
ComposableRequestProcessor
Are used instead of old request processor, and in evaluating what to
write, which class to extend and wht changes to do I got a littlebit
stuck...

So far, I got to this conclusions, and I was wondering if someone can
check
Them as well as help me in some points

- preprocess().: this does some logic depending on request, eventually
modifying the path in order to append additional parameters... so I
thought
to extend org.apache.struts.chain.command.servlet.PerformForward 

- processValidate: in the method, code needs to validate a SOAPRequest,
so I thought to extend
org.apache.struts.chain.command.servlet.ValidateActionForm

- processActionPerform(): this metod was supposed to redirect to a
custom page after action has done its job and, so I thought that I need
to extend
org.apache.struts.chain.command.servlet.SelectForward


- processMapping(): ?. I really don't know which class to extend / write
for this... below are the javadoc comments.. I was not able to identify
similar
functionality in commands of Struts 1.3.. anyone can help?

/**
 * This method will override the processMapping() method in the base
 * RequestProcessor class.  When we service a Web Service request, we
will
be
 * overriding the input that might be specified in the ActionMapping so
that
* we can properly handle form validation failures.  Problem is, since
the
 * ActionMapping returned by the super version of this method is shared
by
 * all requests, anything that we might alter could impact them all.
For
 * instance, if a Web Service request comes in, it would work fine
without
 * this, but if a regular request comes in for the same action next time
 * and a validation failure occurs, the input page will be an XML
response,
 * which would of course be wrong.  So, here we will determine if we are
 * servicing a Web Service request or not, and if we are we'll return a
 * clone of the mapping, otherwise we'll return the real mapping that
the
 * call to the super version gives us.



- processException(): here I suppose I need to extend
org.apache.struts.chain.command.servlet.ExceptionHandler....


Frank, you might be able to provide more clarifications or correct me if
I was wrong in my explanations.....  I had a look yesterday at
WSRequestProcessor after 3 days on holiday in sunshine.... maybe my
brain boiled a little bit in the sun :-)


Thanx in advance and regards
	marco







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


RE: Struts 1.3, chain & command configuration / few thoughts..

Posted by Joe Germuska <Jo...@Germuska.com>.
At 12:00 PM +0100 5/4/05, Marco Mistroni wrote:
>Hello joe,
>>So really, all you should need to do is write a custom subclass of
>>ComposableRequestProcessor which gets its base CatalogFactory from
>>Spring during the init method.   Then, you'd have to adapt the
>>default chain-config.xml into Spring's bean-factory XML syntax so as
>>to create a CatalogFactory and register the "struts" catalog all in
>>Spring.
>
>That's true... but spring & appContext are initialized only after
>The spring plugIn has been initialized, and I was wondering, are
>plugIn initialized AFTER ComposableRequestProcessor?
>Because, if it is so, then I am out of business :-)

Ah, yeah.  I've been using the ContextLoaderListener instead.

The other thing you could do in your RequestProcessor is lazily look 
up the CatalogFactory.  If you made sure that the instantiation in 
Spring was not lazy and was not a singleton then I guess you could 
retrieve it from the ApplicationContext on each request with no big 
issues.

It's possible that I still didn't quite get the 
ComposableRequestProcessor right for that kind of use case -- I'd 
have to look -- but I think you can still get there...

Joe



>
>Regards
>	marco
>
>
>
>
>
>
>
>
>
>Joe
>
>
>
>At 10:48 AM +0100 5/4/05, Marco Mistroni wrote:
>>Hello all,
>>	I am currently using Struts 1.3dev in my application, and I have
>>recently bothered the list to find a way to configure commands via
>>Spring.
>>Now, just yesterday, I came across an article
>>(http://www.onjava.com/pub/a/onjava/2005/03/02/commonchains2.html)
>>on how The new RequestProcessor is used in Struts 1.3...
>>Struts 1.3 uses a chain-config.xml and custom chan configs that allows
>>user
>>To 'override' or change the behaviour of request processor.
>>
>>Following that article I have implemented my custom command for
>>pre-processing in RequestProcessor (as showed in article).
>>
>>Question is: what if I want to use some of my spring beans in one of
>>those
>>'request processor' commands?
>>
>>Currently, in my app, I am using commands for doing various logic, and
>>those
>>Commands are configured via Spring by using a Spring plugin..
>>
>>But I am not sure I can do same with RequestProcessor commands, since
>>the chain-config.xml file is read at initialization time, when I
>suppose
>>the Spring plugin has not been initialized yet... so the bean won't be
>>available..
>>
>>If I remember correct, there's a way in Spring to say that a 'bean'
>will
>>be initialized only after  'beanx' has been initialized (I guess is a
>>'depend' attribute ein applicationContext.xml)..
>>
>>But will this work for RequestProcessor commands?
>>
>>Hope I was clear enough to explain my problem...
>>
>>Thanx in advance and regars
>>	marco
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>
>
>--
>Joe Germuska           
>Joe@Germuska.com 
>http://blog.germuska.com   
>"Narrow minds are weapons made for mass destruction"  -The Ex
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex

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


RE: Struts 1.3, chain & command configuration / few thoughts..

Posted by Marco Mistroni <mm...@waersystems.com>.
Hello joe,
>So really, all you should need to do is write a custom subclass of 
>ComposableRequestProcessor which gets its base CatalogFactory from 
>Spring during the init method.   Then, you'd have to adapt the 
>default chain-config.xml into Spring's bean-factory XML syntax so as 
>to create a CatalogFactory and register the "struts" catalog all in 
>Spring.

That's true... but spring & appContext are initialized only after
The spring plugIn has been initialized, and I was wondering, are 
plugIn initialized AFTER ComposableRequestProcessor? 
Because, if it is so, then I am out of business :-)


Regards
	marco









Joe



At 10:48 AM +0100 5/4/05, Marco Mistroni wrote:
>Hello all,
>	I am currently using Struts 1.3dev in my application, and I have
>recently bothered the list to find a way to configure commands via
>Spring.
>Now, just yesterday, I came across an article
>(http://www.onjava.com/pub/a/onjava/2005/03/02/commonchains2.html)
>on how The new RequestProcessor is used in Struts 1.3...
>Struts 1.3 uses a chain-config.xml and custom chan configs that allows
>user
>To 'override' or change the behaviour of request processor.
>
>Following that article I have implemented my custom command for
>pre-processing in RequestProcessor (as showed in article).
>
>Question is: what if I want to use some of my spring beans in one of
>those
>'request processor' commands?
>
>Currently, in my app, I am using commands for doing various logic, and
>those
>Commands are configured via Spring by using a Spring plugin..
>
>But I am not sure I can do same with RequestProcessor commands, since
>the chain-config.xml file is read at initialization time, when I
suppose
>the Spring plugin has not been initialized yet... so the bean won't be
>available..
>
>If I remember correct, there's a way in Spring to say that a 'bean'
will
>be initialized only after  'beanx' has been initialized (I guess is a
>'depend' attribute ein applicationContext.xml)..
>
>But will this work for RequestProcessor commands?
>
>Hope I was clear enough to explain my problem...
>
>Thanx in advance and regars
>	marco
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex

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


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


Re: Struts 1.3, chain & command configuration / few thoughts..

Posted by Joe Germuska <Jo...@Germuska.com>.
Hi, Marco:

Since you first brought up using Spring to configure the chain, that 
has been on the back of my mind.  Probably like you, as I use Spring 
more in an application I find it frustrating to bump up against 
places where I can't seem to connect to the ApplicationContext or 
otherwise use Spring's DI services.

I haven't needed what you describe yet, but I've been thinking about 
it.  I've made a few changes both to commons-chain and Struts and I 
think the path is now clear, although you'll still have to write some 
code.

Last week I committed changes to commons-chain LookupCommand and the 
base Struts RequestProcessor which expose the CatalogFactory as a 
settable property.  This gets around the fundamental problem of 
having them always go to the static CatalogFactory instance managed 
by the CatalogFactory class.  Now you can have both of them use a CF 
created by Spring.

So really, all you should need to do is write a custom subclass of 
ComposableRequestProcessor which gets its base CatalogFactory from 
Spring during the init method.   Then, you'd have to adapt the 
default chain-config.xml into Spring's bean-factory XML syntax so as 
to create a CatalogFactory and register the "struts" catalog all in 
Spring.

Until/unless Struts actually has a dependency upon Spring, I'm not 
sure that we can do much more in the core library itself.  But I 
think you can get there if you want to.

Joe



At 10:48 AM +0100 5/4/05, Marco Mistroni wrote:
>Hello all,
>	I am currently using Struts 1.3dev in my application, and I have
>recently bothered the list to find a way to configure commands via
>Spring.
>Now, just yesterday, I came across an article
>(http://www.onjava.com/pub/a/onjava/2005/03/02/commonchains2.html)
>on how The new RequestProcessor is used in Struts 1.3...
>Struts 1.3 uses a chain-config.xml and custom chan configs that allows
>user
>To 'override' or change the behaviour of request processor.
>
>Following that article I have implemented my custom command for
>pre-processing in RequestProcessor (as showed in article).
>
>Question is: what if I want to use some of my spring beans in one of
>those
>'request processor' commands?
>
>Currently, in my app, I am using commands for doing various logic, and
>those
>Commands are configured via Spring by using a Spring plugin..
>
>But I am not sure I can do same with RequestProcessor commands, since
>the chain-config.xml file is read at initialization time, when I suppose
>the Spring plugin has not been initialized yet... so the bean won't be
>available..
>
>If I remember correct, there's a way in Spring to say that a 'bean' will
>be initialized only after  'beanx' has been initialized (I guess is a
>'depend' attribute ein applicationContext.xml)..
>
>But will this work for RequestProcessor commands?
>
>Hope I was clear enough to explain my problem...
>
>Thanx in advance and regars
>	marco
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org


-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex

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


Struts 1.3, chain & command configuration / few thoughts..

Posted by Marco Mistroni <mm...@waersystems.com>.
Hello all,
	I am currently using Struts 1.3dev in my application, and I have
recently bothered the list to find a way to configure commands via
Spring.
Now, just yesterday, I came across an article
(http://www.onjava.com/pub/a/onjava/2005/03/02/commonchains2.html)
on how The new RequestProcessor is used in Struts 1.3...
Struts 1.3 uses a chain-config.xml and custom chan configs that allows
user
To 'override' or change the behaviour of request processor.

Following that article I have implemented my custom command for
pre-processing in RequestProcessor (as showed in article).

Question is: what if I want to use some of my spring beans in one of
those
'request processor' commands?

Currently, in my app, I am using commands for doing various logic, and
those
Commands are configured via Spring by using a Spring plugin..

But I am not sure I can do same with RequestProcessor commands, since
the chain-config.xml file is read at initialization time, when I suppose
the Spring plugin has not been initialized yet... so the bean won't be
available..

If I remember correct, there's a way in Spring to say that a 'bean' will
be initialized only after  'beanx' has been initialized (I guess is a
'depend' attribute ein applicationContext.xml)..

But will this work for RequestProcessor commands?

Hope I was clear enough to explain my problem...

Thanx in advance and regars
	marco


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


RE: Struts 1.3 & custom controller

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
I'm going to try and find some time next week to do strutsws in 1.3... as
much for my own learning as for anyone else, but I think that might be a
good thing to post about on the Wiki, a real-life example step-by-step. 
Even those that have never looked at strutsws may find the walk-through
helpful.

I'm taking the family on vacation tomorrow though and won't be back until
Monday, so I won't get to it before late next week at best.  Don't hold
out for it Marco :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Tue, May 3, 2005 11:22 am, Joe Germuska said:
> At 3:24 PM +0100 5/3/05, Marco Mistroni wrote:
>>Hello Frank,
>>	If  Str1.3 RP is implemented as set of commands, then shouldn't
>>I be able to extend It to add my own commands (such as one that does the
>>trick
>>In your request processor)..
>>
>>I think it should be possible.... at least I would like to support J2ME
>>clients (via strutsws), HTML clients and WML clients for my
>>application..
>>
>>So I could define a RP which contains set of commands for handling
>>request depending on the user agent..
>>
>>I need just some docs for Struts 1.3 Request Processor.......
>>
>>Any good links (other than sourcecode)?
>
> I suppose not.  This is something we need to do, and something which
> will be easier to do based on feedback from newcomers who don't know
> it so well.  (To be honest, it will be rather a while before I have
> time to write docs for the ComposableRequestProcessor, although if
> someone else wrote some stuff, I might have some time to review it.)
>
> Really, as I think about your question, it's hard for me to know
> where to start, since it seems so obvious to me ;-)  But then, I have
> been using struts-chain to back a webapp for more than a year now.
>
> But the questions you've been asking on the list have been helpful,
> and if you feel like you can boil any of your learning down, maybe
> you can find a spot in the Wiki to start gathering some notes?
>
> Joe
>
> --
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
> "Narrow minds are weapons made for mass destruction"  -The Ex
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


RE: Struts 1.3 & custom controller

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
I think that's exactly what the guys are looking for at this point... if
you had any issues whatsoever with that port, posting about them I think
would be most welcome.

Ironic... if you say that everything went perfect that's almost less
helpful, isn't it?? :)

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Tue, May 3, 2005 11:32 am, Marco Mistroni said:
> Hello all ,
> 	In the meantime I found an interesting article from Bill
> Siggelkow
>
> http://www.onjava.com/pub/a/onjava/2005/03/02/commonchains2.html
>
>
> it explains something about RequestProcessor..
>
> I'll try to build up something and see if I can get something basic
> To work, then I guess I'll be back asking questions :-)
>
> Regards
> 	Marco
>
> PS I have also been 'porting' my old app (written using Struts 1.1) to
> Struts 1.3/chain..it works just great :-)
>
>
>
> -----Original Message-----
> From: Joe Germuska [mailto:Joe@germuska.com]
> Sent: 03 May 2005 16:23
> To: Marco Mistroni; 'Struts Users Mailing List'
> Subject: RE: Struts 1.3 & custom controller
>
> At 3:24 PM +0100 5/3/05, Marco Mistroni wrote:
>>Hello Frank,
>>	If  Str1.3 RP is implemented as set of commands, then shouldn't
>>I be able to extend It to add my own commands (such as one that does
> the
>>trick
>>In your request processor)..
>>
>>I think it should be possible.... at least I would like to support J2ME
>>clients (via strutsws), HTML clients and WML clients for my
>>application..
>>
>>So I could define a RP which contains set of commands for handling
>>request depending on the user agent..
>>
>>I need just some docs for Struts 1.3 Request Processor.......
>>
>>Any good links (other than sourcecode)?
>
> I suppose not.  This is something we need to do, and something which
> will be easier to do based on feedback from newcomers who don't know
> it so well.  (To be honest, it will be rather a while before I have
> time to write docs for the ComposableRequestProcessor, although if
> someone else wrote some stuff, I might have some time to review it.)
>
> Really, as I think about your question, it's hard for me to know
> where to start, since it seems so obvious to me ;-)  But then, I have
> been using struts-chain to back a webapp for more than a year now.
>
> But the questions you've been asking on the list have been helpful,
> and if you feel like you can boil any of your learning down, maybe
> you can find a spot in the Wiki to start gathering some notes?
>
> Joe
>
> --
> Joe Germuska
> Joe@Germuska.com
> http://blog.germuska.com
> "Narrow minds are weapons made for mass destruction"  -The Ex
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


RE: Struts 1.3 & custom controller

Posted by Marco Mistroni <mm...@waersystems.com>.
Hello all ,
	In the meantime I found an interesting article from Bill
Siggelkow

http://www.onjava.com/pub/a/onjava/2005/03/02/commonchains2.html


it explains something about RequestProcessor..

I'll try to build up something and see if I can get something basic
To work, then I guess I'll be back asking questions :-)

Regards
	Marco

PS I have also been 'porting' my old app (written using Struts 1.1) to
Struts 1.3/chain..it works just great :-) 

 

-----Original Message-----
From: Joe Germuska [mailto:Joe@germuska.com] 
Sent: 03 May 2005 16:23
To: Marco Mistroni; 'Struts Users Mailing List'
Subject: RE: Struts 1.3 & custom controller

At 3:24 PM +0100 5/3/05, Marco Mistroni wrote:
>Hello Frank,
>	If  Str1.3 RP is implemented as set of commands, then shouldn't
>I be able to extend It to add my own commands (such as one that does
the
>trick
>In your request processor)..
>
>I think it should be possible.... at least I would like to support J2ME
>clients (via strutsws), HTML clients and WML clients for my
>application..
>
>So I could define a RP which contains set of commands for handling
>request depending on the user agent..
>
>I need just some docs for Struts 1.3 Request Processor.......
>
>Any good links (other than sourcecode)?

I suppose not.  This is something we need to do, and something which 
will be easier to do based on feedback from newcomers who don't know 
it so well.  (To be honest, it will be rather a while before I have 
time to write docs for the ComposableRequestProcessor, although if 
someone else wrote some stuff, I might have some time to review it.)

Really, as I think about your question, it's hard for me to know 
where to start, since it seems so obvious to me ;-)  But then, I have 
been using struts-chain to back a webapp for more than a year now.

But the questions you've been asking on the list have been helpful, 
and if you feel like you can boil any of your learning down, maybe 
you can find a spot in the Wiki to start gathering some notes?

Joe

-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex


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


RE: Struts 1.3 & custom controller

Posted by Joe Germuska <Jo...@Germuska.com>.
At 3:24 PM +0100 5/3/05, Marco Mistroni wrote:
>Hello Frank,
>	If  Str1.3 RP is implemented as set of commands, then shouldn't
>I be able to extend It to add my own commands (such as one that does the
>trick
>In your request processor)..
>
>I think it should be possible.... at least I would like to support J2ME
>clients (via strutsws), HTML clients and WML clients for my
>application..
>
>So I could define a RP which contains set of commands for handling
>request depending on the user agent..
>
>I need just some docs for Struts 1.3 Request Processor.......
>
>Any good links (other than sourcecode)?

I suppose not.  This is something we need to do, and something which 
will be easier to do based on feedback from newcomers who don't know 
it so well.  (To be honest, it will be rather a while before I have 
time to write docs for the ComposableRequestProcessor, although if 
someone else wrote some stuff, I might have some time to review it.)

Really, as I think about your question, it's hard for me to know 
where to start, since it seems so obvious to me ;-)  But then, I have 
been using struts-chain to back a webapp for more than a year now.

But the questions you've been asking on the list have been helpful, 
and if you feel like you can boil any of your learning down, maybe 
you can find a spot in the Wiki to start gathering some notes?

Joe

-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex

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


RE: Struts 1.3 & custom controller

Posted by Marco Mistroni <mm...@waersystems.com>.
Hello Frank,
	If  Str1.3 RP is implemented as set of commands, then shouldn't
I be able to extend It to add my own commands (such as one that does the
trick
In your request processor)..

I think it should be possible.... at least I would like to support J2ME
clients (via strutsws), HTML clients and WML clients for my
application..

So I could define a RP which contains set of commands for handling
request depending on the user agent..

I need just some docs for Struts 1.3 Request Processor....... 

Any good links (other than sourcecode)?

Thanx in advance and regards
	Marco


-----Original Message-----
From: Frank W. Zammetti [mailto:fzlists@omnytex.com] 
Sent: 03 May 2005 14:40
To: Marco Mistroni
Cc: 'Struts Users Mailing List'
Subject: Re: Struts 1.3 & custom controller

Hi Marco,

You are correct, the custom controller is at the heart of strutsws.

I hesitate to answer about 1.3 because I've only looked at it very
briefly.  But, I'll try and answer and if someone more knowledgable sees
me flub something, please correct me...

Remember that 1.3 uses the CoR pattern to break down the request
processor
into a chain of functions.  It is designed to be functionally equivalent
to the "current" request processor, but defined as a chain of Commands.

I seem to recall a thread at one point that said you still could in fact
use a custom monolithic processor... if that's not true than the bottom
line is simply that no, strutsws as it exists today will not be usable
with 1.3.

Let's assume however that I am remembering correctly and you CAN do
that... you'd still be inserting the 1.1 RP into the mix, which I'd bet
isn't what you really want to do.  It is also worth noting that I never
did a strutsws version for the Tiles processor, so Tiles and strutsws
don't mix at this point.  This hasn't been a big problem for most people
apparently (I guess they just set up a separate module for the web
services, I don't really know)...

...which does kind of raise an interesting question... assuming you can
use a non-chain RP in 1.3, it might be possible to just use the 1.1 RP
in
a module for your web services.  If it's a module expressly for strutsws
functions, which RP you use might not matter as much (I could be wrong
though... there could have been some changes between 1.1 and 1.3 that
makes it not work, I frankly don't know).  I've never tied such a setup,
so I have no idea if it'll actually work.

Lastly, I do have the intention of updating strutsws specifically for
1.3
(it should be a piece of cake to insert a command or two into the chain
to
perform the necessary functions), but I won't do that until 1.3 is a GA
release.  I actualy thought I wrote it against 1.2.4, I didn't realize
it
was 1.1, so the first chance I get I will update it for 1.2.4 at
least...
I only intend to support GA releases for strutsws as well as ajaxtags by
the way.

Hope that helps!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Tue, May 3, 2005 4:26 am, Marco Mistroni said:
> Hello all,
> 	I have downloaded strutsws by Frank Zammetti, which
> Enables struts app to be exposed as a webservice..
> It uses a custom controller(pls frank correct me if I m wrong) that
> Detects if request is an XML request...customizing then output so that
> it
> Will be an XML response that matches form data.
>
> Application works fine with Struts 1.1.. I have just written a
> <controller>
> Tag in struts-config and a  plugin used by strutsws.
>
> I found problems however with Struts 1.3, and I was wondering if, in
> Struts 1.3, was enough to define a  <controller> tag in
> struts-config.xml
> Or something else was needed..
>
>
> Thanx in advance and regards
> 	Marco
>
>
>


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


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


Re: Struts 1.3 & custom controller

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Hi Marco,

You are correct, the custom controller is at the heart of strutsws.

I hesitate to answer about 1.3 because I've only looked at it very
briefly.  But, I'll try and answer and if someone more knowledgable sees
me flub something, please correct me...

Remember that 1.3 uses the CoR pattern to break down the request processor
into a chain of functions.  It is designed to be functionally equivalent
to the "current" request processor, but defined as a chain of Commands.

I seem to recall a thread at one point that said you still could in fact
use a custom monolithic processor... if that's not true than the bottom
line is simply that no, strutsws as it exists today will not be usable
with 1.3.

Let's assume however that I am remembering correctly and you CAN do
that... you'd still be inserting the 1.1 RP into the mix, which I'd bet
isn't what you really want to do.  It is also worth noting that I never
did a strutsws version for the Tiles processor, so Tiles and strutsws
don't mix at this point.  This hasn't been a big problem for most people
apparently (I guess they just set up a separate module for the web
services, I don't really know)...

...which does kind of raise an interesting question... assuming you can
use a non-chain RP in 1.3, it might be possible to just use the 1.1 RP in
a module for your web services.  If it's a module expressly for strutsws
functions, which RP you use might not matter as much (I could be wrong
though... there could have been some changes between 1.1 and 1.3 that
makes it not work, I frankly don't know).  I've never tied such a setup,
so I have no idea if it'll actually work.

Lastly, I do have the intention of updating strutsws specifically for 1.3
(it should be a piece of cake to insert a command or two into the chain to
perform the necessary functions), but I won't do that until 1.3 is a GA
release.  I actualy thought I wrote it against 1.2.4, I didn't realize it
was 1.1, so the first chance I get I will update it for 1.2.4 at least...
I only intend to support GA releases for strutsws as well as ajaxtags by
the way.

Hope that helps!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

On Tue, May 3, 2005 4:26 am, Marco Mistroni said:
> Hello all,
> 	I have downloaded strutsws by Frank Zammetti, which
> Enables struts app to be exposed as a webservice..
> It uses a custom controller(pls frank correct me if I m wrong) that
> Detects if request is an XML request...customizing then output so that
> it
> Will be an XML response that matches form data.
>
> Application works fine with Struts 1.1.. I have just written a
> <controller>
> Tag in struts-config and a  plugin used by strutsws.
>
> I found problems however with Struts 1.3, and I was wondering if, in
> Struts 1.3, was enough to define a  <controller> tag in
> struts-config.xml
> Or something else was needed..
>
>
> Thanx in advance and regards
> 	Marco
>
>
>


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