Injecting Service Error
Hi I am trying to inject a service so that I preview images stored in a blob in the database. I have the following code but it gives me an error that the service can't be found when I view that particular page. hivemodule.xml -- contribution configuration-id=tapestry.url.ServiceEncoders page-service-encoder id=page extension=html service=page/ direct-service-encoder id=direct stateless-extension=direct stateful-extension=sdirect/ /contribution contribution configuration-id=tapestry.services.FactoryServices service name=ImageService object=service:ImageService/ /contribution service-point id=ImageService interface=org.apache.tapestry.engine.IEngineService invoke-factory construct class=mypackagename.ImageService set-object property=linkFactory value=infrastructure:linkFactory/ /construct /invoke-factory /service-point ImageService.java - public class ImageService implements IEngineService { private LinkFactory linkFactory; public ILink getLink(boolean isPost, Object parameters) { Object[] parameterArray = (Object[]) parameters; Object reportId = parameterArray[0]; Map serviceParameters = new HashMap(); serviceParameters.put(ServiceConstants.SERVICE, getName()); serviceParameters.put(ServiceConstants.PARAMETER, new Object[] {reportId}); return linkFactory.constructLink(this, isPost, serviceParameters, true); } public String getName() { return ImageService; } public void service(IRequestCycle cycle) throws IOException { // ... } /** * @return Returns the linkFactory. */ public LinkFactory getLinkFactory() { return linkFactory; } /** * @param linkFactory The linkFactory to set. */ public void setLinkFactory(LinkFactory linkFactory) { this.linkFactory = linkFactory; } } And my java class for the page -- @InjectObject(service:ImageService) public abstract IEngineService getImageService(); The @InjectObject line throws the following error: Service point tapestry.ImageService does not exist What am I missing? I know my hivemodule.xml file is being read as the friendly urls work fine. I am including my stack trace: - Service point tapestry.ImageService does not exist. Stack Trace: org.apache.hivemind.impl.RegistryInfrastructureImpl.getServicePoint(Registry InfrastructureImpl.java:179) org.apache.hivemind.impl.RegistryInfrastructureImpl.getService(RegistryInfra structureImpl.java:205) org.apache.hivemind.impl.ModuleImpl.getService(ModuleImpl.java:105) org.apache.hivemind.service.impl.ServiceObjectProvider.provideObject(Service ObjectProvider.java:40) $ObjectProvider_10bd7c9a69b.provideObject($ObjectProvider_10bd7c9a69b.java) org.apache.hivemind.service.impl.ObjectTranslator.translate(ObjectTranslator .java:75) $Translator_10bd7c9a6c5.translate($Translator_10bd7c9a6c5.java) org.apache.tapestry.services.impl.InjectedValueProviderImpl.obtainValue(Inje ctedValueProviderImpl.java:38) $InjectedValueProvider_10bd7c9a7b9.obtainValue($InjectedValueProvider_10bd7c 9a7b9.java) org.apache.tapestry.enhance.InjectObjectWorker.injectObject(InjectObjectWork er.java:59) org.apache.tapestry.annotations.InjectObjectAnnotationWorker.performEnhancem ent(InjectObjectAnnotationWorker.java:58) $MethodAnnotationEnhancementWorker_10bd7c9a7fc.performEnhancement($MethodAnn otationEnhancementWorker_10bd7c9a7fc.java) org.apache.tapestry.annotations.AnnotationEnhancementWorker.performMethodEnh ancement(AnnotationEnhancementWorker.java:142) org.apache.tapestry.annotations.AnnotationEnhancementWorker.performMethodEnh ancement(AnnotationEnhancementWorker.java:110) org.apache.tapestry.annotations.AnnotationEnhancementWorker.performEnhanceme nt(AnnotationEnhancementWorker.java:70) $EnhancementWorker_10bd7c9a7a2.performEnhancement($EnhancementWorker_10bd7c9 a7a2.java) $EnhancementWorker_10bd7c9a7a4.performEnhancement($EnhancementWorker_10bd7c9 a7a4.java) $EnhancementWorker_10bd7c9a784.performEnhancement($EnhancementWorker_10bd7c9 a784.java) org.apache.tapestry.services.impl.ComponentConstructorFactoryImpl.getCompone ntConstructor(ComponentConstructorFactoryImpl.java:97) $ComponentConstructorFactory_10bd7c9a771.getComponentConstructor($ComponentC onstructorFactory_10bd7c9a771.java) org.apache.tapestry.pageload.PageLoader.instantiatePage(PageLoader.java:578) org.apache.tapestry.pageload.PageLoader.loadPage(PageLoader.java:606)
RE: Injecting Service Error
For those who are curious, the fix is... When calling the service I needed to prefix the applicationId as specified in the hivemind.xml file e.g: @InjectObject(service: applicationId .ImageService) I was tearing my hair out with this one!!! Thanks to those who tried to help. Deon -Original Message- From: Deon Visagie [mailto:[EMAIL PROTECTED] Sent: 15 June 2006 04:18 PM To: 'Tapestry users' Subject: RE: Injecting Service Error Hi I already had the following at the top of my hivemodule.xml file module id=SAC version=1.0.0 package=org.apache.tapestry.workbench And even if I change it to: module id=SAC version=1.0.0 package=mypackagename.tapestry.ImageService It still doesn't work - same error. Btw, in my code below, my ImageService package actually is something like mypackagename.tapestry.ImageService and not mypackagename.ImageService so I thought that tapestry.ImageService was still then referring to my own class. Deon -Original Message- From: Andreas Bulling [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Bulling Sent: 15 June 2006 03:54 PM To: Tapestry users Subject: Re: Injecting Service Error Well, IMO HiveMind isn't able to find your ImageService service point and defaults to tapestry.ImageService where it can't be found, too. Try to put something like this in your hivemodule.xml module id=your_application_id version=1.0.0 package=path.to.the.package.with.ImageService hth Andreas On 15. Jun 2006 - 15:08:56, Deon Visagie wrote: | Hi | | I am trying to inject a service so that I preview images stored in a blob in | the database. I have the following code but it gives me an error that the | service can't be found when I view that particular page. | | | hivemodule.xml | -- | contribution configuration-id=tapestry.url.ServiceEncoders | page-service-encoder id=page extension=html | service=page/ | direct-service-encoder id=direct | stateless-extension=direct stateful-extension=sdirect/ | /contribution | | contribution configuration-id=tapestry.services.FactoryServices | service name=ImageService object=service:ImageService/ | /contribution | | service-point id=ImageService | interface=org.apache.tapestry.engine.IEngineService | invoke-factory | construct class=mypackagename.ImageService | set-object property=linkFactory | value=infrastructure:linkFactory/ | /construct | /invoke-factory | /service-point | | | ImageService.java | - | | public class ImageService | implements IEngineService | { | private LinkFactory linkFactory; | | public ILink getLink(boolean isPost, Object parameters) | { | Object[] parameterArray = (Object[]) parameters; | Object reportId = parameterArray[0]; | | Map serviceParameters = new HashMap(); | serviceParameters.put(ServiceConstants.SERVICE, getName()); | serviceParameters.put(ServiceConstants.PARAMETER, new | Object[] {reportId}); | | return linkFactory.constructLink(this, isPost, | serviceParameters, true); | } | | public String getName() | { | return ImageService; | } | | public void service(IRequestCycle cycle) | throws IOException | { | // ... | } | | /** |* @return Returns the linkFactory. |*/ | public LinkFactory getLinkFactory() | { | return linkFactory; | } | | /** |* @param linkFactory The linkFactory to set. |*/ | public void setLinkFactory(LinkFactory linkFactory) | { | this.linkFactory = linkFactory; | } | } | | And my java class for the page | -- | | @InjectObject(service:ImageService) | public abstract IEngineService getImageService(); | | | The @InjectObject line throws the following error: Service point | tapestry.ImageService does not exist | | What am I missing? I know my hivemodule.xml file is being read as the | friendly urls work fine. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
OGNL in javascript
Hi All I want to put an ognl expression in my onclick event of a link e.g: onclick=ognl:'javascript: document.getElementById('userId').value=' + user.Id but the above doesn't work. I have tried various variations with no success. I know onclick=ognl: user.Id would print out the id but I need to append it to a string. Can it be done? Thanks, Deon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: OGNL in javascript
Thanks! It worked. -Original Message- From: Inge Solvoll [mailto:[EMAIL PROTECTED] Sent: 06 June 2006 02:26 PM To: Tapestry users Subject: Re: OGNL in javascript You have to escape the ('userId'), like this probably: (\'userId\') On 6/6/06, Deon Visagie [EMAIL PROTECTED] wrote: Hi All I want to put an ognl expression in my onclick event of a link e.g: onclick=ognl:'javascript: document.getElementById('userId').value=' + user.Id but the above doesn't work. I have tried various variations with no success. I know onclick=ognl: user.Id would print out the id but I need to append it to a string. Can it be done? Thanks, Deon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Error trying to implement Custom Exception Page
Hi All I have implemented a custom engine class extending BaseEngine so that I could override activateExceptionPage in order to have different error pages for development and production purposes. Inside my custom activateExceptionPage function I have the following code: cycle.activate(CustomException); renderResponse(cycle); to supposedly render my error page. However I am getting a blank html page when an exception does occur. I have set my application to use my engine class and it works fine if in activateExceptionPage() I just call super.activateExceptionPage(cycle, cause). I get the following error in my application log file: 2006-05-24 09:44:06,734 [http-8080-Processor24] WARN tapestry.error.RequestExceptionReporter - activateExceptionPage() Have I missed something?? Does anyone have any suggestions where I am going wrong here. Thanks, Deon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]