• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: responseForComponentWithName() and session
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: responseForComponentWithName() and session


  • Subject: Re: responseForComponentWithName() and session
  • From: Chuck Hill <email@hidden>
  • Date: Tue, 12 Apr 2011 20:39:03 -0700

You can also take a look at the source of GVC.SiteMaker if you want.  I will warn you that it is a little on the large side.

http://sourceforge.net/projects/gvcsitemaker/


Chuck


On Apr 12, 2011, at 8:24 PM, Paolo Sommaruga wrote:


Thanks Chuck,

I will look at 
templateWithHTMLString I don't 
know it

Paolo

Il giorno 13/apr/2011, alle ore 02:52, Chuck Hill <email@hidden> ha scritto:


On Apr 12, 2011, at 2:25 PM, Paolo Sommaruga wrote:

Hi,

I try to explain more. My web application is sort of cms. Basically the idea is simple.

Maybe a little too simple for what you want now.  :-)


The main page displays an eoObject that has an attribute "text".  The administrator can edit such "text" attribute via a java client application. He can insert anywhere in the "text" some special tag, like

[component  myCustomComponent]

Real WO syntax, inline bindings, and WOComponent's 
public static WOElement templateWithHTMLString(String frameworkName,
                                               String referenceName,
                                               String anHTMLString,
                                               String aDeclarationString,
                                               NSArray aLanguageArray,
                                               WOAssociationFactory associationFactory,
                                               WOMLNamespaceProvider namespaceProvider)
Might get you a lot closer to where you want to go.  I think that is what most WO CMS applications use.



myCustomComponent is a component name, which lives in the web application, taken by a custom component library. Such custom component implement simple reusable behaviors for display only purpose, like products list, categories list, etc.

In the web application the "text" attribute binds to a method that parses the text. If the parse finds a special tag, it replaces such tag with the html generated by the component specified in the special tag. For this I use 

WOResponse response = (WOApplication.application()).responseForComponentWithName(componentName,
                                              null,
                                              null,
                                              null,
                                              uriPrefix,
                                              null);
                                              
    buf.append(response.contentString());

Such engine works very well with the stateless component.

I confess to not being sure what that method is for.  But I don't think it is meant for what you are doing.


The problem is when the generated programmatically component need to access to some field in the session because the component generated with responseForComponentWithName lives in a new session.

I will guess that if it used the same session, that your app would deadlock.  :-)


I would like to extend the engine in order to use some simple stateful component

Even if it does not deadlock, you are not going to be able to use stateful components and component actions using responseForComponentWithName.
That runs in an whole new Request-Response loop with a new WOContext.  WO won't know what to do with the result.  I think...

Chuck

-- 
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/products/practical_webobjects








--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-- 
Chuck Hill             Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.    
http://www.global-village.net/products/practical_webobjects







Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: responseForComponentWithName() and session (From: Paolo Sommaruga <email@hidden>)
 >Re: responseForComponentWithName() and session (From: Chuck Hill <email@hidden>)
 >Re: responseForComponentWithName() and session (From: Paolo Sommaruga <email@hidden>)

  • Prev by Date: Re: responseForComponentWithName() and session
  • Next by Date: Re: Re: fetching on joined table
  • Previous by thread: Re: responseForComponentWithName() and session
  • Next by thread: Problems with login and multiple instances
  • Index(es):
    • Date
    • Thread