Closed Bug 62810 Opened 24 years ago Closed 10 years ago

MRJ Plugin does not allow HTTP POST - all access becomes GETs

Categories

(Plugins Graveyard :: Java (Java Embedding Plugin), defect, P3)

PowerPC
macOS
defect

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: lordpixel, Unassigned)

References

()

Details

When using MRJ Plugin (with Nav4, will test with 6 also, but this MRj Plugins is 
a special case because the same code runs in 4 as in 6) to run Java applets, HTTP 
requests which ought to be POSTS are infact sent as GETs which doesn't work.

This would be related to the URLConnection object in Java and the integration of 
Mozilla's networking stack with MRJ.

See also:
news://news.mozilla.org/3A378473.DA75062%40impress.com
qa:junruh
QA Contact: shrir → junruh
Probably depends on MRJ - Mozilla network stack integration 
Depends on: 57491
Marking NEW so someone will look at it and to get it off our unconfirmed radar.
Status: UNCONFIRMED → NEW
Ever confirmed: true
I am willing to QA any MRJ Plugin updates that may fix this problem.  This is a 
showstopper for us - it prevents us from supporting our product under Netscape 
on the Macintosh.
Terry or Beard, can we please have some status on this?
I feel I must reiterate our serious concern with this lack of functionality. Our 
product, which is actually a toolkit used by many applications in the 
Applications 11i suite, relies heavily on the basic ability to post a URL 
from Java with arguments and retrieve its return data. Without this ability, our 
toolkit, and therefore a host of Oracle applications, cannot be supported.

Surely, there may be some work to support this feature, but it is an essential 
means of allowing communication between client and server.

Please consider addressing this problem in the very near future.  Thanks for 
your advance attention to this issue.
Patrick,

I would need some detailed pointers to help with bug #62810 / bug #57491 / bug
#73077.  (Working on Nikolay's plug-in right now)
*** Bug 67751 has been marked as a duplicate of this bug. ***
This will probably never work completely under the 4.X browser. It needs to be 
addressed for Mozilla and NS6.
Target Milestone: --- → mozilla1.0
I have a simple demonstration of this problem at http://segal.org/p/plugin.html 
complete with a working applet and full source code.  The applet fails to POST 
using Netscape 4.75 using the MRJPlugin, but does not hang the browser.  In 
contrast, using Internet Explorer 5.0 the applet POSTs once then hangs the 
browser.  Using Netscape 6 and the latest MRJPlugin from  
http://homepage.mac.com/mrjplugin/ everything works fine but I have not tested 
the MRJPlugin that ships with Netscape 6.01.  
    You can reproduce the problem as follows:
1.  Type some String into the TextField in the applet to identify your test.
2.  Press the button to POST.  It will do nothing.  Although there are println 
methods to follow the progress of the applet I don't see any output in the 
regular Netscape Java Console or in the Java Message Log file for this or other 
applets, presumably due to some other issue with the MRJPlugin (if there is 
some way to get Java Console output from Netscape 4.x / MRJ I'd appreciate 
hearing about it).

Here is the source code for the applet:

import java.applet.*;
import java.awt.*;
import java.net.*;
import java.io.*;

public class PostNoThread extends Applet {

Button postButton;
TextField tf;

public void init()
{
    tf = new TextField(10);
    add(tf);
    postButton = new Button ("Type a String and then press this button");
    add (postButton);
    URLPoster.refreshStatics();
}

public boolean action(Event evt, Object obj) 
{ 
    if (evt.target == postButton)
    {
        try
        {
            URLPoster.numberStarted++;
            new URLPoster(URLPoster.numberStarted, "TestExported", "test.txt", 
                tf.getText() + ": data from run " + String.valueOf
(URLPoster.numberStarted));
            System.out.println(URLPoster.numberStarted + " POST is done"); 
        }
        catch (Exception e)
        {
            System.out.println("send failed");
            return true;
        }
    }
    return true;
}
} // END OF Class PostNoThread



