cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jos Snellings <Jos.Snelli...@pandora.be>
Subject Re: REST / own Generator
Date Wed, 25 Nov 2009 05:38:15 GMT
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 Map<String, Object> data = new HashMap<String, 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
> 
> 
> 



Mime
View raw message