Not sure I understand...perhaps this helps - Ike
/**
*executes a Post request to the server, for calling CGI scripts
essentially
*@param theCGI the URL pointing to the CGI script to exectue
*@param param[] an array of parameter names to pass to the script
*param value[] an array of parameter values, corresponding to the array
of parameter names
*/
protected void doCGI_POST(String theCGI, String param[], String
value[]){
/*
The POST method allows the programmer to manipulate the data
received from the CGI.
First a connection is made to the CGI, an OutputStream is open to
send the parameters (if any).
Then InputStream is created to receive the result.
*/
URL CGIurl=null;
URLConnection c=null;
DataOutputStream out=null;
try{
CGIurl = new URL(theCGI);
c = CGIurl.openConnection();
c.setDoOutput(true);
c.setUseCaches(false);
c.setRequestProperty("content-type","application/x-www-form-urlencoded");
out = new DataOutputStream(c.getOutputStream());
StringBuffer encoded = new StringBuffer(1000);
for(int x=0;x<param.length;x++){
encoded.append(param[x]);
encoded.append("=");
encoded.append(URLEncoder.encode(value[x]));
if(x<param.length-1)
encoded.append("&");
}
out.writeBytes(encoded.toString());
out.flush(); out.close();
BufferedReader in = new BufferedReader(new
InputStreamReader(c.getInputStream()));
String aLine;
while ((aLine = in.readLine()) != null) {
// data from the CGI
System.out.println(aLine);
}
}catch(Exception e){
System.out.println("Problem with CGI request! "+e);
e.printStackTrace();
}
}
you call this method, for example, as follows:
String p[] ={
"recipient",
"subject",
"env_report",
"realname",
"email",
"comments"
};
String v[]= {
RFQTo,
"Request For Quote",
"HTTP_USER_AGENT,REMOTE_HOST,REMOTE_ADDR,HTTP_X_FORWARDED_FOR",
realName,
emailFrom,
"blah blah blah:\n\n" + msg
};
doCGI_POST("
http://www.selectthat.com/cgi-bin/FormMail.pl", p, v);
//-Ike
Miguel De Anda said:
What is the normal/standard way to post data from an applet to the web
server? We don't want to open another port on the server and instead do it
from port 80. I was thinking that I can base64 encode the data, and put it
in a querystring like this:
http://www.mywebsite.com/myappletpost.jsp?data=lkfjlwejfowijfoweijfowei.....
Would this work well? I can't think of another way. What's the max length
that a url can have?