Solved

httpcall post method

Posted on 2007-03-26
9
381 Views
Last Modified: 2008-01-09
hi all,

i am using apache httpcall jar. i can send param pairs with post method. but how can i send without param names, just value. i mean i would like to send just this 'deneme' string with text context header via post method.

thanks...
0
Comment
Question by:ysnky
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
9 Comments
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18792014
you can mention that in the URL, something like

/url?deneme
0
 
LVL 11

Expert Comment

by:Manish
ID: 18792042
Why you dont want to send name?
You can use same name and value
deneme=deneme
0
 
LVL 11

Expert Comment

by:Manish
ID: 18792043
I am wondering how anybody can get value without name? Is it possible?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 18792089
>  Is it possible?

Partly Yes. You would get the value sent as key in the servlet request, with no value
0
 
LVL 92

Expert Comment

by:objects
ID: 18792217
you could get the value by accessing the query string directly

String value = request.getQueryString();
0
 
LVL 9

Author Comment

by:ysnky
ID: 18792693
i mention about http post call via apache httpcall library.

HttpClient client = new HttpClient();
PostMethod method  = new PostMethod();

like this but i would like to set to the body not a parameter.
method.addParameter(httpParams[i].paramName, httpParams[i].paramValue);

>>Why you dont want to send name?
because the other side looks like the whole body not a parameter. and i cant change this.

0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18793534
>> like this but i would like to set to the body not a parameter.

You can add a parameter to the request using addParameter  () - what do you mean you would like to set it to the body and not a parameter? It does add a parameter to the POST body:

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/methods/PostMethod.html#addParameter(java.lang.String,%20java.lang.String)
0
 
LVL 92

Accepted Solution

by:
objects earned 125 total points
ID: 18796269
try:

method.setRequestEntity(new StringRequestEntity(value, contentType, charset));
0
 
LVL 9

Author Comment

by:ysnky
ID: 18798715
thanks guys...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet filter example 37 83
Configure a Bean in an XML file 4 49
Which non-HTML GUI front end to use with Java? 3 52
DTD and JAVA versions 1 29
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question