[Mono-list] Jakarta Struts for .net/mono

Alexander waterfallen at gmail.com
Sat Dec 16 07:56:22 EST 2006


Andrés G. Aragoneses [ knocte ] wrote:
> Alexander escribió:
>   
>> I writing port of Jakarta Struts 1.3
>> Instead of asp.net WebForms it will provide ViewEngines (like MonoRail)
>> and at this time just simple IronPython based engine available.
>>
>> Ports already available:
>> * commons-chain (Chain Of Responsibility pattern for the request processor)
>> * commons-validator (for client data validation)
>> * commons-beanutils (to populate actionForms)
>> * Implemented base functionality:
>>     chain for request processing, actionForms, actions, plugins support,
>>     custom security mechanism (with simple xml file based storage),
>>     configuration (so clise to original)
>>
>> In progress:
>> * ValidatorForm and dependencies (MessageResources, 
>> MessageResourceFactory, etc.)
>> * Sample Web application
>>
>> Please give me a piece of good advice about design:
>> Unfortunately ASP.NET provides sealed HttpContext, HttpRequest, HttpResponse
>> which cannot be used to write mocks for testing (I love javax.servlet).
>> I considering to wrap this objects to complete Java Servlet API and use 
>> this interfaces
>> for whole port implementation (except httphandler which will instantiate 
>> wrapped objects)
>> and make port completely independent from System.Web.
>> At this time I wrap HttpContext, HttpRequest, HttpResponse into custom
>> classes which so close to original.
>> If it sounds wild, it's possible to use asp.net HttpContext, etc..,
>> but unfortunately it's a farewell to unit testing.
>>
>> If somebody interested, please help with this dilemma and project name :).
>> Current name is "Nemo", but my offer is "Boast" as Struts synonym.
>>     
>
> Hey, this sounds wonderful.
>
> Just my two cents: why not "NStruts" (so as to follow the Java->.NET 
> common port practices ;) ?
>
> And I would love to try out your framework if you implement a ViewEngine 
> based on XmlSerialization of the Controller, with XSLT transformation 
> for the view (XML to XHTML with XSLT). This is the kind of methodology I 
> have been using recently with Maverick.NET (which BTW is a port of the 
> Java-based Maverick project), instead of using ASP.NET or (IMHO)strange 
> template engines (such as NVelocity).
>
> Regards,
>
> 	Andrés	[ knocte ]
>
>   
NStruts sounds good, but already exist and quite poor (imho)
[http://www.gotdotnet.com/workspaces/workspace.aspx?id=a7c92222-2966-4224-9771-9598179dc1f2]
beta since 7/2003.

First of all, I would like to say, I really need an advice about 
context, request, response.
What I should with these sealed classes? Wrap it, use original, else 
(implement javax.servlet)?
After this little problem resolution, I hope to make public preview.

I'll consider XsltViewEngine (it's my old dream cuze I love xslt).
Serialization of the controller? What does it mean? Struts actions are 
controllers,
and these actions stateless by design. All data required by view must be 
stored in HttpContext and Session:

    // It's stateless action. Each instance shared between multiple clients.
    public class SampleAction : ActionBase<SampleForm>
    {
        public override ActionForward Execute(ActionMapping mapping, 
SampleForm form, IHttpRequest request,
                                              IHttpResponse response) // 
request and response are wrapped asp.net objects.
        {
            BusinessEntity entity = // retrieve data;
            request.Items["entity"] = entity;

            return mapping.FindForward("welcome");
        }
    }

It's not a problem to make xml serialization of these objects. I'll 
consider some approaches soon.
_Maybe_ something like this:
<view-data>
  <session-vars>
    <item name="entity">....</item>
  </session-vars>
  <request-vars>
    ...
  </request-vars>
  <error-messages>
    ...
  </error-messages>
</view-data>


More information about the Mono-list mailing list