public String postObject(String url,String object)
{String resultsPage="";
try{
String urlStr=url;
String val=object;
URL postURL = new URL( urlStr );
HttpURLConnection con = (HttpURLConnection) postURL.openConnection();
con.setUseCaches(false);
con.setDoOutput(true);
con.setDoInput(true);
con.setRequestMethod("POST");
PrintWriter out = new PrintWriter(con.getOutputStream());
String postStr = "link="+URLEncoder.encode(val);
out.println(postStr);
out.close();
String inputLine="";
BufferedReader in=new BufferedReader(new InputStreamReader(con.getInputStream()));
while ((inputLine = in.readLine()) != null)
resultsPage+=inputLine;
in.close();
System.out.println(resultsPage); //Final output
}
catch(Exception ex)
{
System.out.println(ex);
}return resultsPage;
}
I hope to share my knowledge with the others in software and networking industry
Post method in java
Subscribe to:
Post Comments (Atom)
Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release
Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...
-
When we increase timeout value in API Manager we have to set 3 properties. 1) Global timeout defined in synapse.properties (\repository\...
-
No matching resource found error or authentication failure can happen due to few reasons. Here we will discuss about errors can happen d...
-
Address and WSDL endpoints can be suspended if they are detected as failed endpoints. When an endpoint is in in suspended state for a speci...
No comments:
Post a Comment