class URLPoster {

URL urlCGI;
String query, file, ext;
int numberOfThis;
static int numberStarted;

URLPoster(int numberOfThis, String folder, String fileWithExt, String data)
{
    this.numberOfThis = numberOfThis;
    urlCGI = null;
    try
    {
        urlCGI = new URL("http://segal.org/cgi-bin/form2mail");
    }
    catch (Exception e)
    {
        urlCGI = null;
        System.out.println("url could not be formed" + e);
    }
    int dotPosition = fileWithExt.indexOf('.');
    file = fileWithExt.substring(0, dotPosition);
    ext = fileWithExt.substring(dotPosition + 1);
    query = URLEncoder.encode("config") + "=" + URLEncoder.encode("/templates/" 
+ folder + 
    "Append.txt");
    addToQuery("file", file);
    addToQuery("ext", ext);
    addToQuery("data", data);
    System.out.println(numberOfThis + " POST starting");
    post();
}

static final void refreshStatics()
{
    numberStarted = 0;
}

final void addToQuery (String name, String value)
{
    query += ("&" + URLEncoder.encode(name) + "=" + URLEncoder.encode(value));
}

final void post()
{
    try
    {
    URLConnection uc = urlCGI.openConnection();
    System.out.println(numberOfThis + " uc = " + uc);
    uc.setUseCaches(false);
    System.out.println(numberOfThis + " point A");
    uc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    System.out.println(numberOfThis + " point B");
    // setRequestProperty needed since some Netscape versions don't give this 
out properly
    uc.setAllowUserInteraction(false);
    System.out.println(numberOfThis + " point C");
    uc.setDoInput(true);
    System.out.println(numberOfThis + " point D");
    uc.setDoOutput(true); // after setRequestProperty which can reset doOutput 
to false
    System.out.println(numberOfThis + " point E");
    DataOutputStream udos = new DataOutputStream(uc.getOutputStream ());
    System.out.println(numberOfThis + " point F");
    udos.writeBytes(query);
    System.out.println(numberOfThis + " point G");
    udos.flush(); // sends
    System.out.println(numberOfThis + " point H");
    udos.close(); // cgi program won't return response until this is closed
    System.out.println(numberOfThis + " point I");
    DataInputStream udis = new DataInputStream(uc.getInputStream ());
    System.out.println(numberOfThis + " point J");
    // NN won't post data unless inputStream is opened, but reading input is 
not necessary 
    udis.close(); // always close after opening
    System.out.println(numberOfThis + " point K");
    }
    catch (Exception e)
    {
    System.out.println("Error in posting");
    }
}
} // END OF Class URLPoster   

Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 
(you can query for this string to delete spam or retrieve the list of bugs I've 
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
QA Contact: junruh → pmac
*** Bug 160418 has been marked as a duplicate of this bug. ***
Additional test case link from dupe:
 http://archive.coreservlets.com/Chapter17.html
QA Contact: pmac → petersen
This bug is targeted at a Mac classic platform/OS, which is no longer supported
by mozilla.org. Please re-target it to another platform/OS if this bug applies
there as well or resolve this bug.

I will resolve this bug as WONTFIX in four weeks if no action has been taken.
To filter this and similar messages out, please filter for "mac_cla_reorg".
retargeting
Target Milestone: mozilla1.0.1 → Future
OS: Mac System 8.5 → MacOS X
-> default assignee for old netscape assigned bugs.
Assignee: beard → yuanyi21
QA Contact: chrispetersen → zhayupeng
Target Milestone: Future → ---
Is this still a problem with the JEP's MRJPlugin?  The testcase in comment 13 won't load, and I don't know what to do with the code in comment 10 to test it (the live version is also gone).
Assignee: yuanyi21 → smichaud
Component: Java: OJI → Java Embedding Plugin
QA Contact: zhayupeng → java.jep
Component: Java Embedding Plugin → Java (Java Embedding Plugin)
Product: Core → Plugins
Version: Trunk → unspecified
The MRJPlugin and the JEP are long dead.
Assignee: smichaud → nobody
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INCOMPLETE
Product: Plugins → Plugins Graveyard
You need to log in before you can comment on or make changes to this bug.