tags:

views:

125

answers:

2

Is it my ideea or in rest-web services a post comes "with no name", so say something...

I mean, is the post the whole body, minus headers???

so, how can I parse such a post message with java?

do I have to use

HttpServletRequest.getInputStream?

http://www.softlab.ntua.gr/facilities/documentation/unix/java/servlet2.2/javax/servlet/http/HttpServletResponse.html

any useful example?

and how do I make such a call? I mean, posting value in the body and not in a specific parameter...

thanks a lot

+1  A: 

Fiddler is really useful for this sort of thing. It is acts as a standard http proxy on your local machine. You can view the post body and headers etc in it's interface. You just have to tell your code to use an HTTP proxy (usually just 1 or 2 lines of )

Byron Whitlock
+1  A: 

The server side code would look like the following:

StringBuilder input = new StringBuilder();
BufferedReader reader = request.getReader();
String line = reader.readLine();
while (line != null) {
    input.append(line);
    line = reader.readLine();
}

Where request is the HttpServletRequest. For testing this from the client side, you can use Poster with Firefox.

laz
thanks a lot...one more question, would it be more perfomant to preallocate space for the line variable? and is there any limitation to the size of a String variable in java???
opensas
laz