Solved

httpcall post method

Posted on 2007-03-26
9
362 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mapAB Challlenge 35 123
bitbucket vs gitbucket 3 55
Java Server Faces parameter pass? 6 37
Groovy problem when using SOAPUI : DispatchException occurred 7 27
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
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…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

919 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now