yup im using the doGet method, but i need a parser to extract the json
object out of the json array (string). something like
JSONObject jsonObj=Parser.parse(some json array string).get(some
integer);
String resData=jsonObj.toString();

i just need some parser that can parse json that contains UTF-8 stuff.

On Jul 16, 12:49 am, lineman78 <[email protected]> wrote:
> Jersey is a project for implementing REST services, but would probably
> be overkill for your situation.  You could simply write a servlet with
> a doGet method if you are handling any marshaling yourself.  The
> Jersey project allows you to expose methods to specific URLs and any
> marshaling/unmarshaling is handled under the covers by these things
> called providers.  It is intended to be used with JAXB to write an XSD
> from which you generate POJOs with JAXB and Jersey serializes them to
> XML, but custom providers can also serialize to JSON or you can write
> custom message body writers for your own protocol.  For the simple
> case you are talking about I would just write a class that extends
> HttpServlet and overrides the doGet method and writes to the response
> directly.
>
> http://www.javafaq.nu/java-example-code-1022.html
>
> On Jul 15, 1:05 am, Alex <[email protected]> wrote:
>
> > for client side i have alwasy use
> > com.google.gwt.json.client.JSONParser without any problem.
>
> > its for my server side.
>
> > im not trying to convert the json string into java class, but rather i
> > just need to send the string representation of a json object that was
> > extracted from a json array to client side.
>
> > so its like i have a txt file that contains json array, inside the
> > array has many json object, i just need to randomly pick any one of
> > the json object in that array and send it to client app.
>
> > does the jersey project thingy able to do that?
>
> > On Jul 15, 2:39 am, lineman78 <[email protected]> wrote:
>
> > > I use overlay types via the javascript JSON.parse method for the
> > > client side, which is available in newer browsers and you need to
> > > include json2.js for older browsers(eval is also an alternative).  For
> > > server side, I suggest using the Jersey project with a JSON context
> > > provider as shown here:
>
> > >http://blogs.sun.com/enterprisetechtips/entry/configuring_json_for_re...
>
> > > On Jul 14, 7:56 am, Jaroslav Záruba <[email protected]> wrote:
>
> > > > Have you tried these?
> > > > for server-side (GAE)
> > > > *com.google.appengine.repackaged.org.json.JSONObject.JSONObject(String
> > > > arg0)*
> > > > for client *com.google.gwt.json.client.JSONParser*
>
> > > > I haven't tried japanese or chinese characters though, rather stuff like
> > > > this: "Pøíli¹ ¾lu»ouèký kuò úpìl ïábìlské ódy"
>
> > > > On Wed, Jul 14, 2010 at 3:43 PM, Alex <[email protected]> wrote:
> > > > > i tried gson, but it give me error.
> > > > > this is the code i used
>
> > > > > public class Test {
> > > > >        private static final String charEncoding="UTF-8";
>
> > > > >        private static final String fileName="c:\\test.txt";
> > > > >        public static void main(String args[]){
> > > > >                try{
> > > > >                        File file=new File(fileName);
> > > > >                        if(file.canRead()){
> > > > >                                FileInputStream inStream=new
> > > > > FileInputStream(file);
> > > > >                                InputStreamReader reader=new
> > > > > InputStreamReader(inStream,
> > > > > charEncoding);
> > > > >                                JsonParser parser=new JsonParser();
> > > > >                                JsonElement jsonA=parser.parse(new
> > > > > BufferedReader(reader));
> > > > >                                
> > > > > System.out.println(jsonA.isJsonArray());
> > > > >                                System.out.println(jsonA.toString());
> > > > >                        }
> > > > >                }catch(IOException e){
> > > > >                        e.printStackTrace();
> > > > >                }
> > > > >        }
>
> > > > > }
>
> > > > > the jar from json.org dun work too.
>
> > > > > so is there any json parser that can parse UTF-8 json text (japanese
> > > > > and chinese character in particular)
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google 
> > > > > Groups
> > > > > "Google Web Toolkit" group.
> > > > > To post to this group, send email to 
> > > > > [email protected].
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]<google-web-toolkit%[email protected]>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to