RE: trigger a remote form - RE: Passing a query string as a single url variable -

2006-05-27 Thread Phillip Holmes
Apologies..

Correction.. In this case..there is no need to actually present the
querystring as a second parameter.. 
You'll just pass the uri in with your url params and read the response (if
needed). 
BTW, I have not debugged,tested or compiled this code, so please contact me
if you have questions.
It probably will need to be tweaked.


ret.message = createObject('java','ReadHttpsURL').ReadHttpsURL(URI);
writeOutput(ret.message);


==>


import java.net.*;
import java.io.*;

public class ReadHttpsURL {
public static String uri;

public static void main(String args[]){
   ReadHttpsURL obj = new ReadHttpsURL();
   obj.readit(uri);
}

  public String readit(String uri) { 
try{
System.setProperty("javax.net.ssl.keyStore",
"x:\\path2yourkey\\yourkey.pfx");
System.setProperty("javax.net.ssl.keyStorePassword", "foo");
System.setProperty("javax.net.ssl.keyStoreType", "pkcs12");
 
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.ww
w.protocol");
String message;
String line;
URL url = new URL(uri);

URLConnection conn = url.openConnection();
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "text/plain");

// Get the response
BufferedReader in = new BufferedReader(new
InputStreamReader(conn.getInputStream()));

// create your stringBuffer to hold your return from the
remote page
StringBuffer sb = new StringBuffer();
// loop through response
while ((line = in.readLine()) != null) {
   sb.append(line);
}
message = sb.toString();

in.close();

return message;

} catch (Exception e) {
  String message = "exception: " + e.getMessage();
  return message;
}
   }
}

Warmest Regards,
 
Phillip B. Holmes
http://phillipholmes.com

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.7.1/348 - Release Date: 5/25/2006
 


~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241683
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


RE: trigger a remote form - RE: Passing a query string as a single url variable -

2006-05-27 Thread Phillip Holmes
Steve or whomever had the original question:

You could also compile a servlet in java and call it via CF.

Your CF call would be something like:


ret.Message =
createObject('java','ReadHttpsURL').ReadHttpsURL(URI,QueryString);
writeOutput(ret.message);


==>

Your compiled servlet would be something along the lines of:

import java.net.*;
import java.io.*;

public class ReadHttpsURL {
public static String uri;
public static String QueryString;

public static void main(String args[]){
   ReadHttpsURL obj = new ReadHttpsURL();
   obj.readit(uri,QueryString);
}

  public String readit(String uri, String QueryString) { 
try{
System.setProperty("javax.net.ssl.keyStore",
"x:\\path2yourkey\\yourkey.pfx");
System.setProperty("javax.net.ssl.keyStorePassword", "foo");
System.setProperty("javax.net.ssl.keyStoreType", "pkcs12");
 
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.ww
w.protocol");
String message;
String line;
URL url = new URL(uri);

URLConnection conn = url.openConnection();
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "text/plain");
BufferedWriter out = new BufferedWriter(new
OutputStreamWriter(conn.getOutputStream()));

out.write(QueryString);
out.flush();

// Get the response
BufferedReader in = new BufferedReader(new
InputStreamReader(conn.getInputStream()));

// create your stringBuffer to hold your return from the
remote page
StringBuffer sb = new StringBuffer();
// loop through response
while ((line = in.readLine()) != null) {
   sb.append(line);
}
message = sb.toString();

in.close();
out.close();

return message;

} catch (Exception e) {
  String message = "exception: " + e.getMessage();
  return message;
}
   }
}

