You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Eric Schneider <er...@centralparksoftware.com> on 2005/08/17 22:24:07 UTC

Injecting custom IEngineService

Hi,

I'm having trouble injecting a custom IEngineService into a  
component.   I'm essentially implementing a component that mirrors  
the regular Tapestry PageLink (called PDFPageLink).  All the  
component is suppose to do is render the links with the correct  
service name.

Referencing the service in the .jwc doesn't seem to work:

<inject property="pageService" object="engine-service:pdfpage"/>

Oddly, it doesn't throw, but it seems to use the regular PageService  
to generate the link.   Should I be using a different object prefix  
in the in my inject declaration? (i.e. something either than "engine- 
service"?)

Thanks,
Eric


hivemodule.xml

<contribution configuration-id="tapestry.services.ApplicationServices">
     <service name="pdfpage" object="service:PDFPageService"/>
</contribution>

<service-point id="PDFPageService"  
interface="org.apache.tapestry.engine.IEngineService">
     <invoke-factory>
           <construct class="pdf.PDFPageService">
             <set-object property="exceptionReporter"  
value="infrastructure:requestExceptionReporter"/>
             <set-object property="response"  
value="infrastructure:response"/>
             <set-object property="linkFactory"  
value="infrastructure:linkFactory"/>
           </construct>
     </invoke-factory>
  </service-point>




Re: Injecting custom IEngineService

Posted by Eric Schneider <er...@centralparksoftware.com>.
Jesse,

Thanks for the suggestions.  It turns out either of the following works:

<inject property="pageService" object="service:myapp.PDFPageService"/ 
 > ("myapp" is my hive module id)
<inject property="pageService" object="engine-service:pdfpage"/>

My problem was due to the getLink() method in my service (thanks  
Alexander!).  I had went through the trouble of overriding the entire  
getLink(), simply to change the name.   I just forgot to change the  
Tapestry.PAGE_SERVICE to getName() in my implementation.  :-\

Thanks!
Eric

On Aug 17, 2005, at 4:29 PM, Jesse Kuhnert wrote:

> Don't know what the <module id="yourhivemoduleidhere"
> version="1.0....."> of your file looks like, but it's also very easy
> to add:
>
> <inject property="pageService"
> object="service:yourhivemoduleidhere.PDFPageService" />
>
> I've never tried the other injection you mentioned.
>
> You probably have it right, but I was wondering if your contribution
> should be using  something more like this:
>
> <contribution configuration-id="tapestry.services.FactoryServices">
>           <service name="pdfpage" object="service:PDFPageService"/>
>   </contribution>
>
> jesse
> On 8/17/05, Eric Schneider <er...@centralparksoftware.com> wrote:
>
>> Hi,
>>
>> I'm having trouble injecting a custom IEngineService into a
>> component.   I'm essentially implementing a component that mirrors
>> the regular Tapestry PageLink (called PDFPageLink).  All the
>> component is suppose to do is render the links with the correct
>> service name.
>>
>> Referencing the service in the .jwc doesn't seem to work:
>>
>> <inject property="pageService" object="engine-service:pdfpage"/>
>>
>> Oddly, it doesn't throw, but it seems to use the regular PageService
>> to generate the link.   Should I be using a different object prefix
>> in the in my inject declaration? (i.e. something either than "engine-
>> service"?)
>>
>> Thanks,
>> Eric
>>
>>
>> hivemodule.xml
>>
>> <contribution configuration- 
>> id="tapestry.services.ApplicationServices">
>>      <service name="pdfpage" object="service:PDFPageService"/>
>> </contribution>
>>
>> <service-point id="PDFPageService"
>> interface="org.apache.tapestry.engine.IEngineService">
>>      <invoke-factory>
>>            <construct class="pdf.PDFPageService">
>>              <set-object property="exceptionReporter"
>> value="infrastructure:requestExceptionReporter"/>
>>              <set-object property="response"
>> value="infrastructure:response"/>
>>              <set-object property="linkFactory"
>> value="infrastructure:linkFactory"/>
>>            </construct>
>>      </invoke-factory>
>>   </service-point>
>>
>>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


Re: Injecting custom IEngineService

Posted by Jesse Kuhnert <jk...@gmail.com>.
Don't know what the <module id="yourhivemoduleidhere"
version="1.0....."> of your file looks like, but it's also very easy
to add:

<inject property="pageService"
object="service:yourhivemoduleidhere.PDFPageService" />

I've never tried the other injection you mentioned.

You probably have it right, but I was wondering if your contribution
should be using  something more like this:

<contribution configuration-id="tapestry.services.FactoryServices">
  		<service name="pdfpage" object="service:PDFPageService"/>
  </contribution>

jesse
On 8/17/05, Eric Schneider <er...@centralparksoftware.com> wrote:
> Hi,
> 
> I'm having trouble injecting a custom IEngineService into a
> component.   I'm essentially implementing a component that mirrors
> the regular Tapestry PageLink (called PDFPageLink).  All the
> component is suppose to do is render the links with the correct
> service name.
> 
> Referencing the service in the .jwc doesn't seem to work:
> 
> <inject property="pageService" object="engine-service:pdfpage"/>
> 
> Oddly, it doesn't throw, but it seems to use the regular PageService
> to generate the link.   Should I be using a different object prefix
> in the in my inject declaration? (i.e. something either than "engine-
> service"?)
> 
> Thanks,
> Eric
> 
> 
> hivemodule.xml
> 
> <contribution configuration-id="tapestry.services.ApplicationServices">
>      <service name="pdfpage" object="service:PDFPageService"/>
> </contribution>
> 
> <service-point id="PDFPageService"
> interface="org.apache.tapestry.engine.IEngineService">
>      <invoke-factory>
>            <construct class="pdf.PDFPageService">
>              <set-object property="exceptionReporter"
> value="infrastructure:requestExceptionReporter"/>
>              <set-object property="response"
> value="infrastructure:response"/>
>              <set-object property="linkFactory"
> value="infrastructure:linkFactory"/>
>            </construct>
>      </invoke-factory>
>   </service-point>
> 
> 
> 
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Injecting custom IEngineService

Posted by Alexander Kundirenko <ak...@gmail.com>.
If your PDF service extends PageService, your problem is described here:
http://issues.apache.org/jira/browse/TAPESTRY-568

The solution is - get latest version of PageService from CVS

On 8/17/05, Eric Schneider <er...@centralparksoftware.com> wrote:
> Hi,
> 
> I'm having trouble injecting a custom IEngineService into a
> component.   I'm essentially implementing a component that mirrors
> the regular Tapestry PageLink (called PDFPageLink).  All the
> component is suppose to do is render the links with the correct
> service name.
> 
> Referencing the service in the .jwc doesn't seem to work:
> 
> <inject property="pageService" object="engine-service:pdfpage"/>
> 
> Oddly, it doesn't throw, but it seems to use the regular PageService
> to generate the link.   Should I be using a different object prefix
> in the in my inject declaration? (i.e. something either than "engine-
> service"?)
> 
> Thanks,
> Eric
> 
> 
> hivemodule.xml
> 
> <contribution configuration-id="tapestry.services.ApplicationServices">
>      <service name="pdfpage" object="service:PDFPageService"/>
> </contribution>
> 
> <service-point id="PDFPageService"
> interface="org.apache.tapestry.engine.IEngineService">
>      <invoke-factory>
>            <construct class="pdf.PDFPageService">
>              <set-object property="exceptionReporter"
> value="infrastructure:requestExceptionReporter"/>
>              <set-object property="response"
> value="infrastructure:response"/>
>              <set-object property="linkFactory"
> value="infrastructure:linkFactory"/>
>            </construct>
>      </invoke-factory>
>   </service-point>
> 
> 
> 
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Injecting custom IEngineService

Posted by Jesse Kuhnert <jk...@gmail.com>.
You may also find this issue helpful:
http://issues.apache.org/jira/browse/TAPESTRY-569

On 8/17/05, Eric Schneider <er...@centralparksoftware.com> wrote:
> Hi,
> 
> I'm having trouble injecting a custom IEngineService into a
> component.   I'm essentially implementing a component that mirrors
> the regular Tapestry PageLink (called PDFPageLink).  All the
> component is suppose to do is render the links with the correct
> service name.
> 
> Referencing the service in the .jwc doesn't seem to work:
> 
> <inject property="pageService" object="engine-service:pdfpage"/>
> 
> Oddly, it doesn't throw, but it seems to use the regular PageService
> to generate the link.   Should I be using a different object prefix
> in the in my inject declaration? (i.e. something either than "engine-
> service"?)
> 
> Thanks,
> Eric
> 
> 
> hivemodule.xml
> 
> <contribution configuration-id="tapestry.services.ApplicationServices">
>      <service name="pdfpage" object="service:PDFPageService"/>
> </contribution>
> 
> <service-point id="PDFPageService"
> interface="org.apache.tapestry.engine.IEngineService">
>      <invoke-factory>
>            <construct class="pdf.PDFPageService">
>              <set-object property="exceptionReporter"
> value="infrastructure:requestExceptionReporter"/>
>              <set-object property="response"
> value="infrastructure:response"/>
>              <set-object property="linkFactory"
> value="infrastructure:linkFactory"/>
>            </construct>
>      </invoke-factory>
>   </service-point>
> 
> 
> 
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org