You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Deon van der Merwe <dv...@truteq.co.za> on 2005/09/07 14:38:27 UTC
Parameters not received in Service
Hi,
I create a Service that create and return images to the users. There
is only one service, but it must be able to return different
images... using parameters.
- my AbstractAsset returns the URL correctly:
Link =
org.apache.tapestry.engine.EngineServiceLink@dc4c81[service=statsimage/BasicStats,parameters={1},stateful=false]
url = /blah/app?service=statsimage/BasicStats&sp=1
- the URL is also correct in my browser.
- the URL request is sent correctly
192.168.1.123 - - [07/Sep/2005:14:21:12 +0200] "GET
/blah/app?service=statsimage/BasicStats&sp=1 HTTP/1.1" 200 3808
- But the above parameters are not passed to the "service" method of
my Service. The "vParameters" variable in my service method is simple null.
I am using:
- Tomcat 5.0.28
- Tapestry 3.0.3
- Linux
- Firefox
Can anyone see what I am doing wrong?
public class StatsImageService
extends org.apache.tapestry.engine.AbstractService {
public static final java.lang.String SERVICE_NAME = "statsimage";
public org.apache.tapestry.engine.ILink getLink(
org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.IComponent component,
java.lang.Object[] parameters) {
java.lang.String[] context;
java.lang.String pageName = component.getPage().getPageName();
java.lang.String idPath = component.getIdPath();
if (idPath == null) {
context = new String[1];
} else {
context = new String[2];
context[1] = idPath;
}
context[0] = pageName;
org.apache.tapestry.engine.ILink vLink = constructLink(cycle,
SERVICE_NAME, context, parameters, false);
return vLink;
}
public void service(
org.apache.tapestry.engine.IEngineServiceView engine,
org.apache.tapestry.IRequestCycle cycle,
org.apache.tapestry.request.ResponseOutputStream output)
throws javax.servlet.ServletException, java.io.IOException {
int vImagePeriod = -1;
java.lang.String context[] = getServiceContext(cycle.getRequestContext());
java.lang.String pageName = context[0];
java.lang.String idPath = (context.length == 1) ? null : context[1];
java.lang.Object[] vParameters = cycle.getServiceParameters();
// it is here that the "vParameters" is null
-Deon
_____________________________________________________
TruTeq Wireless (Pty) Ltd. | Tel: +27 (0)12 667 1530
http://www.truteq.co.za | Fax: +27 (0)12 667 1531
Wireless communications for remote machine management
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Parameters not received in Service
Posted by Deon van der Merwe <dv...@truteq.co.za>.
Hi Nicolaas,
At 02:47 PM 9/7/2005, Nicolaas Geldenhuys wrote:
>Hey Deon
>
>
>Try using
>
>Object[] params = getParameters(cycle);
>
>instead of
>
>java.lang.Object[] vParameters = cycle.getServiceParameters();
Excellent!!! And there she works. Thanks allot.
>Ek het 'n volledige service as jy na die code will kyk.
Hierdie is al wat my terug gehou het, so hy werk nou mooi. Baie
dankie in elkgeval.
-Deon
_____________________________________________________
TruTeq Wireless (Pty) Ltd. | Tel: +27 (0)12 667 1530
http://www.truteq.co.za | Fax: +27 (0)12 667 1531
Wireless communications for remote machine management
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Parameters not received in Service
Posted by Nicolaas Geldenhuys <ni...@cartrack.co.za>.
Hey Deon
Try using
Object[] params = getParameters(cycle);
instead of
java.lang.Object[] vParameters = cycle.getServiceParameters();
Ek het 'n volledige service as jy na die code will kyk.
Groete
Nicolaas Geldenhuys
On Wed, 2005-09-07 at 14:38 +0200, Deon van der Merwe wrote:
> Hi,
>
> I create a Service that create and return images to the users. There
> is only one service, but it must be able to return different
> images... using parameters.
>
> - my AbstractAsset returns the URL correctly:
> Link =
> org.apache.tapestry.engine.EngineServiceLink@dc4c81[service=statsimage/BasicStats,parameters={1},stateful=false]
> url = /blah/app?service=statsimage/BasicStats&sp=1
> - the URL is also correct in my browser.
> - the URL request is sent correctly
> 192.168.1.123 - - [07/Sep/2005:14:21:12 +0200] "GET
> /blah/app?service=statsimage/BasicStats&sp=1 HTTP/1.1" 200 3808
> - But the above parameters are not passed to the "service" method of
> my Service. The "vParameters" variable in my service method is simple null.
>
> I am using:
> - Tomcat 5.0.28
> - Tapestry 3.0.3
> - Linux
> - Firefox
>
> Can anyone see what I am doing wrong?
>
>
>
>
> public class StatsImageService
> extends org.apache.tapestry.engine.AbstractService {
>
> public static final java.lang.String SERVICE_NAME = "statsimage";
>
> public org.apache.tapestry.engine.ILink getLink(
> org.apache.tapestry.IRequestCycle cycle,
> org.apache.tapestry.IComponent component,
> java.lang.Object[] parameters) {
> java.lang.String[] context;
> java.lang.String pageName = component.getPage().getPageName();
> java.lang.String idPath = component.getIdPath();
> if (idPath == null) {
> context = new String[1];
> } else {
> context = new String[2];
> context[1] = idPath;
> }
> context[0] = pageName;
> org.apache.tapestry.engine.ILink vLink = constructLink(cycle,
> SERVICE_NAME, context, parameters, false);
> return vLink;
> }
>
> public void service(
> org.apache.tapestry.engine.IEngineServiceView engine,
> org.apache.tapestry.IRequestCycle cycle,
> org.apache.tapestry.request.ResponseOutputStream output)
> throws javax.servlet.ServletException, java.io.IOException {
> int vImagePeriod = -1;
> java.lang.String context[] = getServiceContext(cycle.getRequestContext());
> java.lang.String pageName = context[0];
> java.lang.String idPath = (context.length == 1) ? null : context[1];
> java.lang.Object[] vParameters = cycle.getServiceParameters();
>
> // it is here that the "vParameters" is null
>
> -Deon
> _____________________________________________________
> TruTeq Wireless (Pty) Ltd. | Tel: +27 (0)12 667 1530
> http://www.truteq.co.za | Fax: +27 (0)12 667 1531
> Wireless communications for remote machine management
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org