Results 1 to 9 of 9
  1. #1
    phanisrinivas is offline Member
    Join Date
    Aug 2012
    Posts
    7
    Rep Power
    0

    Default Applet Security Issue While trying to access the local resources from server html

    Hi All,

    Firstly I will explain what the scenario I am trying.I already signed the applets.

    Scenario:

    I want to execute the server HTML file using local system resources and tried to download the jar files if client doesn't have proper printer resources(jar files)

    Trying to communicate with the printer from server using applets.The HTML file is in some remote location.The jar files are in local system,in some path.When I execute the HTML file link in web browser it gives
    "permission denied file:///D:/webapplets/demo.jar" {jar file(s)resides in local system}.

    Can any one tell me how to resolve this permission denied exception?
    Is the above scenario with applet is possible or not?
    I tried in lot of ways to execute the file but it gives the same exception as I mentioned above.

    Here is the code of my html file.

    <html>
    <title>Demo Applet</title>
    <head>
    <script language="javascript">
    function findSum()
    {
    var v=document.simpleapplet.sum();
    document.write(v);
    }
    </script>
    <body onLoad="findSum()">
    <applet code="Serverapplet.class" name="simpleapplet" archive="file:///D:/webapplets/demo.jar" height="10" width="10">
    </applet>
    </body>
    </head>
    </html>

    This example gives some value returned by java method.

    please reply me as soon as possible.

    Thanks in advance.
    Last edited by phanisrinivas; 09-11-2012 at 02:01 PM.

  2. #2
    sabre150 is offline Member
    Join Date
    Jul 2012
    Location
    Earth
    Posts
    75
    Rep Power
    0

    Default Re: Applet Security Issue While trying to access the local resources from server ht

    This whole approach does not make sense. If you want to execute something locally using only local jar files then why use an Applet.Just use a Java application.

    Something tells me that what you really need is WebStart but I could be wrong.

  3. #3
    phanisrinivas is offline Member
    Join Date
    Aug 2012
    Posts
    7
    Rep Power
    0

    Default Re: Applet Security Issue While trying to access the local resources from serverhtml

    HI,

    Thanks for Immediate Reply.

    I don't want web start concept, Actually I am trying the above scenario only let me Explain that clearly once again.


    Scenario:

    I already done calling java method into applet and executed through browser.This entire thing up to know I did in local system.All jar files,HTML file and certificates are in local system and in the same path.Then applet executed well in browser which is in local system.

    Let us consider HTML file is in server,All jar files and other files are in local system.When I execute the html file using server link it is not loading jar files from local system.I am trying for that.I already tried the scenario and I got permission denied exception.I resolved the exception by defining "codebase" parameter but applet is not showing any thing on browser when it is executed.

    Tell me where I am going wrong?

    Here is the code I wrote for html to load the applet.

    <html>
    <title>Demo Applet</title>
    <head>
    <script language="javascript">
    function findSum()
    {
    var v=document.simpleapplet.sum();
    document.write(v);

    }
    </script>
    <body>
    <applet code="Serverapplet" name="simpleapplet" codebase="file:///D:/webapplets/" archive="file:///D:/webapplets/demo.jar" height="100" width="100"></applet>
    <input type="button" name="submit" value="find" onclick="findSum()">
    </body>
    </head>
    </html>

    When I execute the above code it is loading and won't displaying any thing on browser.

    Below is the java code.

    import java.awt.*;
    import java.applet.*;

    public class Serverapplet extends Applet
    {
    int k;
    public void init()
    {
    sum();
    }
    public int sum()
    {
    int i=1,j=1;
    k=i+j;
    return k;
    }

    }


    Is it possible to communicate with local jar files from remote html file?

    Thanks In advance.

  4. #4
    sabre150 is offline Member
    Join Date
    Jul 2012
    Location
    Earth
    Posts
    75
    Rep Power
    0

    Default Re: Applet Security Issue While trying to access the local resources from serverhtml

    Quote Originally Posted by phanisrinivas View Post
    Tell me where I am going wrong?:
    I don't think I can help since you seem determined to use an Applet where a program is required. Nothing in what you have posted requires an Applet since you say that ALL the resources you need are stored locally! Can you help me understand why an Applet is being used?

  5. #5
    phanisrinivas is offline Member
    Join Date
    Aug 2012
    Posts
    7
    Rep Power
    0

    Default Re: Applet Security Issue While trying to access the local resources from serverhtml

    Hi,

    Thanks for the reply,

    Actually our scenario is, we are using Apache server for application, its PHP YII framework application. Actually we need to give print operation in either way of PHP or using java POS. All Java POS resources are initially stored in server. For the first time if I try to print from Java POS then it should download all the resources from the server. Then by taking help of the Java POS resources the receipt will print. For this reason I'm trying access the server HTML file and trying to load Applet locally in the same file with necessary java POS resources. But I'm failing to communicate with the local resources in this scenario.

  6. #6
    sabre150 is offline Member
    Join Date
    Jul 2012
    Location
    Earth
    Posts
    75
    Rep Power
    0

    Default Re: Applet Security Issue While trying to access the local resources from serverhtml

    Quote Originally Posted by phanisrinivas View Post
    Hi,

    Thanks for the reply,

    Actually our scenario is, we are using Apache server for application, its PHP YII framework application. Actually we need to give print operation in either way of PHP or using java POS. All Java POS resources are initially stored in server. For the first time if I try to print from Java POS then it should download all the resources from the server. Then by taking help of the Java POS resources the receipt will print. For this reason I'm trying access the server HTML file and trying to load Applet locally in the same file with necessary java POS resources. But I'm failing to communicate with the local resources in this scenario.
    I know next to nothing about JavaPOS but quite a bit about Applets and the Applet signing process. I really don't see why you need to run the Applet using only local jars and I can fully understand the reason for the security exception. BUT, since I know so little about JavaPOS I am only willing to stick my neck out a short way and say that your approach is flawed.

  7. #7
    phanisrinivas is offline Member
    Join Date
    Aug 2012
    Posts
    7
    Rep Power
    0

    Default Re: Applet Security Issue While trying to access the local resources from serverhtml

    Thanks for Reply

    Java POS is a "Java point of sale system" API which contains the POS devices (like printers,keyboard,cash drawers etc..) methods,classes and Interfaces.All kind of POS operations we use this API to communicate with the POS devices.By using javapos API we already Developed applet to communicate with the printer.

    If I click on the print button from the browser it will communicate with the printer and give a printout.[All jar files and html files are in current directory only].

    Now trying the same thing with below scenario.

    Actually our scenario is, we are using Apache server for application, its PHP YII framework application. Actually we need to give print operation in either way of PHP or using java POS. All Java POS resources are initially stored in server. For the first time if I try to print from Java POS then it should download all the resources from the server. Then by taking help of the Java POS resources the receipt will print. For this reason I'm trying access the server HTML file and trying to load Applet locally in the same file with necessary java POS resources. But I'm failing to communicate with the local resources in this scenario.

  8. #8
    sabre150 is offline Member
    Join Date
    Jul 2012
    Location
    Earth
    Posts
    75
    Rep Power
    0

    Default Re: Applet Security Issue While trying to access the local resources from server ht

    I know what a POS system is but I have never been involved in one. For a long time I have been involved with Applets and Applet security. I cannot see why you are trying to use an Applet here since you patently do not require an Applet and as shown by the exception you get I'm pretty sure you violate the Applet security model.

    As far as I can see you just want an Application to be downloaded from a web server and then executed which is exactly what WebStart is designed to do! There are also has security considerations which may be difficult to manage without using WebStart and the only way I can see WebStart not being applicable is if it is not available on the POS system.

    Sorry but my lack of knowledge of POS means I can't help. Bye.

  9. #9
    phanisrinivas is offline Member
    Join Date
    Aug 2012
    Posts
    7
    Rep Power
    0

    Default Re: Applet Security Issue While trying to access the local resources from server ht

    Thank you
    For spent your valueble time with me.bye

Similar Threads

  1. Replies: 0
    Last Post: 06-26-2011, 01:39 AM
  2. Replies: 1
    Last Post: 03-05-2011, 05:47 PM
  3. Local file access
    By joe_coolish in forum Java Applets
    Replies: 1
    Last Post: 02-18-2010, 01:51 PM
  4. Access to resources inside jar file
    By aleks.farrier in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 04-15-2009, 01:29 PM
  5. External runtime resources access in Eclipse
    By batkins61 in forum Eclipse
    Replies: 0
    Last Post: 01-07-2009, 05:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •