Hi Every1,
I am getting error while posting post request in html.
The error is.
***************************************
POST
Resp Code:405
Resp Message:Method not allowed
***************************************
I am using Https IIS server. if you knows about this then please suggest me.. condition is i can,t use another server (specification)
Regards,
Abhijit
PLEASE VIEW CODE ALSO IF POSSIBLE..
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.https;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.HttpsURLConnection;
/**
*
* @author Administrator
*/
public class MyHttpsPOSTClass
{
public static void main(
String args[])
{
try
{
URL url = new URL("https://localhost/a.pdf");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
System.out.println(connection.getRequestMethod());
HttpsURLConnection.setFollowRedirects(true);
int i;
FileInputStream fin = new FileInputStream("C://Https Download/anyfile.txt");
DataOutputStream output = new DataOutputStream( connection.getOutputStream() );
do
{
i = fin.read();
if (i != -1)
output.writeInt(i);
}while (i != -1);
output.close();
fin.close();
System.out.println("Resp Code:"+connection.getResponseCode());
System.out.println("Resp Message:"+ connection.getResponseMessage());
} catch (Exception ex)
{
System.out.println(ex);
}
}
}