Re: J# app and J# Browser Control behave differently

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jerry (Jerry_at_discussions.microsoft.com)
Date: 07/16/04

  • Next message: Robert Kent: "Re: Replacing Applet with J#/other .net technology"
    Date: Fri, 16 Jul 2004 10:09:02 -0700
    
    

    Thomas,

    I am using version 1.1. I retested the code and I am still having the problem. I capture the network trace this time.

    When run as a browser control the http request is formatted as follows:
    GET /test.asp?te/st HTTP/1.1
    Connection: Keep-Alive
    Host: localhost:8080

    When run as a stand alone app the http request is formatted as follows:
    GET /test.asp?te\st HTTP/1.1
    Accept: */*
    User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)
    Host: localhost:8080
    Connection: Keep-Alive

    Again in both cases I used the following code:

    import java.applet.Applet;
    import java.applet.AppletContext;
    import java.awt.*;
    import java.net.URL;
    import java.net.*;
    import java.io.*;

    public class AppletTest extends Applet
    {
       private void connect()
       {
              this.add(new Label("test"));
          try
          {
             URL url = new URL("http://localhost:8080/test.asp?te\\st");
             URLConnection conn = url.openConnection();
             InputStream in = conn.getInputStream();
             in.close();
          }
          catch (Exception e)
          {
             this.add(new Label(e.getMessage()));
             e.printStackTrace();
          }
       }

       public void start()
       {
          connect();
       }
    }

    Here is the code for the stand alone app:

    package AppletTestDriver;

    /**
     * Summary description for Class1.
     */
    public class Class1
    {
            public Class1()
            {
                    //
                    // TODO: Add Constructor Logic here
                    //
            }

            /** @attribute System.STAThread() */
            public static void main(String[] args)
            {
                    AppletTest applet = new AppletTest();
                    applet.start();
            }
    }

    "Thomas Alex [MSFT]" wrote:

    > Hi Jerry,
    >
    > This is not an expected behavior. The URL sent to the server should not
    > depend on whether the code is running in the context of a browser control or
    > an application. Can you tell us which version of the J# browser control you
    > are using (the 1.1b release has recently been made available - see
    > http://msdn.microsoft.com/vjsharp/downloads/browsercontrols/) and whether
    > you are still experiencing this problem?
    >
    > thanks
    > Thomas Alex
    > Microsoft Visual J# Product Team
    >
    > This posting is provided "AS IS" with no warranties, and confers no
    > rights.
    >
    >
    > "Jerry" <anonymous@discussions.microsoft.com> wrote in message
    > news:1ceb101c45325$98b3c4b0$a501280a@phx.gbl...
    > >I have an applet that sends data to a web server via the
    > > query string of the url (HTTP GET). When the query string
    > > data contains a backslash (\) it is sent to the web server
    > > differently depending on whether the code is running as a
    > > browser control or a standalone application. If the code
    > > is running as a browser control all backslashes are
    > > replaced with a fowardslash (/). If the code is running
    > > as a standalone application the backslashes are not
    > > replaced. Any ideas as to why the code is behaving
    > > differently in the different environments?
    > >
    > > Here is the code that I am using:
    > >
    > > import java.applet.Applet;
    > > import java.applet.AppletContext;
    > > import java.awt.*;
    > > import java.net.URL;
    > > import java.net.*;
    > > import java.io.*;
    > >
    > > public class TestApplet extends Applet
    > > {
    > > private void connect()
    > > {
    > > try
    > > {
    > > URL url = new URL
    > > ("http://localhost/test/printreq.asp?te\\st");
    > > URLConnection conn = url.openConnection();
    > > InputStream in = conn.getInputStream();
    > > in.close();
    > > }
    > > catch (Exception e)
    > > {
    > > this.add(new Label(e.getMessage()));
    > > e.printStackTrace();
    > > }
    > > }
    > >
    > > public void start()
    > > {
    > > connect();
    > > }
    > > }
    > >
    > >
    >
    >
    >


  • Next message: Robert Kent: "Re: Replacing Applet with J#/other .net technology"

    Relevant Pages

    • AccessControlException when running with applet
      ... as a panel and several other classes. ... the Panel, instead of the driver. ... When I run the Applet, ... public class AppletPotter extends JApplet ...
      (comp.lang.java.programmer)
    • Establishment of connection rejected (MySQL & Applet)
      ... The following code works as an application but not as an applet on the ... establishment of connection, message from server......Host ... I'm trying to run it from the server (localhost) and from another ... public class sqlapplet extends JApplet ...
      (comp.lang.java.databases)
    • Re: problem: security using IDEs appletviewer
      ... You wrote "If you jar up your Applet, ... The applet is correctly jar'd along with the image ... public class ImageAppletBriefX extends Applet ... public void paint(Graphics display) ...
      (comp.lang.java.help)
    • Re: Sun JVM On Webbrowser control
      ... The problem is some limitation in the browser control. ... I tried updating to the latest Sun JVM ... > Do you use percentages for width and height of the applet, ... and the size of the panel. ...
      (microsoft.public.inetsdk.programming.webbrowser_ctl)
    • Flashing image in JScrollPane
      ... the image is smaller than the APPLET size, but otherwise load the image as ... I have debug code which indicates that the ... public class ScrollPaneApp extends JApplet { ... public class ImageComponent extends JComponent { ...
      (comp.lang.java.gui)