Never mind, I found an example in Enjoying Web Development with
Tapestry in Chapter 8 which explains what I need to know.


On 09/11/05, Jabbar <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am using tapestry 4 beta 12 and am trying to create a dynamic image.
> I have already created the service component for the image and are
> having problems create an asset class. My chart asset class looks like
> the following, it was autogenerated by eclipse
>
> ----------------------------------------------------------------------
> package com.technolog.graphics;
>
> import java.io.InputStream;
>
> import org.apache.hivemind.Location;
> import org.apache.hivemind.Resource;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.asset.AbstractAsset;
>
> public class ChartAsset extends AbstractAsset {
>
>    public ChartAsset(Resource resourceLocation, Location location) {
>        super(resourceLocation, location);
>
>    }
>
>    public String buildURL(IRequestCycle cycle) {
>        // TODO Auto-generated method stub
>        return null;
>    }
>
>    public InputStream getResourceAsStream(IRequestCycle cycle) {
>        // TODO Auto-generated method stub
>        return null;
>    }
>
> }
> --------------------------------------------------------------------------
>
> If I compare my chart asset class with the example chart asset class,
>
> --------------------------------------------------------------------------
>
> // Copyright 2004, 2005 The Apache Software Foundation
> //
> // Licensed under the Apache License, Version 2.0 (the "License");
> // you may not use this file except in compliance with the License.
> // You may obtain a copy of the License at
> //
> //     http://www.apache.org/licenses/LICENSE-2.0
> //
> // Unless required by applicable law or agreed to in writing, software
> // distributed under the License is distributed on an "AS IS" BASIS,
> // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> // See the License for the specific language governing permissions and
> // limitations under the License.
>
> package org.apache.tapestry.workbench.chart;
>
> import java.io.InputStream;
> import java.util.Locale;
>
> import org.apache.tapestry.IComponent;
> import org.apache.tapestry.IEngine;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.asset.AbstractAsset;
> import org.apache.tapestry.engine.IEngineService;
> import org.apache.tapestry.engine.ILink;
>
> /**
>  * An asset used with the [EMAIL PROTECTED] ChartService}.
>  *
>  * @author Howard Lewis Ship
>  * @since 1.0.10
>  */
>
> public class ChartAsset extends AbstractAsset
> {
>    private IEngineService _chartService;
>
>    private IComponent _chartProvider;
>
>    public ChartAsset(IRequestCycle cycle, IComponent chartProvider)
>    {
>        super(null, null);
>
>        IEngine engine = cycle.getEngine();
>
>        _chartService = engine.getService(ChartService.SERVICE_NAME);
>        _chartProvider = chartProvider;
>    }
>
>    public String buildURL(IRequestCycle cycle)
>    {
>        ILink l = _chartService.getLink(cycle, false, _chartProvider);
>
>        return l.getURL();
>    }
>
>    public InputStream getResourceAsStream(IRequestCycle cycle)
>    {
>        return null;
>    }
>
>    public InputStream getResourceAsStream(IRequestCycle cycle, Locale locale)
>    {
>        return null;
>    }
>
> }
>
> -----------------------------------------------------------------------------------------------------------
>
> you can see the constructors are different. I'm not sure what to write
> in the constructor of my ChartAsset class.
>
> Does anybody have any examples of creating their own classes of type
> AbstractAsset ? I have the excellent book by Kent Tong, but it doesn't
> have an example :(
>
>
> --
> Thanks
>
> Jabbar Azam
>


--
Thanks

Jabbar Azam

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

Reply via email to