Solved

httpcall post method

Posted on 2007-03-26
9
370 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
  • 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

775 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