Here's some code I've used to read a file from a server:
[ August 28, 2008: Message edited by: Norm Radder ]
Joined: Aug 22, 2008
sir in my web based project i need to read file from directory and display it in applet which in turn displayed in html means applet code is embedded in html .
and this is running through web server tomcat tell now applet is displaying all components in html next step is to read the file and display it
when i directly display without server by double clicking html it will show file read in applet and displayed in html
then how shell i do it through server can any body guide me its urgent i am not getting
when i try to do this it is showing exception c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message l: dump classloader list m: print memory usage o: trigger logging p: reload proxy configuration q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack x: clear classloader cache 0-5: set trace level to <n> ----------------------------------------------------
The Direcory location=null Full directory path=/localhost:7001/appletcodenull java.security.AccessControlException: access denied (java.io.FilePermission \localhost:7001\appletcodenull read) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkRead(Unknown Source) at java.io.File.isDirectory(Unknown Source) at Backup.init(Backup.java:131) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
and my code to read file in applet is this ///============Reading from file==========
An applet without permission can NOT look/read at the local file system. It can get(read) files from the server without permission.
No it can't. A web server is not a file server.
The only ways an applet can read "files" from the server are these:
1. The web server is willing to package the content of the desired file in an HTTP response and serve it back in response to an HTTP request.
2. The applet is signed and the server file is visible through a file server. This file server may be on the same machine as the web server, but a file server is a completely different application from the web server, using different protocols, different network ports and different client and server software. [ September 01, 2008: Message edited by: Tim Holloway ]
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Aug 10, 2005
A web server is not a file server.
Interesting differentation: From Google:
HTTP: every web server program operates by accepting HTTP requests from the client, and providing an HTTP response to the client.
a file server is a completely different application from the web server
Could you explain? I'm not familiar with weblogic, perhaps their server works differently from common ones on the internet. Then your quotes above could say that (ie use weblogic server vs just web server).
When I said an applet could read/get files from its server, I didn't mean any file on the server. Of course there are restrictions. [ September 01, 2008: Message edited by: Norm Radder ]
Joined: Aug 22, 2008
ya i got your code and woked it now my code is working through web logic server
thank you very much
weblogic is a server that is aplication server(that handle servlet jsp, ejb)
i have another doubt
now my applet code is embedded in servlet code if i write System.out.println("any msg"); in servlet it will be showing server console
but if i write System.out.println("any msg"); in applet and try to run in server it will not be showing in server console tell me the reason
pl pl pl
Joined: Aug 10, 2005
if i write System.out.println("any msg"); in applet and try to run in server it will not be showing in server console
How/why are you running an Applet in the server? Applets normally run in a client's browser.
subject: how to read file into applet in weblogic server