Notice that your hivemodule.xml has a ID that declares how you can
access your service in your own file if you don't use the ID it defaults
to the Tapestry default services , that is why it couldn't find your
service, because you were missing the prefix.
The prefix mathes your hivemodule "ID".
For example:
<?xml version="1.0"?>
<module id="CMS" version="1.0.0" package="com.estudiowebs.CMS">
<contribution configuration-id="tapestry.services.ApplicationServices">
<service name="pdf" object="service:CMS.PDFServer" />
</contribution>
<service-point id="PDFServer"
interface="org.apache.tapestry.engine.IEngineService">
<invoke-factory model="singleton">
<construct class="com.estudiowebs.CMS.webservices.PDFServer" />
</invoke-factory>
</service-point>
</module>
Now having this said I can invoke the service with:
@InjectObject("service:CMS.PDFServer")
public abstract com.estudiowebs.CMS.webservices.PDFServer getPdfServ();
or hitting it at:
http://yourserver:8080/yourapp/app?service=pdf¶m1=whatever
Also if I wanted to use my service as some short of webservice for other
non tapestry apps to call it as target for forms or to receive any short
of "request" or spit out "responses" you could inject the
HttpServletRequest or HttpServletResponse to your service just providing
a setter based injection for it:
private HttpServletRequest request;
public void setHttpServletRequest(HttpServletRequest request) {
this.request = request;
}
and inside your service method you could process your request on any way.
Take a look for a similar approach inside EWDWT when Kent talks about
serving images using a custom service, which I believe it is related
whith what you're trying to accomplish.
best regards.
Raul Raja
Mike Snare wrote:
It's really a great book. I recommend reading it cover to cover.
Don't skip to the section you need.
Enjoy,
-Mike
On 3/26/06, Cosmin Bucur <[EMAIL PROTECTED]> wrote:
ok perfect , you confirming that puts me at ease .
I have paid for the book about 30 mins ago , I guess I can relax and
know the answer is comming whenever I get it in the mail or something
.
Thanks for your input on this
Cosmin
On 3/26/06, Mike Snare <[EMAIL PROTECTED]> wrote:
I think you would serve yourself well to buy Kent's book on tapestry:
Enjoying Web Development with Tapestry. It's the best 'documentation'
you'll find on tapestry, and it addresses writing a service engine for
download explicitly.
-Mike
On 3/26/06, Cosmin Bucur <[EMAIL PROTECTED]> wrote:
ok ... digging more into the problem , I realised that the problem now
is me failing to understand how a IEngineService implementation should
look . My implementation had getLink () { return null; } which I guess
was causing the null pointer .
But what should go there ? At this point I would be happy with a
simple pointer towards proper documentation .
Thanks ,
Cosmin
On 3/26/06, Cosmin Bucur <[EMAIL PROTECTED]> wrote:
ok well basically
ognl: gives me the first error the outerproxy one .
literal gives me a null pointer exception . The stack trace doesn't
contain any of my src files so it's a bit confusing . As far as I can
see there is nothing to point me towards the error :
org.apache.tapestry.link.DefaultLinkRenderer.constructURL(DefaultLinkRenderer.java:117)
org.apache.tapestry.link.DefaultLinkRenderer.renderLink(DefaultLinkRenderer.java:62)
org.apache.tapestry.link.AbstractLinkComponent.renderComponent(AbstractLinkComponent.java:95)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:434)
org.apache.tapestry.components.RenderBody.renderComponent(RenderBody.java:44)
$RenderBody_7.renderComponent($RenderBody_7.java)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:434)
org.apache.tapestry.html.Body.renderComponent(Body.java:129)
$Body_6.renderComponent($Body_6.java)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
org.apache.tapestry.AbstractComponent.renderBody(AbstractComponent.java:434)
org.apache.tapestry.html.Shell.renderComponent(Shell.java:114)
$Shell_5.renderComponent($Shell_5.java)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:92)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
org.apache.tapestry.BaseComponent.renderComponent(BaseComponent.java:92)
org.apache.tapestry.AbstractComponent.render(AbstractComponent.java:617)
org.apache.tapestry.AbstractPage.renderPage(AbstractPage.java:275)
org.apache.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:366)
org.apache.tapestry.services.impl.ResponseRendererImpl.renderResponse(ResponseRendererImpl.java:71)
$ResponseRenderer_10a3786c9cb.renderResponse($ResponseRenderer_10a3786c9cb.java)
$ResponseRenderer_10a3786c9ca.renderResponse($ResponseRenderer_10a3786c9ca.java)
org.apache.tapestry.engine.PageService.service(PageService.java:68)
$IEngineService_10a3786ca3a.service($IEngineService_10a3786ca3a.java)
org.apache.tapestry.services.impl.EngineServiceInnerProxy.service(EngineServiceInnerProxy.java:77)
org.apache.tapestry.services.impl.EngineServiceOuterProxy.service(EngineServiceOuterProxy.java:66)
org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:248)
org.apache.tapestry.services.impl.InvokeEngineTerminator.service(InvokeEngineTerminator.java:60)
$WebRequestServicer_10a3786ca15.service($WebRequestServicer_10a3786ca15.java)
$WebRequestServicer_10a3786ca14.service($WebRequestServicer_10a3786ca14.java)
$WebRequestServicer_10a3786ca11.service($WebRequestServicer_10a3786ca11.java)
$WebRequestServicer_10a3786ca10.service($WebRequestServicer_10a3786ca10.java)
org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(WebRequestServicerPipelineBridge.java:56)
$ServletRequestServicer_10a3786c9f5.service($ServletRequestServicer_10a3786c9f5.java)
$ServletRequestServicer_10a3786c9f4.service($ServletRequestServicer_10a3786c9f4.java)
org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInjector.java:55)
$ServletRequestServicerFilter_10a3786c9f1.service($ServletRequestServicerFilter_10a3786c9f1.java)
$ServletRequestServicerFilter_10a3786c9f0.service($ServletRequestServicerFilter_10a3786c9f0.java)
$ServletRequestServicer_10a3786c9f6.service($ServletRequestServicer_10a3786c9f6.java)
org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecoderFilter.java:52)
$ServletRequestServicerFilter_10a3786c9ef.service($ServletRequestServicerFilter_10a3786c9ef.java)
$ServletRequestServicerFilter_10a3786c9ee.service($ServletRequestServicerFilter_10a3786c9ee.java)
$ServletRequestServicer_10a3786c9f6.service($ServletRequestServicer_10a3786c9f6.java)
org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestEncoding.java:53)
$ServletRequestServicerFilter_10a3786c9f3.service($ServletRequestServicerFilter_10a3786c9f3.java)
$ServletRequestServicerFilter_10a3786c9f2.service($ServletRequestServicerFilter_10a3786c9f2.java)
$ServletRequestServicer_10a3786c9f6.service($ServletRequestServicer_10a3786c9f6.java)
$ServletRequestServicer_10a3786c9e9.service($ServletRequestServicer_10a3786c9e9.java)
$ServletRequestServicer_10a3786c9e8.service($ServletRequestServicer_10a3786c9e8.java)
org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123)
org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:79)
javax.servlet.http.HttpServlet.service(HttpServlet.java:596)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:830)
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:172)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
org.mortbay.http.HttpServer.service(HttpServer.java:909)
org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
On 3/26/06, Cosmin Bucur <[EMAIL PROTECTED]> wrote:
as far as the last error , it's because i started trying service
instead of engine-service , at one point .
I have fixed that and trying to get more information on new exceptions
On 3/26/06, Cosmin Bucur <[EMAIL PROTECTED]> wrote:
Somehow that error dissapeared now , but I am getting something at the
injection line .
<inject property="pdfService" object="service:pdfService"/>
Error at context:/WEB-INF/tests/ServiceTest.page, line 20, column 84:
Error adding property pdfService to class tests.ServiceTest: Service
point tapestry.pdfService does not exist.
My hivemodule.xml is the same as before ... I tried literal in front
of value="literal:pdfService"/> and i got errors that it can't be
found . Also tried object="literal:pdfService" but got some more
errors and i didn't think it should be used there .
On 3/26/06, Mike Snare <[EMAIL PROTECTED]> wrote:
<component id="serviceLnk" type="ServiceLink" >
<binding name="service" value="pdfService" />
</component>
I think you want to use a literal: binding prefix on the value for
service. What's happening is your expression 'pdfService' is an ognl
expression that resolves to a call to getPdfService() on the class.
It takes the resulting service and calls toString to generate the
link. Since the actual object returned from getPdfService is a proxy
(apparently an 'OuterProxy', to be specific) the link is hosed.
Try:
<component id="serviceLnk" type="ServiceLink" >
<binding name="service" value="literal:pdfService" />
</component>
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
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]