hi Dave,

that's just the same injection i've done, but i can't do calls like

getRequestGlobals(cycle).store(builder);

i can not pass a "cycle" and can not store a ResponseBuilder since
getRequestGlobals().store() does only accept
an IRequestCycle

Instead i've tried:

        innerCycle.setResponseBuilder(rb);

but still no fun.

... my implementation of EMailResponseBuilder looks like this:

public class EMailResponseBuilder extends DefaultResponseBuilder {
        IMarkupWriter _writer;
        AssetFactory _assetFactory;

        private final static Log LOG =
LogFactory.getLog(EMailResponseBuilder.class);
        
        public EMailResponseBuilder() {
                this(null);
        }

        public EMailResponseBuilder(IMarkupWriter writer) {
                super(writer);
                _writer = writer;
        }

        @Override
        public IMarkupWriter getWriter() {
                if (_writer == null)
                        return NullWriter.getSharedInstance();
                return _writer;
        }

        @Override
        public IMarkupWriter getWriter(String id, String type) {
                if (_writer == null)
                        return NullWriter.getSharedInstance();
                return _writer;
        }

        @Override
        public void render(IMarkupWriter writer, IRender render, IRequestCycle
cycle) {
                if (writer == null)
                        render.render(_writer, cycle);
                else
                        render.render(writer, cycle);
        }

        @Override
        public void renderResponse(IRequestCycle cycle) throws IOException {
                if (_writer == null) {
                        IPage page = cycle.getPage();
                        ContentType contentType = page.getResponseContentType();
                        String encoding = 
contentType.getParameter(ENCODING_KEY);
                        if (encoding == null)
                        {
                                encoding = 
cycle.getEngine().getOutputEncoding();
                                contentType.setParameter(ENCODING_KEY, 
encoding);
                        }

                        MarkupFilter filter = new AsciiMarkupFilter();
                        CharArrayWriter charArrayWriter = new CharArrayWriter();
                        PrintWriter printWriter = new 
PrintWriter(charArrayWriter);
                        _writer = new MarkupWriterImpl("text/html", 
printWriter, filter);
                }
                // render response
                cycle.renderPage(this);
                _writer.close();
        }
}






Dave Kallstrom wrote:
> 
> getRequestGlobals is injected into our BasePage as in the following...
> @InjectObject("service:tapestry.globals.RequestGlobals")
>     public abstract RequestGlobals getRequestGlobals();
> the getRequestGlobals() is just a convenience method for returning
> requestGlobals from the underlying page.
> And attached is the EmailResponseBuilder as an example of how to implement
> ResponseBuilder. I too tried extending the DefaultResponseBuilder but
> could
> not get that to work.
> 
> On 12/13/06, explido <[EMAIL PROTECTED]> wrote:
>>
>>
>> i'm concerned with the same problem and have tried to examine your
>> solution
>> without getting it to work.
>>
>> My first problem seems to imagine the EmailResponseBuilder class. I
>> derived
>> the EmailResponseBuilder from the DefaultResponseBuilder overriding
>> "renderResponse", "render" and "getWriter" without success. Your
>> constructor
>> carries the cycle, how is this uses inside the EmailResponseBuilder?
>>
>> My second Problem is your getRequestGlobals(IRequestCycle cycle) method.
>> Where do you get it from?
>> I've tried with the following injection:
>>
>>    @InjectObject("service:tapestry.globals.RequestGlobals")
>>     public abstract RequestGlobals getRequestGlobals();
>>
>> ... but there is no way to store the ResponseBuilder like you do.
>>
>> where is the magic? can you give me a some advice? thx.
>>
>> Marco
>> --
>> View this message in context:
>> http://www.nabble.com/Html-Email-Messages-tf2776596.html#a7857759
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> Dave Kallstrom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
View this message in context: 
http://www.nabble.com/Html-Email-Messages-tf2776596.html#a7858611
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to