Solved

httpcall post method

Posted on 2007-03-26
9
392 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
Industry Leaders: 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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
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 learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses

630 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