Distributing Applet in Web Server

Hello,
I am in the process of creating a new web server. Although, I have found an error that when you retrieve applets from my server they don't work, whereas they do normally if locally. The file is send exactly as it is through a binary transfer. I am wondering if Java has any sort of header information or something that must be attached to the transfer while being sent or if anyone has encountered this before.
Thank you

Well, as I said I am creating a web server. It works by when it recieves a request for a file, it opens the file in binary mode and transfers it as binary to the program that requested it (the web browser).
I have created an applet that works fine when it is run locally on my desktop, but when I try to run it through my web server by setting the codebase equal to "http://localhost/" the applet will not run. It returns a NullPointerException and I am not sure why.
Thank you for your help

Similar Messages

  • Send data from applet to web server

    Hi,
    I want to send data(event notification) to resource through web server using url.
    Like,As long as perticular action or event is occuring I am sending that message to url.
    I reffered Sevlet theory uses HTTPMessage,but I am confused how should start and what would be feasible?
    Even when I run my code I am not finding browser.How should I place an applet in web server page?
    Regards,
    Palak
    Message was edited by:
    palak_shah

    Hi
    I agree usage of HttpClient is a better and a simple method.
    But If your Application Requirements are Simple you may go by using URL & URLconnection Objects in java.net package.
    Just to Add In You Can Checkout the links given below to have a better understanding of how the communication works...
    The Example APPLET code:
    http://mindy.cs.bham.ac.uk/AppletServletExample/EgApplet.java.txt
    The Example SERVLET code:
    http://mindy.cs.bham.ac.uk/AppletServletExample/EgServlet.java.txt
    and the Example AppletDemo Class
    http://mindy.cs.bham.ac.uk/AppletServletExample/EgApplet.class
    Hope this helps :)
    REGARDS,
    RaHuL

  • Applet hangs web server when upgrading from 1.6 to 1.7

    I've got a client-side printing application which works fine on 1.6 and fails on 1.7 where it essentially hang the server on the connect option to the server and loading the jar file. Specifics:
    PC Client running windows 7 x64
    Browser versions IE9, IE10, Firefox 17.0.1 (PC-client) all fail
    Client PC has latest Java 1.7.0 10-b 18 installed
    Web server is Apache2.4.3 x64 running on Windows 2008 Server R2 through the network
    Jar file is signed and the certificate is loaded
    Apache server is sitting on another server through a network connection. Backrev java to 1.6 and it passes. I've specified the -Djava.net.prefIPv4Stack=true option in the applet call but it doesn't fix the issue.
    The java console loads but then hangs on the connecting portion:
    Java Plug-in 10.10.2.18
    Using JRE version 1.7.0_10-b18 Java HotSpot(TM) Client VM
    User home directory = C:\Users\user
    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
    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>
    cache: Initialize resource manager: com.sun.deploy.cache.ResourceProviderImpl@1ae81ab
    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws
    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws,com.sun.deploy
    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws,com.sun.deploy
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.
    security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws
    security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws
    security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws,com.sun.deploy
    security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws,com.sun.deploy
    security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
    security: property package.definition value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.definition new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.org.apache.xerces.internal.utils.,com.sun.org.apache.xalan.internal.utils.,com.sun.org.glassfish.external.,com.sun.org.glassfish.gmbal.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
    security: --- parseCommandLine converted : -Djava.net.preferIPv4Stack=true
    into:
    [-Djava.net.preferIPv4Stack=true]
    basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@8bbbf4
    basic: Plugin2ClassLoader.addURL parent called for http://10.100.1.61/patholog/java/patholog/dist/PathologLibS.jar
    security: Blacklist revocation check is enabled
    security: Trusted libraries list check is enabled
    network: Cache entry found [url: http://10.100.1.61/patholog/java/patholog/dist/PathologLibS.jar, version: null] prevalidated=true/0
    cache: Adding MemoryCache entry: http://10.100.1.61/patholog/java/patholog/dist/PathologLibS.jar
    cache: Resource http://10.100.1.61/patholog/java/patholog/dist/PathologLibS.jar has expired.
    network: Connecting http://10.100.1.61/patholog/java/patholog/dist/PathologLibS.jar with proxy=DIRECT
    network: Connecting http://10.100.1.61:80/ with proxy=DIRECT
    network: Connecting http://10.100.1.61/patholog/java/patholog/dist/PathologLibS.jar with cookie "Patholog=vl141e491gffhpc07aupt0rnq5"
    What is most irritating is that a local instance for debugging (i.e. apache2.4.3 x64) running locally and running the application on the same machine) passes perfectly so it appears that it involves a network connection rather than a localhost operation.
    I noticed on a good connection the server returns with ResponseCode 304. I do not see that line in the log on the failing applet load. Apache logs set at debug show no errors even though the operation hangs the server.
    Anyone got any ideas on how to debug and resolve this?
    -Thanks
    -G

    More information:
    Installed jre.1.6.37 (x32 version) along with 1.7.10 (x32 version) and the applet loads. Installed 1.7.10 (x32 version) only on the windows 7 x64 client fails. I've done both the x-java-applet method and the JNLP method and both hang. The JNLP j2se version is set to "1.6+" so in theory 1.7 should jre should work fine without a 1.6.37 loaded.
    I've got wireshark dumps that I'm analyzing and noticed that there two OCSP responses (successful) but nothing after that, specifically where it hangs. Any ideas on how to debug this further?

  • Can applet access oracleDB which not on the Web server

    can anyone tell me if I could use applet come from a Web server to access oracle DB on the other workstation, how to do it

    teekay wrote:
    It should work already as the default config also sets an /owncloud alias. If it doesn't work, try
    ln -s /usr/share/webapps/owncloud /srv/http/owncloud
    It worked before when I first tested owncloud (6 months ago)
    the symlink works if I remove apaches owncloud conf file.
    I'll mark this as solved, but it should work with the conf file in place, not the symlink on the filesystem.
    Thanks, I don't know why i did not try that before

  • Applet can't read local file on web server, security issue!

    There is any way to read/write files of web server through the applet except the Signed Applet.
    If any idea the reply me soon.
    Thanks in advance

    Applets are downloaded from web servers and execute on the client machine.
    Therefore they have no access to the web server file system, signed or not.
    They could have access to the client file system (the machine where they run),
    but for security reasons only signed applets have this privilege.
    So to answer your question, you sign if you want to access client files.
    To access web server files, you don't need to sign the applet, but you need
    to provide some method of accessing files remotely, for instance:
    - Files published for the web can be read using HTTP
    - Files can be read or writen with the help of an FTP server on the same machine as the web server
    - A servlet running on the HTTP server can collaborate with your applet to exchange files

  • Applet reading files in in web server eg geocities

    hi ,
    i have an applet that reads files i have created in a web server. when i try to run the applet in , internet explorer i get an error message
    java.io.FileNotFoundException: nic.txt (The system cannot find the file specified)
    does anyone have any solution to this problem. do i need a policy file and if i do where do i put it.

    Applets work on the clients computer, not the server. Your applet is >trying to read nic.txt from your computer. Can't be done easily, you'd >need your own serverprogram to do the reading and pass the data to the >client... let me clarify afew points
    the applet is on a webserver eg. geocities.
    the file is also on the same directory as the applet .class file.
    so everything is on the web server,.

  • Setup an applet on a web server?

    Hi,
    can somebody please tell me how to setup an applet on a web server??
    My applet need some *.jar??
    Thank u
    Andy

    You need to:
    1) Compile all .class files
    2) Compress them in a .jar file
    3) Sign the .jar file and export a certificate (check the sun tutorials on how to sign jar files)
    4) Write a simple html file with the appropriate tags that specify the archive files (i.e. the jar) and the main code (i.e. the principal class file)
    5) Finally, enjoy the .html file in any browser
    Hope this helps.

  • Applet deploy on Web Server Apache(Linux)

    After developing/Testing the Applet on the JDEVELOPER 3.1, I deployed the jar files created by deployment wizard into the Web Server (Apache on Linux 6.0). When running the applet I received error in Apache log file telling me: File does not exist ../ResTable_en_US.class and I know that
    this class is not in any of the deployed jar/zip files, but ResTable.class is in one of the deployed file. I receive a lot of missing file with related error.
    How can I tell to the applet to look for ResTable.class and not for ResTable_en_US.class?

    I searched the archives and found this:
    It seems others have seen this problem also but intermittently on some machines and not others. One suggested workaround that I found is to Switch off the JIT in Java Plug-in 1.2 !
    It works now perfectly.
    I hope this applies and helps,
    -John
    null

  • Global data in a servlet using iPlanet Web Server

    Our configuration is an Applet->Servlet->JNI->C/C++ code.
    We have C code that does a number of lengthy mathematical calculations. This C code not only uses its own global variables but, it is also comprised of numerous subroutines that all call each other, reading and writing global C variables as they go. These globals are all isolated to the C code shareable object (.so) library that is included using the LoadLibrary call when the servlet is initialized.
    The problem is that in a multi-user environment (3-5 simultaneous users) we need to have each user have their own "copy" of the servlet (and the C code) so that users will not be accessing each other's global data. We can NOT have only one copy of the C code and define it as synchronized because the calculations that are performed can take a very long time and we can not hold off user requests while the firs user finishes.
    Our hope is that there is a way to configure the iPlanet Web server such that each new user that starts up a copy of the Applet/Servlet combination will get their own "space" so that they can work independently of any other user. We have at most 20 users of this system and only 3-5 simultaneous users so we should not have a problem with memory or CPU speed.
    If anyone has a solution, I would greatly appreciate it!

    The C library is shareable. But you don't want it to be shared. That's your question summarized, isn't it?
    You probably can't prevent it from being shared, so to prevent multiple use of it you would have to queue up the requests to be done one at a time. WynEaston's suggestion of having the servlet implement SingleThreadModel would help, but I believe the servlet spec allows servers to run multiple copies of a servlet that does that (as opposed to running a single copy in multiple threads).
    Your other alternative is to rewrite the math in Java, or at least in some object-oriented language where you don't need global variables (which are the source of your problem). All right, I can already hear you saying "But that wouldn't be as fast!" Maybe not, but that isn't everything. Now you have a problem in queueing theory: do you want a single server that's fast, but jobs have to wait for it, or do you want multiple servers that aren't as fast, but jobs don't have to wait? That's a question you would have to evaluate based on the usage of your site, and it isn't an easy one.

  • Applet or web-start? How can I package a memory intensive app?

    Dear All,
    I'm new here - I'm learning about Java with a particular project in mind, and looking for advice from people with more experience before I start coding! Your opinions would be very useful.
    I would like to write a small scientific application, to be distributed by the web, easy to run as a normal user (without administrator rights), with a good GUI. So Java sounds very good for this. However, the application will be very memory intensive (and quite CPU intensive) with several large arrays. It may require ~1 to 2 Gb of memory at times. I have three simple questions:
    1) If I write it as an applet, will my users hit memory 'heap size' limits when they try and run it if it tries to use ~1 Gb memory? Can I control this?
    2) If I write it using JNLP (e.g. Sun's Java Web-Start), will my users get memory limit errors if my application tries to use ~1 Gb memory? Can I control this?
    3) If more and more people start using the Java browser plugin, will they get Web-Start installed at the same time? Or will Web-start become less common?
    Any other advice about this choice, problems with web-start or resource hungry applets would also be gratefully received.
    With thanks and best regards,
    andy_g
    (PS: I'm not worried about the performance of Java compared to other languages - I'm worried about hitting memory limits imposed by the JVM settings or Java language!)

    Hi ChuckBing,
    Thanks for your reply - it's given me some valuable information. In light of your post I think I'm going to try a very simple test code which does some simple operations with representative big arrays and see if I can get that working well on a range of machines before I spend time writing the real thing. I hadn't appreciated the need for contiguous memory in the Java heap.
    As for comparing JNLP and applet memory control, after another intensive bout of google searching, I found more information about controlling heap size for applets at:
    https://jdk6.dev.java.net/plugin2/jnlp/
    From my (novice) reading of this page, it seems that from 1.6 you can now control the heap available to an applet in a similar manner to JNLP. I've added this link in case other people stumble across this post with a similar questions about applet memory limits.
    Thanks again,
    andy_g

  • Referencing a "locally installed" Java applet from a server-based HTML page

    How does one reference a "locally installed" Java applet from a server-based HTML page (i.e. via the applet, object, or embed tags)? I have seen references in documentation that this is possible, but I have not seen any examples. I have tried a few things, but nothing seems to be working.
    Some background...
    I'm working on a web site that aggregates Internet video. For many users, I would like the site to work "without" requiring Java to be installed (or any prompts, etc.). This version of the site allows users to stream videos directly over the Internet and does not require any sort of access to the local system.
    However, in addition, I have a download manager that can be installed on the local system. Currently, it's a Windows-based "service" that is always running in the background, downloading files, etc. (with plans to later support other OSes).
    My dilemma is trying to communicate between my web site running in the local browser (executing JavaScript code) and the download manager. I call this component the "gateway". I need the gateway to be able to do the following:
    1) Pass user credentials from the web browser UI to the download manager (so it can communicate with my servers).
    2) Check the status of downloaded videos
    3) Launch a local media player (such as Windows Media, QuickTime, etc.) (or perhaps tell the download manager to launch the media player).
    Under Windows XP, I have an ActiveX control that can do these things. It communicates with the download manager via reading/writing to a shared XML configuration file.
    Unfortunately, under Vista and IE7 Protected Mode, ActiveX controls have become very restricted and my gateway no longer works. As such, I am looking at using Java for the gateway (also giving me the additional benefits of supporting additional browsers and OSes).
    From my understanding, I believe I can created a "face-less" Java applet, whose methods can be called from JavaScript. Ideally, I'm thinking I could install the applet onto the local system at the same time the download manager is installed. This would give the applet the security permissions it needs to communicate with the download manager.
    Thanks for any help and suggestions!

    Hi,
    Put the .jar file and the .class file in the path mentioned in one of the aliases in the plsql.conf file like /images or create
    a seperate directory and create an alias like /applets "path" in the plsql.conf file.
    <html>
    <body>
    <applet code=com.chartapplet.chart.BarChartApplet
    codebase=/applets/
    archive=/applets/chart.jar width=300 height=200>
    <param name=background value="white">
    </body>
    </html>
    Hope this helps.
    Thanks,
    Sharmila

  • ClassNotFound error while running applet from Web application

    hi everyone,
    I have a web application deployed in Tomcat web server. I have HTML file at the level of WEB-INF. And all class files under WEB-INF/classes. But while ruuning the application it giving following error.
    load: class com.app.AppletTest not found.
    java.lang.ClassNotFoundException: com.app.AppletTest
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 10 more
    Here the HTML file applettest.html
    <html>
         <head>
              <title>Multiple Image Upload</title>
         </head>
         <body>
              <applet code="com.app.AppletTest" width="300" height="300">
              </applet>
         </body>
    </html>
    And Java applet file is
    package com.app;
    import java.applet.Applet;
    import java.awt.Color;
    import java.awt.Graphics;
    public class AppletTest extends Applet
         public void init()
              System.out.println("Init called");
              this.setBackground(new Color(180,200,250));
         public void start()
              System.out.println("Start called");
         public void paint(Graphics g)
              g.drawString("welcome Hello World",50,50);
              System.out.println("Paint called");
         public void stop()
              System.out.println("Stop called");
         public void destroy()
              System.out.println("Destroy called");
    Thanks.

    Hi,
    if u put ur com.app.AppletTest file @ WEB-INF Directry, then this problem will solve easily.
    you have to put applet package(com.app.AppletTest) @ WEB-INF Directry. Since
    Applet is using by html, u have to keep applet with html file.
    if applet class have interaction with other classes, u have to seperate all related class to applet to seperate package and put them @ WEB-INF folder.

  • Uploading Multiple Files from web client to web server

    Am using a Digitally signed applet to pickup files from a specific directory and only to pickup those of a specific type. Applet is called by a HTML converted page and uses the JAVA 1.3.1 plug-in. Client side is ok, but the server side does not work - cannot see how to drop the files down onto the web server.
    code
    URL url = null ;
    FileInputStream filReader = null ;
    DataOutputStream dosOutfile = null ;
    HttpURLConnection httpUrlConn = null ;
    int bytes = 0 ;
    //read local file on client's hd with signed applet
    try
    filReader = new FileInputStream( new File( fromFile ) );
    catch ( java.io.FileNotFoundException eNotFound )
    DisplayStatus ( fromFile + " Not found");
    eNotFound.printStackTrace();
    // start setup to server-side copy of in file
    try
    url = new URL ( toFile ) ;
    catch ( java.net.MalformedURLException eMalFormedUrl )
    DisplayStatus ( url + " url mal formed");
    eMalFormedUrl.printStackTrace();
    // create a HttpUrl connection for POSTING
    try
    httpUrlConn = (HttpURLConnection) url.openConnection(); // do not remove this casting, as needed
    catch ( java.io.IOException eIoException )
    DisplayStatus ( url + " IO not possible");
    eIoException.printStackTrace();
    // set preferences
    httpUrlConn.setDoInput(true); // default value, but best make sure
    httpUrlConn.setDoOutput(true); // default value, but best make sure
    httpUrlConn.setUseCaches(false); // enable write straight through
    try
    httpUrlConn.setRequestMethod("POST") ;
    // httpUrlConn.setRequestMethod("PUT") ;
    } catch ( java.net.ProtocolException eProtEx )
    DisplayStatus ( "Protocol Exception on setting up POST") ;
    eProtEx.printStackTrace();
    httpUrlConn.setRequestProperty("Content-Type", "multipart/form-data");
    // permissions?
    try
    java.security.Permission permission = httpUrlConn.getPermission() ;
    if ( iDebug == true )
    DisplayStatus ("Permission = " + permission.toString() ) ;
    DisplayStatus ( "Actions = " + permission.getActions() ) ;
    DisplayStatus ( "Name = " + permission.getName() ) ;
    catch ( java.io.IOException eUrlIOConnException )
    DisplayStatus ( "httpUrl " + httpUrlConn + " IO not possible");
    DisplayStatus ( eUrlIOConnException.toString() ) ;
    eUrlIOConnException.printStackTrace();
    // connect
    try
    this.VerifyHttpResponseCode ( httpUrlConn.getResponseCode() ) ;
    DisplayStatus ("About to connect") ;
    httpUrlConn.connect() ;
    DisplayStatus ("Connected") ;
    if ( iDebug == true )
    DisplayStatus ("Connected Content Encoding = " + httpUrlConn.getContentEncoding() ) ;
    DisplayStatus ("Connected Content Length = " + httpUrlConn.getContentLength() ) ;
    DisplayStatus ("Connected Content Type = " + httpUrlConn.getContentType() ) ;
    DisplayStatus ("Connected default allow user interaction = " + httpUrlConn.getDefaultAllowUserInteraction() ) ;
    DisplayStatus ("Connected File Map = " + httpUrlConn.getFileNameMap() ) ;
    DisplayStatus ("Connected request method = " + httpUrlConn.getRequestMethod() ) ;
    DisplayStatus ("Connected response code = " + httpUrlConn.getResponseCode() ) ;
    DisplayStatus ("Connected response message = " + httpUrlConn.getResponseMessage() ) ;
    DisplayStatus ("Connected = " + httpUrlConn.getURL() ) ;
    } // end of debug print out status
    catch ( java.net.ConnectException eConnEx )
    this.DisplayStatus ( "Connection error - no server listening or incorrect port " ) ;
    this.DisplayStatus ( "Connection error - http = " + httpUrlConn) ;
    eConnEx.printStackTrace();
    catch ( java.io.IOException eUrlConnException )
    DisplayStatus ( "url " + url + " connection not possible");
    DisplayStatus ( eUrlConnException.toString() ) ;
    eUrlConnException.printStackTrace();
    // create file on server
    try
    dosOutfile = new DataOutputStream ( new BufferedOutputStream( httpUrlConn.getOutputStream () ) ) ;
    catch ( java.io.IOException eNewFileIO )
    DisplayStatus ("Unable to create file on server / buffer output stream " + toFile ) ;
    // copy files char by char for the moment, till testing complete
    try
    bytes = filReader.read();
    while(bytes != -1)
    dosOutfile.writeByte(bytes);
    bytes = filReader.read();
    // close both files
    dosOutfile.flush ();
    dosOutfile.close ();
    filReader.close();
    catch (java.io.IOException eCpyIo )
    DisplayStatus ("Error copying files") ;
    connection of the HttpURLConnection
    gives 'Fobbiden' response for 'PUT'
    and
    'method not allowed' for 'POST'
    trying to create the file on the server than causes IOException at the create DataStream line
    What am I doing wrong?
    Is this philosphy correct?
    Should the HttpURLConnection be to the target folder
    and then create the file in it?

    hello,
    first here is my interpretation of your prob.
    You have a client.From this client you are trying to upload files onto a server.
    Finding the files and reading them on the client side is not a prob. The prob is storing them on the server side.
    right?
    If the above stated prob is right, here is a solution.
    1. You have to first inform the server that you are sending the file. Unless you do so the server will not understand when you have started sending the file.
    So, initially, the applet which you have written need to communicate with a servlet on the server side.
    This can be done using reqs.. .get or post.In the req itself you can even send the name of the folder wherein you want to store the file you are going to transfer later on.
    Next, after receiving the folder name, the servlet can now understand that next file data is going to be received.
    The applet now sends the file which is received by the servlet and stored appropriately.
    You need to explicitly write a servlet to receive a data into the file and then store the file into appropriate folder.
    for any further probs email me at [email protected]

  • Unable to connect servlet on web server

    Hi all,
    I have wrote the following program to connect to the servlet to the web server:
    public class HTTPTest
         public HTTPTest() {
    public static void main(String[] args) {
         HTTPTest httptest = new HTTPTest();
              httptest.sendHTTP();
    public void sendHTTP() {          
              try
                   URL url = new URL("http://myserver/myServlet");
                   HttpURLConnection conn = (HttpURLConnection)url.openConnection();
                   conn.setDoOutput(true);
                   conn.setRequestMethod("POST");
                   conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
                   PrintWriter dos = new PrintWriter (conn.getOutputStream ());
                   dos.println("content=" + URLEncoder.encode("ABC"));
                   dos.println("signature=" + URLEncoder.encode("CDE"));
                   dos.flush();
                   dos.close();
                   conn.disconnect();
              catch(Exception e)
    My servlet does contains some code that write log to the web server log. However, when I examine the log after running this program, nothing was written. But when I access my servlet using an HTML page, it works!
    I am using iPlanet 4.0 SP4, JDK 1.3. Can anyone tell me why? thanks very much!
    Walter

    Thanks very much! It works.
    However, another problem comes. For the two fields that I "POST"ed, it seems that one can reach the servlet but one cannot. When I retrieve the values from the servlet using "req.getParameter("XXX")", one of them got null. But obviously my applet does not send null values.
    Any other thing is needed? Thanks!

  • Java mysql OK with Terminal but not OK with Apache local web server

    With terminal I have :
    CLASSPATH=/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Classes/:/Library/Java/Extensions/:./
    SUDO_GID=20
    SECURITYSESSIONID=210800
    _=/usr/bin/printenv
    127:/Library/WebServer/Documents/Java root# java TestMySQL
    2006-05-21 13:39:00.0 ************************************************** = OK
    127:/Library/WebServer/Documents/Java root#
    import java.sql.*;
    * mysql-connector-java-3.1.12-bin.jar
    *   % javac /Library/WebServer/Documents/Java/TestMySQL.java
    *   % java TestMySQL
    public class TestMySQL {
            public static void main(String argv[]) throws Exception {
                    // Load the driver class
                    Class.forName("org.gjt.mm.mysql.Driver");
    1                //Class theClass = null;
    2               //try {
    3                //    theClass = Thread.currentThread().getContextClassLoader().loadClass("org.gjt.mm.mysql.Driver");
    4                //}
    5                //catch (ClassNotFoundException e) {
    6                //    theClass = getClass().getClassLoader().loadClass("org.gjt.mm.mysql.Driver");
    7                //}
                    Connection conn = DriverManager.getConnection(
                            "jdbc:mysql:///test",
                    Statement stmt = conn.createStatement();
                    ResultSet rset = stmt.executeQuery("SELECT now();");
                    while (rset.next()) {
                            System.out.println(rset.getString(1));
                    // Close result set, statement and DB connection
                    rset.close();
                    stmt.close();
                    conn.close();
    }I have a simple TestMySQL.html file with applet TestMySQL.class in it.
    Nothing but "Applet TestMySQL not inited"
    When I uncomment the try/catch lines (lines 1 to 7) , java compiler generate an error... near getClass().getClassLoader().loadClass("org.gjt.mm.mysql.Driver");
    With "Class.forName("org.gjt.mm.mysql.Driver");" no problem.
    Running MacOS X 10.3.9, Apache/1.3.33 (Darwin) PHP/4.4.1 mod_ssl/2.8.24 OpenSSL/0.9.7i and JVM 1.4.2_09
    Thanks for help.
    P.S. This my first approach to java/mysql but I would like to see this short program running on my local web server ...
    Thanks.

    hi :-)
    can you post the stack trace?
    im not sure what is causing the error because of less info,
    but have you tried to copy the driver of mysql to tomcat lib folder?
    regards,

Maybe you are looking for

  • TS4445: iCloud: iCloud Control Panel 2.0 for Windows requires repair after installation on Windows Vista 64-bit

    I have just installed iCloud control panel 2.1, but this has not resolved the Outlook issue. HP Win7 Outlook 2010. Does Apple or any user have a suggestion?

  • PO reminder form

    Hi all, I am sending a PO reminder form through fax. but if there occurs an error i need to send a mail to buyer and analyst. i picked up the Buyer email ID from table T024 but can you please tell me which table stores the Analyst email ID. Thanking

  • Req for UDF

    Hi All, In Mapping I have to check for a field, ie if the field has value i need to pass it to target or else need to throw error. mapping is  X (1) --->  Y (0..1) , X is coming from CSV file , if i give blank in the file its processign , but it shou

  • Bubbles in black border

    Hello I have a brand new 2013 late model Macbook Pro 13 retina. I have noticed there small bubbles underneat the black border of the monitor. At first I thought these were scratches but the more I looked the more I could plainly see it was a bubble.

  • Cannot Log In After Update to 10.6.6

    Title says it all. After the update to 10.6.6, I now get a log in box which reverts back to the log in box after I choose my user id and type in the password. There are only two users on the laptop - a guest account and my account. Any ideas? Thanks