Win a copy of Spark in Action this week in the Open Source Projects forum!

john Riche

Greenhorn
+ Follow
since Nov 16, 2000
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by john Riche

The code is vast here is relevant segments:-

import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;
import java.util.*;
import java.net.*;
import com.sun.java.swing.*;
import java.io.File;
import com.sun.java.swing.preview.filechooser.*;
import java.util.EventListener;
import netscape.security.*; // from java40.jar
//import com.ms.security.*;
public class JApplet1 extends JApplet
{
final private boolean bAppletSecurity = true;
public void JApplet1() //throws Exception
{
try
{ // This trick doesn't work either to enable security
/*SecurityManager sm = System.getSecurityManager();
if (sm!=null)
sm.checkSystemClipboardAccess(); */

//if (bAppletSecurity)
// this runs but doesn't do what we want
//PrivilegeManager.enablePrivilege ("UniversalSystemClipboardAccess");
//PrivilegeManager.enablePrivilege ("UniversalSystemClipboardAccessTarget");

// running these gives -> .ForbiddenTargetException
//PrivilegeManager.enablePrivilege ("checkSystemClipboardAccess");
//PrivilegeManager.enablePrivilege ("checkSystemClipboardAccess");
//PrivilegeManager.enablePrivilege ("checkSystemClipboardAccessTarget");
//if (bAppletSecurity)

}
catch(AppletSecurityException fte)
{
System.out.println("AppletSecuriyException: Clipboard" + "\n");
JOptionPane.showMessageDialog( null,
"AppletSecuriyException: Clipboard: No copy/paste",
"AppletSecuriyException",
JOptionPane.ERROR_MESSAGE );
}
Object selValue = JOptionPane.showInputDialog( null,"Email download \n" +
"LOGIN FIRST: In seperate window!"+
"\n\nEnter the full email 'URL' string to your mailbox",
"Enter Mailbox Url", JOptionPane.QUESTION_MESSAGE, null, null, sDefault);
if (selValue != null)
sMailbox = selValue.toString();
if ((sMailbox == null) | | (sMailbox.length() == 0)) //null check 1st or else DETH!
{
JOptionPane.showMessageDialog( null,
"No Server Entered: So quiting!",
"No Server Entered", JOptionPane.ERROR_MESSAGE );
return;
}
Object selValue1 = JOptionPane.showInputDialog( null,"Email download \n" +
"Enter Directory 'Folder' Path: "+
"\n\nNB: The folder must already exist!! or be created before closing this dialog",
"Enter Path", JOptionPane.QUESTION_MESSAGE, null, null, sDefPath);
if (selValue1 != null)
sDirPath = selValue1.toString();
// Test Dir entered, if valid change deault Dir
if ((sDirPath != null) && (sDirPath.length() > 0)) //null check 1st or else DETH!
{
if (bAppletSecurity)
PrivilegeManager.enablePrivilege ("UniversalFileAccess");
File name = new File(sDirPath);
if ( name.isDirectory())
{
sDefPath = sDirPath;
if (sDefPath.charAt(sDefPath.length()-1) != '\\')
sDefPath = sDefPath + "\\";
}
}
/* Object[] possibleValues = { "First", "Second", "Third" };
Object selectedValue = JOptionPane.showInputDialog(null,
"Choose one", "Input",
JOptionPane.INFORMATION_MESSAGE, null,
null, sDefault);*/

if (find("Hotmail", sMailbox))
{
int iInd = 0;
iInd = search("/cgi-bin/", sMailbox);
if (iInd > -1)
sUrlPrefix = sMailbox.substring(0, iInd);
else
sUrlPrefix = "http://lw7fd.law7.hotmail.msn.com";
sGetMsg = "/cgi-bin/getmsg?";
}
else
{
sGetMsg = JOptionPane.showInputDialog( "Email download \n\n" +
"Enter 'unique string' to help identify the email message links!"+
"\n\n\n (i.e. '/cgi-bin/getmsg?' (default)");
if ((sGetMsg == null) | | (sGetMsg.length() == 0)) //null check 1st or else DETH!
sGetMsg = "";
sUrlPrefix = JOptionPane.showInputDialog( "Email download \n\n" +
"Enter 'Server string' to prefix email message links!" +
"\n\n (Leave blank if HTML contains HTTP:// email links)");
if ((sUrlPrefix == null) | | (sUrlPrefix.length() == 0)) //null check 1st or else DETH!
sUrlPrefix = "";
}
/* if isNum(sMailbox)
{
sServerID = JOptionPane.showInputDialog( "Email download \n\n" +
"Number entered so assuming Hotmail Account!"+
"\n\n\n (Please enter Hotmail 'Server' number where a/c resides? i.e. 7(default)" );
if ((sServerID == null) | | (sServerID.length() == 0)) //null check 1st or else DETH!
sServer = "http://lw7fd.law7.hotmail.msn.com/cgi-bin/HoTMaiL?n=";
else
sServer = "http://lw"; + sServerID +"fd.law" + sServerID + ".hotmail.msn.com/cgi-bin/HoTMaiL?n=";
sUrlPrefix = sServer.substring(0,search("/cgi-bin/", sServer));
sServer = sServer + sMailbox + "&fti=yes&_lang=EN";
sGetMsg = "/cgi-bin/getmsg?";
}
else
{
sGetMsg = JOptionPane.showInputDialog( "Email download \n\n" +
"Enter 'unique string' to help identify the email message links!"+
"\n\n\n (i.e. '/cgi-bin/getmsg?' (default)" +
"\n\n Add 'http://server-name.com/getmsg?' if absent from links in HTML" +);
if ((sGetMsg == null) | | (sGetMsg.length() == 0)) //null check 1st or else DETH!
sGetMsg = "/cgi-bin/getmsg?";
//sYahoo="http://lw4fd.law4.hotmail.msn.com/cgi-bin/HoTMaiL?n=26780&fti=yes&_lang=EN";
}*/
String sQuery="";
String s1="";
String s2="";

//s1 = "http://lw7fd.law7.hotmail.msn.com/cgi-bin/HoTMaiL?n=";
//s2 = "&fti=yes&_lang=EN";
//sServer = "lw7fd.law7.hotmail.msn.com";
//sMailbox = s1 + sMailbox + s2;
//aHTML = urlArray(sYahoo);
//sYahoo = "http://lw7fd.law7.hotmail.msn.com/cgi-bin/getmsg?curmbox=F000000001&a=866670099866586774&msg=MSG972576734.13&start=1319346&len=2561&msgread=1&mfs=1290";
// NB: Clicking cancel on dialog causes null pointer? unless NULL is used!!?
/* if ((sYahoo != null) && (sYahoo.length() > 0)) //null check 1st or else DETH!
{
// NB Yahoo search requires spaces between words ion search page field to operate correctly!
// so we can insist on that also, no +metro+storage -> +metro +storage
sQuery = sYahoo;
sYahoo = sYahoo.trim();
sYahoo = replace(sYahoo,"+", "%2b");
// set this correct!!
sYahoo = replace(sYahoo,"\"", "%22");
sYahoo = replace(sYahoo," ", "+");
if (sYahoo.charAt(0) == '+')
sYahoo = sYahoo.substring(1,sYahoo.length()); // remove 1st 'unwanted' +, substring -1 off index
sYahoo = "http://google.yahoo.com/bin/query?p="; + sYahoo;
}*/
/* JOptionPane.showMessageDialog( null,
sYahoo,


Originally posted by john Riche:
Hi
I'm writing Applets that save Files to disk from data from Url's using "java40.jar" (netscape.security) package? Visual Cafe 3!
Trouble is it took ages to get the IDE to recognise the classes/jar file and I have no idea how to allow other users to use the apllet or configure other machines. (errors below)
Has anyone ran into this with "java40.jar" or other classes?
Here's what I've tried :-
1. Adding the current directory to the "classpath"
2. Adding java40.jar to the "classpath"
3. Unzipping the jar to a subdir netscape\security classes
4. Copying java40.jar to classpath Jaca folders
Erors:
-------
Error: File C:\Wip\PrivilegeManager.class does not contain PrivilegeManager as expected, but netscape.security.PrivilegeManager. Please remove the file, or make sure it appears in the correct subdirectory of
Error: the class path.
Error: C:\wip\JApplet1.java(940): Class PrivilegeManager not found in type declaration
Error: C:\wip\JApplet1.java(940): Undefined variable or class name: PrivilegeManager
Any help appreciated.
Please reply ro
john_riche@hotmail.com


19 years ago
Hi
I'm writing Applets that save Files to disk from data from Url's using "java40.jar" (netscape.security) package? Visual Cafe 3!
Trouble is it took ages to get the IDE to recognise the classes/jar file and I have no idea how to allow other users to use the apllet or configure other machines. (errors below)
Has anyone ran into this with "java40.jar" or other classes?
Here's what I've tried :-
1. Adding the current directory to the "classpath"
2. Adding java40.jar to the "classpath"
3. Unzipping the jar to a subdir netscape\security classes
4. Copying java40.jar to classpath Jaca folders
Erors:
-------
Error: File C:\Wip\PrivilegeManager.class does not contain PrivilegeManager as expected, but netscape.security.PrivilegeManager. Please remove the file, or make sure it appears in the correct subdirectory of
Error: the class path.
Error: C:\wip\JApplet1.java(940): Class PrivilegeManager not found in type declaration
Error: C:\wip\JApplet1.java(940): Undefined variable or class name: PrivilegeManager
Any help appreciated.
Please reply ro
john_riche@hotmail.com

19 years ago
Hi
Has anyone used the PolicyEngine in IE to enable Applet File IO and Url connections?
Methods like the following are used but I'm not sure where to find the apropriate classes / jar file :-
com.ms.security.PolicyEngine.assertPermission(PermissionID.UI);
I also need to find out what the paramters are such as :- PermissionID.UI
Here is a short example code using Netscape and IE. (below)
Any help appreciated.
Please reply ro
john_riche@hotmail.com

<code>
if (mBrowser.equals(kNetscape)) {
try {
PrivilegeManager.enablePrivilege("UniversalFileRead");
}
catch (Exception exc) { ... }
}
else if (mBrowser.equals(kMSIE)) {
/* --- The UI permission is required to use FileDialog --- */
com.ms.security.PolicyEngine.assertPermission(PermissionID.UI);
com.ms.security.PolicyEngine.assertPermission(PermissionID.FILEIO
);
}

19 years ago
I have successfully used "Java40.jar" (netscape.security package) to enable Applets to have File IO and enable URL connections.
Has anyone used the following code sample to enable privilages in NS but have had problems with the Clipboard.
// this following run but doesn't work :-
PrivilegeManager.enablePrivilege ("UniversalSystemClipboardAccess");
PrivilegeManager.enablePrivilege ("UniversalSystemClipboardAccessTarget");
The following causes "ForbiddenTargetException" on execution:-
PrivilegeManager.enablePrivilege ("checkSystemClipboardAccess");
PrivilegeManager.enablePrivilege ("checkSystemClipboardAccess");
PrivilegeManager.enablePrivilege ("checkSystemClipboardAccessTarget");
File IO (works!)
PrivilegeManager.enablePrivilege ("UniversalFileAccess");

Any Url . .(works!)
PrivilegeManager.enablePrivilege ("UniversalConnect");
Any help appreciated.
Please reply ro
john_riche@hotmail.com
19 years ago
Hello
I've been working on the above to automate "Email Login" for both a Java
application and Applet.
If anyone is working on this too and interested in collaborating or has
final code they are willing to share this would be most helpful.
Just to explain the background. POST form info is sent to a mail server
such as Yahoo or Hotmail and cookies are collected which are later sent
back to the server to download individual mail messages.
Some of the tricky issues I have encountered are not being able to
communicate via URL using HTTPS (SSL) in JBuilder 3. This had meant I am
unable to use JB3 to login into Hotmail. I am about to try this on VC
and JB4. The other problem is not being able to handle "redirects" to
allow collection of all the cookies that will be needed to be passed
back to the server.
On the Applet side Netscape appears to be taking care of the cookies
issue. However I then must Sign the applet to enable it to save
individual email messages to local hard disk. I have been unsuccessful
so far is completing this step. I have been hampered by the fact that
some code I was using involved swing and other areas that aren't
supported in Netscape 4.6 without a plug-in. Additionally JB3 has no
support for debugging Applets, Unbelievable!
I have searched many forums and this is one of the single most
frequently asked questions. But there is no definitive code out there.
Anyway here I am waffling on. If anyone is interested in collaborating
please let me know you can reply directly to the email address below.
thanks
john_riche@hotmail.com

19 years ago
Hello
I've been working on the above to automate "Email Login" for both a Java
application and Applet.
If anyone is working on this too and interested in collaborating or has
final code they are willing to share this would be most helpful.
Just to explain the background. POST form info is sent to a mail server
such as Yahoo or Hotmail and cookies are collected which are later sent
back to the server to download individual mail messages.
Some of the tricky issues I have encountered are not being able to
communicate via URL using HTTPS (SSL) in JBuilder 3. This had meant I am
unable to use JB3 to login into Hotmail. I am about to try this on VC
and JB4. The other problem is not being able to handle "redirects" to
allow collection of all the cookies that will be needed to be passed
back to the server.
On the Applet side Netscape appears to be taking care of the cookies
issue. However I then must Sign the applet to enable it to save
individual email messages to local hard disk. I have been unsuccessful
so far is completing this step. I have been hampered by the fact that
some code I was using involved swing and other areas that aren't
supported in Netscape 4.6 without a plug-in. Additionally JB3 has no
support for debugging Applets, Unbelievable!
I have searched many forums and this is one of the single most
frequently asked questions. But there is no definitive code out there.
Anyway here I am waffling on. If anyone is interested in collaborating
please let me know you can reply directly to the email address below.
thanks
john_riche@hotmail.com

19 years ago
Hello
I've been working on the above to automate "Email Login" for both a Java application and Applet.
If anyone is working on this too and interested in collaborating or has final code they are willing to share this would be most helpful.
Just to explain the background. POST form info is sent to a mail server such as Yahoo or Hotmail and cookies are collected which are later sent back to the server to download individual mail messages.
Some of the tricky issues I have encountered are not being able to communicate via URL using HTTPS (SSL) in JBuilder 3. This had meant I am unable to use JB3 to login into Hotmail. I am about to try this on VC and JB4.
The other problem is not being able to handle "redirects" to allow collection of all the cookies that will be needed to be passed back to the server.
On the Applet side Netscape appears to be taking care of the cookies issue. However I then must Sign the applet to enable it to save individual email messages to local hard disk. I have been unsuccessful so far is completing this step.
I have been hampered by the fact that some code I was using involved swing and other areas that aren't supported in Netscape 4.6 without a plug-in. Additionally JB3 has no support for debugging Applets, unbelievable!
I have searched many forums and this is one of the single most
frequently asked questions. But there is no definitive code out there.
Anyway here I am waffling on. If anyone is interested in collaborating please let me know you can reply directly to the email address below.
thanks
john_riche@hotmail.com