When working with CF, make sure your IDE is using JVM version 1.4.2_x so
that it is compatible. Since CFMX is not Java 1.5 ready, it is not backwards
compatible with the newest versions of Java (they've added generics and many
other enhancements that CFMX isn't ready for). I use Sun's netbeans IDE
1.4.2_08. The default keystore that comes with CFMX is fine and there is no
need for adding your key into the keystore if you call your pfx key
directly. Since your servlet presents the signed key directly, the
ColdFusion keystore merely validates the certificate's root authority.

Let me know (offline) if you have any questions or need assistance.


Warmest Regards,
 
Phillip B. Holmes
http://phillipholmes.com

===>


-Original Message-----
From: Jochem van Dieten [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 27, 2006 10:13 AM
To: CF-Talk
Subject: Re: trigger a remote form - RE: Passing a query string as a single
url variable -

Steve Kahn wrote:
> cfhttp/cfhttpparam doesnt work with SSL

It does. You probably just need to make sure the signing certificate
authority is in the keystore. And if all alse fails, tunnel it over stunnel:
http://www.stunnel.org/

Jochem



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241682
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: trigger a remote form - RE: Passing a query string as a single url variable -

2006-05-27 Thread Jochem van Dieten
Steve Kahn wrote:
> cfhttp/cfhttpparam doesnt work with SSL

It does. You probably just need to make sure the signing 
certificate authority is in the keystore. And if all alse fails, 
tunnel it over stunnel: http://www.stunnel.org/

Jochem

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241677
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: trigger a remote form - RE: Passing a query string as a single url variable -

2006-05-27 Thread Steve Kahn
cfhttp/cfhttpparam doesnt work with SSL


-- Original Message --
From: Jochem van Dieten <[EMAIL PROTECTED]>
Reply-To: cf-talk@houseoffusion.com
Date:  Sat, 27 May 2006 16:57:24 +0200

>Steve Kahn wrote:
>> This is SOT but,
>> I need to trigger a form on a different host by calling
>> the response page using the full url
>> i.e
>> http://www.domain.com/subscribeResponse1.cfm?email=emailaddress&listid=1
>> 
>> Is there a way to do this behind the scenes without the user taking direct
>> action or attach it in another manner?
>
>With cfhttp you can call a page on a different host.
>
>Jochem
>
>

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241676
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: trigger a remote form - RE: Passing a query string as a single url variable -

2006-05-27 Thread Jochem van Dieten
Steve Kahn wrote:
> This is SOT but,
> I need to trigger a form on a different host by calling
> the response page using the full url
> i.e
> http://www.domain.com/subscribeResponse1.cfm?email=emailaddress&listid=1
> 
> Is there a way to do this behind the scenes without the user taking direct
> action or attach it in another manner?

With cfhttp you can call a page on a different host.

Jochem

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241675
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


RE: trigger a remote form - RE: Passing a query string as a single url variable -

2006-05-26 Thread Ian Skinner
Is there a way to do this behind the scenes without the user taking direct 
action or attach it in another manner?


Not sure what you are trying to do, but a cflocation might be what you want.

http://www.google.com/search?q=Madonna";>


--
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

-
| 1 |   |
-  Binary Soduko
|   |   |
-
 
"C code. C code run. Run code run. Please!"
- Cynthia Dunning

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message. 




~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241646
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


trigger a remote form - RE: Passing a query string as a single url variable -

2006-05-26 Thread Steve Kahn
This is SOT but,
I need to trigger a form on a different host by calling
the response page using the full url
i.e
http://www.domain.com/subscribeResponse1.cfm?email=emailaddress&listid=1

Is there a way to do this behind the scenes without the user taking direct
action or attach it in another manner?






-Original Message-
From: Ken Ferguson [mailto:[EMAIL PROTECTED]
Sent: Friday, May 26, 2006 2:57 PM
To: CF-Talk
Subject: Re: Passing a query string as a single url variable


It seems to be working as you'd expect. The following code yields the
following results:



Here is the qrystr encoded: #URLEncodedFormat(qrystr)#
save
her info


struct
ACTION  saveinfo
QRYSTR  name=Jane&eyes=brown&hair=blond&number=2125551234



Ken Ferguson
214.636.6126
[EMAIL PROTECTED]

I'm currently in the market for any available project work.
Experience, knowledge and strong references I can
certainly provide.




Ian Skinner wrote:
> So, the receiving template is going to see qrystr only as "name=Jane", and
not the full string. How can I pass qrystr in the URL so that it remains
encoded and will be received with it's complete value?
>
> I don't think this is true.  I think the status is just decoding the url
for the status display.  If you submit to your receiving page and output
url.querystr I suspect you will get the entire string you desire.
>
>
> --
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
> -
> | 1 |   |
> -  Binary Soduko
> |   |   |
> -
>
> "C code. C code run. Run code run. Please!"
> - Cynthia Dunning
>
> Confidentiality Notice:  This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message.
>
>
>
>
>



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241628
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Passing a query string as a single url variable

2006-05-26 Thread Ken Ferguson
It seems to be working as you'd expect. The following code yields the 
following results:



Here is the qrystr encoded: #URLEncodedFormat(qrystr)#
save 
her info


struct
ACTION  saveinfo
QRYSTR  name=Jane&eyes=brown&hair=blond&number=2125551234



Ken Ferguson
214.636.6126
[EMAIL PROTECTED]

I'm currently in the market for any available project work.
Experience, knowledge and strong references I can
certainly provide.




Ian Skinner wrote:
> So, the receiving template is going to see qrystr only as "name=Jane", and 
> not the full string. How can I pass qrystr in the URL so that it remains 
> encoded and will be received with it's complete value?
>
> I don't think this is true.  I think the status is just decoding the url for 
> the status display.  If you submit to your receiving page and output 
> url.querystr I suspect you will get the entire string you desire.
>
>
> --
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
> -
> | 1 |   |
> -  Binary Soduko
> |   |   |
> -
>  
> "C code. C code run. Run code run. Please!"
> - Cynthia Dunning
>
> Confidentiality Notice:  This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message. 
>
>
>
>
> 

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241625
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Passing a query string as a single url variable

2006-05-26 Thread WebMistress
Funny but when I mouse over it has it encoded.  Here's the source of my output
page.

Here is the qrystr encoded:
name%3DJane%26eyes%3Dbrown%26hair%3Dblond%26number%3D2125551234 http://www.hfdkldf.com/main.cfm?action=saveinfo&qrystr=name%3DJane%26eyes%
3Dbrown%26hair%3Dblond%26number%3D2125551234">save her info

Thank you,
Katrina Chapman
Center Manager
Whittier Community Center
435-753-9008
 

> -Original Message-
> From: Christophe Maso [mailto:[EMAIL PROTECTED] 
> Sent: Friday, May 26, 2006 12:26 PM
> To: CF-Talk
> Subject: Passing a query string as a single url variable
> 
> Trying to pass a custom query string to a template through 
> the URL, example (assume all inside cfoutput tags):
> 
> 
> Here is the qrystr encoded: #URLEncodedFormat(qrystr)#  href="http://www.hfdkldf.com/main.cfm?action=saveinfo&qrystr=#
URLEncodedFormat(qrystr)#">save her info
> 
> Testing this out, I'm seeing that the second line's output 
> indeed shows qrystr with "=" and "&" replaced by "%3D" and 
> "%26", respectively. However, when I mouseover the link on 
> line 3 and look at the URL in the status bar, I see the 
> link's url does not have qrystr encoded. So, the receiving 
> template is going to see qrystr only as "name=Jane", and not 
> the full string. How can I pass qrystr in the URL so that it 
> remains encoded and will be received with it's complete value?
> 
> I could use the replace function to custom encode qrystr 
> myself, and then decode it at the receiving template, but I 
> thought the whole point of a function like URLEncodedFormat 
> was to avoid having to do that.
> 
> 

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241624
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Passing a query string as a single url variable

2006-05-26 Thread Ian Skinner
So, the receiving template is going to see qrystr only as "name=Jane", and not 
the full string. How can I pass qrystr in the URL so that it remains encoded 
and will be received with it's complete value?

I don't think this is true.  I think the status is just decoding the url for 
the status display.  If you submit to your receiving page and output 
url.querystr I suspect you will get the entire string you desire.


--
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

-
| 1 |   |
-  Binary Soduko
|   |   |
-
 
"C code. C code run. Run code run. Please!"
- Cynthia Dunning

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message. 




~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241623
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54