What Restlet(Java) libraries are needed for JSON GET/POST? - java

This is a duplicate of this question, which was written in 2010. Now that things may have changed in 2017, I think this is a great opportunity to re-ask the question.
What libraries are needed?
Using org.restlet.jee 2.3.10, I have noticed that there are several libraries which could support JSON. Here are some names from the Maven Repository:
org.restlet.ext.jackson
org.restlet.ext.json
org.restlet.lib.org.restlet.lib.org.json
org.restlet.lib.org.json
What is the current recommended / standard way of GET-ing and POST-ing JSON-formatted text?

It seems like: "org.restlet.JSON".
You can see the official tutorial here.

Related

Cannot use com.sun.net.httpserver - Java 8

I am trying to create a simple server program to handle http requests. So with minimum search, I stumbled upon the oracle documentation for the httpserver class, inside the com.sun.net package. I'm relatively new to Java, so I thought that a class "sponsored" by Oracle itself would be included in the default libraries.
Unfortunately, that was not the case. After a lot of trials for possible syntax-import errors (various kinds of error arouse) and having installed the Oracle JDK 8 correctly on my Ubuntu machine, the compiler said that the package did not exist. What do I have to do to get the package to work?
I did finally make it work. Mostly, it was a misunderstanding from my place, since I only imported up to a point that was wrong - that is,I only imported com.sun.net.httpserver, thinking the latter part was the actual class I wanted, but it was merely the package name. So then I proceeded to import com.sun.net.httpserver.HttpServer, then the rest of my classes. Finally a com.sun.net.httpserver.* would work perfectly fine. It seems stupid now that I figured it out, but I think I will leave it here just in case anyone has the same misunderstanding - I already see 1 favourite on the question. And of course, as others have pointed out, the package is not part of the standard java libraries, but I used Oracle Java specifically for that.
P.S. The class is really useful, unlike what the other answer implies, but now I have stumbled upon another problem regarding reading the request body right, something that might have to do with the locale of the client-server, and I will now procced to search that.. Just a warning for anyone thinking of using the package.
Firstly try to avoid com.sun.xxx package, as those are internalls of Oracle/Sun java implementation.
Secondly, why not use libraries from apache ? See https://hc.apache.org/
EDITED:
You can also look on http://sparkjava.com/ , not tested but examples looks promising and they are using Java 8 nice features.

Using Javadocs with Wikispaces

I am working on a team for a class, and we have written a very large amount of code. Luckily for us, we were diligent in adding javadoc annotations to everything, so we should be able to create the documentation very easily. For the class however, we are required to have all of our documentation on a wikispace page.
Some of the pages will be javadoc, some of them will be plain text. Is there an easy way to convert javadocs to wiki pages, or embed javadocs into wiki pages? Thanks!
I haven't tried this myself, but maybe doxygen(http://www.doxygen.nl/) in conjunction with this tool (https://code.google.com/p/doxy2wiki/) may be able to solve your problem.

JSON parser for J2ME

I need a basic JSON parser that works with J2ME / CLDC 1.1.
A Google search returns tons of answers on this (some even on stackoverflow), but it appears that all point to libraries and solutions that are no longer available (for example, lots point to an implementation that is supposed to be on the json.org site, but at least I can't find anything that isn't J2SE only there).
My best hope so far is the source linked here: https://meapplicationdevelopers.dev.java.net/mobileajax.html, but from that one I can't even find a straight forward way to download the code.
Given the mature state of Java in all other aspects, surely there must be somewhere I can get a pre-compiled JAR to use for parsing JSON from J2ME?
After getting the accepted answer from ZZ Coder, I downloaded the linked code and built a JAR from it.
So in case you need a compiled JSON serializer/deserializer for J2ME/CLDC, you can find the source code here: https://bitbucket.org/liedman/json-me
There is an org.json parser for J2ME but I can't remember the original link. You can get the source code here,
http://grt192.googlecode.com/svn/trunk/CannonBot/src/org/json/me/

Java: How can I create good looking class docs with Javadoc?

I'd like to create HTML documentation for a Java class library that includes
programming guide information - beyond just a class reference
code examples in the reference doc
collapsible regions
I want it to look well-styled. Something like this:
I think that Javadoc exposes a doclet API that allows other parties to provide doc generation integrated in Javadoc. Is there a doclet option that I can use (for free) that does something a little nicer than the standard javadoc output?
I tried googling for this but no luck.
Suggestions?
Addendum
I found doclet.com but I don't know how to evaluate the options. Recommendations?
In particular, XHtmlDoclet sounds like it wants to address these issues. Anyone used it? I can't get it to work. Also the example offered by the XHTML Doclet guys doesn't look any better than the docs generated from c.1998 javadoc .
Related:
Why does Javadoc generate non-compliant XHTML?
This question got me thinking (ok, Googling) and I stumbled on this set of taglets. Never tried it, but it looks pretty promising.
Perhaps you're thinking of Java doclet API:
http://www.oracle.com/technetwork/java/javase/documentation/index-jsp-135444.html
It appears that you're adding examples and some text. I think it's entirely possible with existing javadocs. The problem will be the content rather than the rendering.
Castor used doclet to ease its config burden. So did EJB 1.0. Take a look at those if you'd like.

Which is the best JSON rewriter for Java?

Which JSON rewriter is the best for applications written in Java? Criteria may vary. I'm personally most interested in stability and performance.
I am using the one from http://www.json.org. The direct link to the Java code is this:
http://www.json.org/java/index.html.
The nice thing about it is that it does not require any dependencies. You just need to add seven source files to your project and you've got yourself a JSON builder.
This one works just fine: http://json-lib.sourceforge.net/
This JsonTools library is very complete. You can find it at Berlios.

Categories