It already does ?

-----Original Message-----
From: nagraj [mailto:[EMAIL PROTECTED]]
Sent: 25 October 2001 11:30
To: CF-Talk
Subject: Re: HTTP Posts with a java cfx


Hai Craig,

This is specially when you donot give exception throws exception  clause
processrequest() method.


Is the syntax as below. Please check it
public void processRequest(Request req,Response res) throws Exception
{
}

Regards
Nagaraj

----- Original Message -----
From: "Craig Dudley" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, October 25, 2001 3:15 PM
Subject: HTTP Posts with a java cfx


> Good morning all,
>
> I'm trying to write a java custom tag to do a simple http post and read
the
> response into a variable, I'm getting the same error no matter what method
I
> try.
>
> Basically it's for posting small xml packets to an SMS service provider.
>
> I've tried this with 20+ differnet url's, all of which exist.
>
> Error;
> -----------------------------------------------
> java.io.FileNotFoundException: http://localhost/public/sms/smsin.cfm. Java
> exception occurred in call to method.
> -----------------------------------------------
>
> What I don't undestand is why it would say file not found when I'm opening
a
> connection to a url, not a file?
>
> Are there any java experts out there that can give me some advice?
>
> Code follows;
>
> sendMessages.class
> -----------------------------------------------
>
> import com.allaire.cfx.* ;
>
> import java.net.*;
> import java.io.*;
>
>
> public class sendMessages implements CustomTag
> {
>    public void processRequest( Request request, Response response )
> throws Exception
>    {
>
>      // validate that required attributes were passed
>      if ( !request.attributeExists( "XMLDATA" ) )
>   {
>        throw new Exception( "Missing attribute ( XMLDATA is a " +
"required
> attribute for this tag)" ) ;
>      }
>
> String strName = request.getAttribute( "XMLDATA" );
>
> URL url = new URL("http://localhost/public/sms/smsin.cfm";);
> URLConnection connection = url.openConnection();
> connection.setDoOutput(true);
> connection.setDoInput (true);
> connection.setUseCaches (false);
> connection.setRequestProperty("Content-Type",
> "application/x-www-form-urlencoded");
>
> PrintWriter out = new PrintWriter(connection.getOutputStream());
>
> out.println("XMLDATA=" + strName);
> out.close();
>
> BufferedReader in = new BufferedReader(new
> InputStreamReader(connection.getInputStream()));
>
> String inputLine;
> String ReturnXML = "";
>
> while ((inputLine = in.readLine()) != null)
> {
> ReturnXML = ReturnXML + inputLine;
> }
>
> in.close();
>
> response.setVariable( "ReturnXML" , ReturnXML );
> response.write(ReturnXML);
>
> }
>
> }
>
> -----------------------------------------------
>
> Sorry for the slight OT post, but at least it's a java CFX.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to