cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <scher...@gmail.com>
Subject Re: REST view and weird error
Date Mon, 25 Feb 2013 11:08:47 GMT
Hi all,

actually I tried with

HashMap<String, Object> data = new HashMap<String, Object>();
data.put("xxx", "xxx");
return new URLResponse(VIEW, data);

so not really a problem of the hashmap within hasmap. Further I need to
inject the hashmap to do in my view:

<div id="properties" class="tab_content">
            <dl>
              $properties.keys:{k|
              <dt>$k$</dt>
              <dd>
              <![CDATA[$properties.(k)$]]>
              </dd>
              }$
            </dl>
          </div>

As soon I add a map to the response I get the stackoverflow.

I will now play a bit with the log config.

BTW thanks for the feedback.

salu2
On 02/22/2013 03:10 PM, Robby Pelssers wrote:
> I'd say no...
>
> He does first create a new map called 'data'
> HashMap<String, Object> data = new HashMap<String, Object>();
>
> And next he puts the Props map in data
>
> data.put("properties", getProps());
>
>
> And next he passes the map to the view.
> return new URLResponse(VIEW, data);
>
> But obviously creating that data map is of no use.  And secondly... suppose he wants
to keep his hands of the original Props map, he should copy all values over toe the new data
map instead of putting the map in the map.
>
> Robby
>
>
> -----Original Message-----
> From: Nathaniel, Alfred [mailto:Alfred.Nathaniel@six-group.com] 
> Sent: Friday, February 22, 2013 3:07 PM
> To: 'dev@cocoon.apache.org'
> Subject: RE: REST view and weird error
>
> Wild guess:  somewhere you add the map to itself
>
>    map.put("map", map);
>
> creating an infinite recursion in map.toString().
>
> HTH, Alfred.
>
> -----Original Message-----
> From: Robby Pelssers [mailto:Robby.Pelssers@nxp.com] 
> Sent: Freitag, 22. Februar 2013 11:54
> To: dev@cocoon.apache.org
> Subject: RE: REST view and weird error
>
> Hi Thorsten,
>
> Just one question.
>
> I'm a making a few assumptions here but is Settings not a HashMap already? Can't you
just do
>
>     @Override
>     public RestResponse doGet() throws Exception {
>         return new URLResponse(VIEW, getProps());
>     }
>
> I don't see the point in putting a hashmap in another hashmap just for the sake of it
;-)
>
> Robby
>
> -----Original Message-----
> From: Thorsten Scherler [mailto:scherler@gmail.com] 
> Sent: Friday, February 22, 2013 10:13 AM
> To: dev@cocoon.apache.org
> Subject: REST view and weird error
>
> Hi all,
>
> in one view of a REST service of mine I get:
>
> SLF4J: Failed toString() invocation on an object of type [java.util.HashMap] java.lang.StackOverflowError
>     at
> java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:639)
>     at java.lang.StringBuilder.append(StringBuilder.java:224)
>     at
> org.apache.cocoon.configuration.MutableSettings.toString(MutableSettings.java:312)
>     at java.lang.String.valueOf(String.java:2902)
> ...
>     at java.lang.StringBuilder.append(StringBuilder.java:128)
>     at java.util.AbstractMap.toString(AbstractMap.java:523)
>     at java.lang.String.valueOf(String.java:2902)
>
> where the last 3 lines will repeat a lot till the end.
>
> I am doing:
>
>     @Override
>     public RestResponse doGet() throws Exception {
>         HashMap<String, Object> data = new HashMap<String, Object>();
>         data.put("properties", getProps());
>         return new URLResponse(VIEW, data);
>     }
>
> where getProps() basically is a helper for getting this.settings.getProperties.
>
> As soon I do return new URLResponse(VIEW) the error is gone.
>
> I have the standard logging activated (via rcl-config), using jetty:run and no override
for es.codebusters.droids.rest.DroidsInvoker in my logback.xml
>
> <root>
>         <level value="WARN"/>
>         <appender-ref ref="CORE"/>
>     </root>
>
> Any ideas?
>
> salu2
>
> --
> Thorsten Scherler <scherler.at.gmail.com> codeBusters S.L. - web based systems
<consulting, training and solutions>
>
> http://www.codebusters.es/
>
>
>
> The content of this e-mail is intended only for the confidential use of the person addressed.

> If you are not the intended recipient, please notify the sender and delete this email
immediately.
> Thank you.
>
>


-- 
Thorsten Scherler <scherler.at.gmail.com>
codeBusters S.L. - web based systems
<consulting, training and solutions>

http://www.codebusters.es/


Mime
View raw message