Merge branch 'jetty-8'

This commit is contained in:
Jesse McConnell 2013-01-25 11:38:37 -06:00
commit fe33b53f0d
2 changed files with 31 additions and 3 deletions

View File

@ -86,8 +86,12 @@ import org.eclipse.jetty.util.log.Logger;
* . These convertors are looked up by class, interface and super class by * . These convertors are looked up by class, interface and super class by
* {@link #getConvertor(Class)}. * {@link #getConvertor(Class)}.
* </p> * </p>
* * <p>If a JSON object has a "class" field, then a java class for that name is
* * looked up and the method {@link convertTo(Class,Map)} is used to find a
* Convertor for that class. If a JSON object has a "x-class" field then a
* direct lookup for a Convertor for that named x-class is done, so that none
* java classes may be converted.
* </p>
*/ */
public class JSON public class JSON
{ {
@ -945,6 +949,15 @@ public class JSON
next = seekTo("\"}",source); next = seekTo("\"}",source);
} }
String xclassname = (String)map.get("x-class");
if (xclassname != null)
{
Convertor c = getConvertorFor(xclassname);
if (c != null)
return c.fromJSON(map);
LOG.warn("no Convertor for xclassname '%s'", xclassname);
}
String classname = (String)map.get("class"); String classname = (String)map.get("class");
if (classname != null) if (classname != null)
{ {
@ -955,9 +968,10 @@ public class JSON
} }
catch (ClassNotFoundException e) catch (ClassNotFoundException e)
{ {
LOG.warn(e); LOG.warn("no Class for classname '%s'", classname);
} }
} }
return map; return map;
} }

14
pom.xml
View File

@ -690,6 +690,20 @@
<head /> <head />
</tag> </tag>
</tags> </tags>
<header>
<![CDATA[
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1149868-7']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
]]>
</header>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>