REST / own Generator

2009-11-24 Thread Johannes Lichtenberger
Hello,

I'm not sure if it's the right mailing list.

I've got a simple sitemap of the form:

!--  controller ~~~ --
map:pipeline
  map:match pattern=gearth
controller:call controller=rest-controller
select=com.treetank.cocoon.controller.GoogleEarthController /
  /map:match
  map:match pattern=controller/screen
map:generate type=gearth /
map:serialize type=xml /
  /map:match
/map:pipeline

My GoogleEarthController is very simple and looks like:

...
  @Override
  public RestResponse doGet() throws Exception {
final MapString, Object data = new HashMapString, Object();

data.put(mGEarth, mGEarth);
data.put(reqparam, reqparam);

return new Page(servlet:/controller/screen, data);
  }
...

The only thing it should do is getting the sitemap parameter mGEarth and
the request parameters (which I then will process in the Generator with
a StringTokenizer...). So how do I get access to the data-HashMap in
my Generator? 

greetings,
Johannes




REST / own Generator

2009-11-24 Thread Johannes Lichtenberger
Hello,

I'm not sure if it's the right mailing list.

I've got a simple sitemap of the form:

!--  controller ~~~ --
map:pipeline
  map:match pattern=gearth
controller:call controller=rest-controller
select=com.treetank.cocoon.controller.GoogleEarthController /
  /map:match
  map:match pattern=controller/screen
map:generate type=gearth /
map:serialize type=xml /
  /map:match
/map:pipeline

My GoogleEarthController is very simple and looks like:

...
  @Override
  public RestResponse doGet() throws Exception {
final MapString, Object data = new HashMapString, Object();

data.put(mGEarth, mGEarth);
data.put(reqparam, reqparam);

return new Page(servlet:/controller/screen, data);
  }
...

The only thing it should do is getting the sitemap parameter mGEarth and
the request parameters (which I then will process in the Generator with
a StringTokenizer...). So how do I get access to the data-HashMap in
my Generator? 

greetings,
Johannes



Re: REST / own Generator

2009-11-24 Thread Jos Snellings
Hi Johannes,

Supposing your url is :gearth/parameter1?rp=parameter2

Get a sitemap parameter:

match=gearth/{mGearth}
controller:call controller=rest-controller select=myclass
   map:parameter name=mGearth value={map:mGearth}/
/controller:call

In your controller code you can declare a variable to be a sitemap
parameter by annotatino:
 @SitemapParameter
private String mGearth;

And for a simple request parameter this provides you with the request:

@Inject
private HttpServletRequest request;

upon which things are like the old days:

parameter2_value = request.getParameter(rp);

That should work.

Good luck,
Jos



On Tue, 2009-11-24 at 23:35 +0100, Johannes Lichtenberger wrote:
 Hello,
 
 I'm not sure if it's the right mailing list.
 
 I've got a simple sitemap of the form:
 
 !--  controller ~~~ --
 map:pipeline
   map:match pattern=gearth
 controller:call controller=rest-controller
 select=com.treetank.cocoon.controller.GoogleEarthController /
   /map:match
   map:match pattern=controller/screen
 map:generate type=gearth /
 map:serialize type=xml /
   /map:match
 /map:pipeline
 
 My GoogleEarthController is very simple and looks like:
 
 ...
   @Override
   public RestResponse doGet() throws Exception {
 final MapString, Object data = new HashMapString, Object();
 
 data.put(mGEarth, mGEarth);
 data.put(reqparam, reqparam);
 
 return new Page(servlet:/controller/screen, data);
   }
 ...
 
 The only thing it should do is getting the sitemap parameter mGEarth and
 the request parameters (which I then will process in the Generator with
 a StringTokenizer...). So how do I get access to the data-HashMap in
 my Generator? 
 
 greetings,
 Johannes