Results 21 to 40 of 44
Thread: Java security
- 07-31-2008, 01:18 PM #21
- 07-31-2008, 01:40 PM #22
If you know the names.
PS This could go a lot faster if you would explain ALL of what your app is trying to do instead of a little bit at a time. Or is the design changing with every posting?Last edited by Norm; 07-31-2008 at 01:42 PM.
- 07-31-2008, 04:31 PM #23
No here's what it does. It shows a picture I don't know the names before hand then it fades out a word scrolls across the screen then another picture fades in then out then another word scrolls. The pictures are just in the folder with the source files. The words come from a text file. The applet is going up on a web page that is on some server hosted by I think Yahoo.
My IP address is 127.0.0.1
- 07-31-2008, 05:20 PM #24
If you don't know the names, then you will NOT be able to read them.I don't know the names before hand
Can you generate a file on the server that lists the names of all the files you want to be able to read? This would have to be done before the applet tries to read the file that lists the names.
Another possiblity is if the files can be named in a standard way the the applet knows and can generate names from.
For example - have the filenames start with "MyImage" and append an incrementing index to the name as the files are added to the server. The applet could start reading at the first index and continue until there was as NOT FOUND return.
- 07-31-2008, 05:44 PM #25
Yeah I could do something like that could you direct me in how to go about doing this without having an application on the server side running.
My IP address is 127.0.0.1
- 07-31-2008, 06:48 PM #26
Doing what?how to go about doing this
Who puts the files on the server? Talk to them about what you need?
- 07-31-2008, 07:13 PM #27
The Files are just ftp on to it I have the URL for the folder how do I get them in java.
My IP address is 127.0.0.1
- 07-31-2008, 07:19 PM #28
Who does the ftp? He could make up a file with all the names of the files he's uploaded and ftp that to the site.
To pass info to an Applet, use the <PARAM tag.
- 07-31-2008, 07:23 PM #29
But how do I get access to those files from the applet. I know I can figure out the names of the files I just don't know how to retrieve them.
My IP address is 127.0.0.1
- 07-31-2008, 09:43 PM #30
I posted some code from an applet a while back in this thread that showed how to use a URL to read a file from a server. It involved using the applet's codebase to get the server address.
- 07-31-2008, 10:04 PM #31
How does that work there's a lot of variables that aren't declared in that code. How do I read that into a buffered image
My IP address is 127.0.0.1
- 07-31-2008, 10:41 PM #32
I'd recommend reading the API doc for the classes used.
Forget about the contents of my variables.
Do a search for code examples of the classes used.
- 07-31-2008, 10:49 PM #33
Do I read in the file till null and put that into a File then reread it with ImageIO?
My IP address is 127.0.0.1
- 07-31-2008, 11:10 PM #34
Read the API doc for ImageIO.read() - one form takes a URL as arg.
- 08-01-2008, 07:00 PM #35
When I open the web page up on my site it gives me tells me this.Java Code:import java.io.DataInputStream; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.util.Random; import java.util.Vector; public class WordGenerator { private Vector<String> myWords; private Random rand; public WordGenerator() { rand = new Random(); myWords = new Vector<String>(); this.setupVector(); } @SuppressWarnings("deprecation") private void setupVector() { try { URL url; URLConnection urlConn; DataInputStream dis; url = new URL("http://home.comcast.net/~zosden/SmashingApples/src/Words.txt"); urlConn = url.openConnection(); urlConn.setDoInput(true); urlConn.setUseCaches(false); dis = new DataInputStream(urlConn.getInputStream()); String s; while ((s = dis.readLine()) != null) { myWords.add(s); } dis.close(); } catch (MalformedURLException mue) {} catch (IOException ioe) {} } public String getWord() { return myWords.elementAt(rand.nextInt(myWords.size())); } }
java.security.AccessControlException: access denied (java.io.FilePermission Words.txt read)
at java.security.AccessControlContext.checkPermission (Unknown Source)
at java.security.AccessController.checkPermission(Unk nown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at WordGenerator.<init>(WordGenerator.java:30)
at Window.init(Window.java:59)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Those files are no where in my source code that I can see. I'll keep trying but help would be appreciated.Last edited by Zosden; 08-01-2008 at 07:09 PM.
My IP address is 127.0.0.1
- 08-01-2008, 07:44 PM #36
As I said before, Applets can read ONLY from the site they are loaded from. To get the address of that site use the getCodeBase() method.
Look at post #8
- 08-01-2008, 09:05 PM #37
The applet lets me read using ImageIO.read(URL) I'll try the getCodeBase() method and see if that fixes the problem.
My IP address is 127.0.0.1
- 08-01-2008, 09:22 PM #38
I noticed that you are using version 1.6 to compile your applet code. This will restrict viewers to those with 1.6 plugins (I have 1.5) If you compile code to 1.4 there will be more possible viewers.
How are you testing the applet? Do you have a server like Tomcat on your PC that you can use to allow quick tests? I would recommend having your own server. I suppose you do with your signature.
For testing this I/O stuff, I'd recommend writing a 20 line applet that reads a file and displays it contents. Using your own server you can quickly make changes to the code and test it in a few minutes.
- 08-01-2008, 10:42 PM #39
I got it to work. Thanks for the help. You can see it if you like at my web page.
Click on my applet on the left
Wikipedia that IP Address btw. How do you change which version you compile it in I just been using the command prompt.My IP address is 127.0.0.1
- 08-01-2008, 11:11 PM #40
Similar Threads
-
java.security.cert.CertificateException: Couldn't find trusted certificate
By Marcus in forum Advanced JavaReplies: 3Last Post: 01-14-2010, 07:45 PM -
Java Security Applet will not load under a specific user.
By MartyF in forum Java AppletsReplies: 0Last Post: 03-31-2008, 04:35 PM -
java.security.cert.CertificateException: Couldn't find trusted certificate
By Felissa in forum Enterprise JavaBeans (EJB)Replies: 4Last Post: 08-10-2007, 10:09 PM -
java.security.AccessControlException
By cecily in forum Java AppletsReplies: 1Last Post: 08-06-2007, 02:49 AM -
difference between code based security and role based security
By boy22 in forum New To JavaReplies: 1Last Post: 07-23-2007, 11:59 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks