[Solved]: WO component actions in JSP

Will Scheidegger <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
This does not seem to be an interesting topic for the WebObjects  
developer community - still, maybe it's of good use for someone. As  
you can see here

http://www.fastforward.ch/WOServletTest/WODA

I managed to integrate WO component actions into a JSP page. To  
achieve this, I had to build a new custom tag (<wo:componentAction / 
 >) which takes a wo coomponent action url as parameter an inserts  
its result into the JSP page.

The code is still very ugly - but for those interested I can send you  
the Xcode project (for the WO part) and Eclipse project (for the JSP  
part).

How it works:
A UrlRewrite filter is looking for /WebObjects* urls which contain a  
"rewritePath=..." parameter. It then rewrites a WO url like this
/WOServletTest/WebObjects/WOServletTest.woa/wo/zfctzpBisUOryU2nSrmZiM/ 
11.9?rewritePath=/WOCA
to the desired JSP url like so
/WOServletTest/WOCA?wopath=/WebObjects/WOServletTest.woa/wo/ 
zfctzpBisUOryU2nSrmZiM/11.9
The wopath path parameter then is handed over to a  
<wo:componentAction /> tag which takes care of the rest using an  
extended WOServletAdaptor.

Of course it would be even nicer to have a WO wrapper component which  
wraps the JSP page around the WO content... but hey, Rome was not  
built in a day. ;-)

-Will

On 28.07.2006, at 13:05, Will Scheidegger wrote:

> O.k., it's not quite working yet... but I think I'm getting there.  
> Answering my own question - the best way to go is :
>
> WORequest worequest = appInstance.createRequest("GET", path, "HTTP/ 
> 1.0", headers, null, someInfo);
> WOResponse appInstance.dispatchRequest(worequest);
>
> Will
>
> On 27.07.2006, at 23:08, Will Scheidegger wrote:
>
>> I'm trying to integrate WO components _including_ component  
>> actions into a JSP based CMS. I do this by adding path info to the  
>> WOHyperlink to get something like this:
>>
>> http://localhost:8080/magnoliaAuthor/WebObjects/CandyShop.woa/wo/ 
>> 2kQRnLlE41Nv0tRgGLRQjg/6.0.16.0.5?path=/en/products/candy/ 
>> details.html
>>
>> Then I use servlet filter to convert the URL above to
>>
>> http://localhost:8080/magnoliaAuthor/en/products/candy/ 
>> details.html?wopath=/WebObjects/CandyShop.woa/wo/ 
>> 2kQRnLlE41Nv0tRgGLRQjg/6.0.16.0.5
>>
>> Now I should write a custom tag to take the "wopath" parameter and  
>> fill in the WO content at its place. For this last step I could  
>> use some help. I have been digging around in the standard wo jsp  
>> tags but of course this is not documented to well. I should now  
>> how to use the WOSerlvetAdaptor to get the response for the URL "/ 
>> WebObjects/CandyShop.woa/wo/2kQRnLlE41Nv0tRgGLRQjg/ 
>> 6.0.16.0.5" (and the headers of course). Should I just start out  
>> with WOApplications.createRequest() and then follow through with  
>> the rest of the request-response loop (awake(),  
>> takeValuesFormRequest(), ...) or are there any convenience methods  
>> that would make life a bit easier?
>>
>> Thanks!
>>
>> -Will
>> _______________________________________________
>> WebObjects-dev mailing list
>> [email protected]
>> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.