How do I open a url from an applet?

is it done the same way with HTTPUrlConnection as with an application or is it done in a different way? I'm getting a "ClassCastException"

Now I'm trying to call a CGI script and past things in through the post method... I still get a ClassCastException. This exact same code worked in the applet, once again. here is the code I am using:
               URL url = new URL ("http://address.pl");
               HttpURLConnection cxn = (HttpURLConnection) url.openConnection();
               cxn.setRequestMethod("POST");;
               cxn.setUseCaches(false);
               cxn.setDoOutput(true);
               cxn.setDoInput(true);
               ByteArrayOutputStream bytes = new ByteArrayOutputStream(400);
               PrintWriter writer = new PrintWriter (bytes,true);
               writer.print("hello=world&food=good");
               writer.flush();
               cxn.setRequestProperty("Content-Length",String.valueOf(bytes.size()));
               cxn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
               bytes.writeTo(cxn.getOutputStream());

Similar Messages

  • How can I open a URL from a Custom Button in a second help window?

    I have a custom button, which currently opens a URL in a web
    browser, using a redirect page. How can I change this so that it
    opens in a second help window instead? If I understand some of the
    posts I've read, it is possible by linking the button to a related
    topics function but I've no idea how this is done.
    As usual, your help is most appreciated. Thanks a lot.

    Hi, ecoulyn,
    You need to make a topic file like the one below the target
    of the Jump button.
    The onLoad function on the Body start-tag causes the Related
    Topics command to fire when the topic file is loaded in the topic
    pane. When specifying the file name of the topic to display in the
    secondary window, you must always prepend it with the name of your
    .chm file, followed by "::/". Otherwise, an error message appears
    when the Jump button is clicked.
    Pete

  • How can I open a URL in an applet?

    Hi:
    All I want to do is webcrawl through the pages on a website, and extract some indexing information. Now, I have a java class that does this just fine -- for http sites. Except my site is https, and asks for username and password, which my java class cannot handle.
    So I figured one easy solution would be to simply convert my java application into an applet, and then just pass through the username/password authentication, then run the applet. The problem is, after I've converted my application into an applet, i get the following exception (I was using www.yahoo.com just to test the applet before running it on my https site):
    java.security.AccessControlException: access denied (java.net.SocketPermission www.yahoo.com resolve)
    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.checkConnect(Unknown Source)
    at sun.plugin.net.protocol.http.HttpURLConnection.checkPermission(Unknown Source)
    at sun.plugin.net.protocol.http.HttpURLConnection.connect(Unknown Source)
    at sun.plugin.net.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.URL.openStream(Unknown Source)
    at Crawler.robotSafe(OgiCrawler.java:77)
    at Crawler.start(OgiCrawler.java:224)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    What am I leaving out? I've pored through much sample code, including the code on the forums, but my code seems the same (though the code on the forums is usually for applications, not applets.) I know there are other webcrawling java applets... how do they successfully connect to a URL?
    Here is my connection code:
    HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
    System.out.println("Downloading " + url.toString());
    urlConnection.setAllowUserInteraction(false);
    InputStream urlStream = url.openStream();
    I'm very new to Java programming, so if I need to include some applet-specific package, please let me know! Thank you very much for your help!!
    Ogi

    ... So I figured one easy solution would be to simply
    convert my java application into an applet...i dont know the solution for ur problem, but you shouldnt convert ur app into an applet, cuz applet has more restrictions...

  • How can I get specific URLs from outlook to open in firefox where IE is my default browser

    I require to open specific URLs from outlook to be opened in Firefox. However, IE will be my default browser.

    Try this tutorial ;)
    http://support.mozilla.com/en-US/kb/Remembering+passwords

  • How do I get a url from quicktime?

    I'm using iWeb to host my podcast. http://web.me.com/krushjudgement/Site/Giant-SizePodcast/Giant-SizePodcast.html
    I'd like to have people visit my blogspot for updates. http://giantsizepodcast.blogspot.com/
    Right now I'm using podtrac to stream, but I realized it might be easier just to stream the quicktime versions from my iWeb. I'd like to embed the episodes in quicktime format right onto my blog posts. I've found embed codes, but I don't know how to get the proper urls from iWeb.
    Any ideas?

    Are you trying to retrieve the material?
    If so, open the page in Firefox-->Firefox Menu-->File-->Save Page As-->Save As: Web Page Complete...save to a folder. Firefox will download the html, javascript, css, images and the mp3 audio.
    It took a few minutes for the page to load and another minute or two to download... And I'm on a very fast connection. I was getting around 5-6 MBs during the download.
    The mp3 is 5 levels above the html. I have no idea what level or folder the video is at...
    Message was edited by: David M Brewer

  • How to invoke ADF application URL from OAF?

    Hi guru's,
    We have a developed a custom ADF application using Fusion Middleware 11g.
    We would like to integrate this ADF with existing EBS/OAF application.
    We were able to invoke ADF URL from EBS responsibility with a special function type "ADFx" in R12.1.3.
    Now we need to pass context/profile level parameters from EBS to external ADF application. Like logged in userId/RespId etc...
    We are running ADF application also in same EBS DB and hence want to use same fnd_user/Resp concept in ADF.
    Can anyone help me on how to pass these parameters like userId/RespId from EBS to ADF while invoking ADF application URL?
    If we can append the values to ADF URL, we would be bale to parse them in ADF context. But, i am stuck at passing parameters from EBS.
    How Can we invoke ADF URL from OAF page? is there any specific function available or is it just URL invoke?
    Also, in OAF the logged in user session information is maintained in cookies(if i am correct), is there any way that we can pass the session level values from OAF to ADF?
    Any help in this regard would be a great help!!!
    Thanks

    May be the following link will help you ->
    http://www.oracle-latest-technology.com/2010/12/how-to-dynamically-open-external-url.html

  • How can I open raw files from my Nikon D7100 in CS4 or CS5?

    How can I open raw files from my Nikon D7100 in CS4 or CS5?

    Andy,
    In the simple and short form, what happens with the ACR (Adobe Camera RAW) module is that it gets updated with regularity, to accommodate the camera mfgr's. changes for their newer models. That ACR works within the host program, such as Ps, PsElements, Lightroom, etc.. At a point, Adobe ceases to support older host program versions. When that happens, the user has a few options:
    Upgrade the host program version
    Use another host program, such as PsElements or Lightroom
    Use the free DNG converter, per Curt's suggestion. That is not host program dependent
    Glad that the DNG Converter works for you.
    Good luck,
    Hunt

  • How can I open RAW files from Nikon D7100 in Photoshop Elements 9?

    How can I open RAW files from my Nikon D7100 in Photoshop Elements 9

    Three choices:
    1. Upgrade to PSE11
    2. download the free Adobe DNG Converter and then convert your RAWs to DNG, which will open in PSE9
    3. Use manufacturer's software and convert to TIF (or JPG)

  • TS3276 How do I open an attachment from my email with macbook pro on aol?

    How do I open an attachment from my email with macbook pro on aol? It keeps flipping back?

    Wirth an iOS device you have to first go to the app that has the item you want to attach. When in that app you then select the email option for sharing.  You can't start from the Mail app.

  • How do I open raw files from a Panasonic DMC-GF5 using Elements10 on a PC?

    How do I open RAW files from a Panasonic DMC-GF5 camera using Elements 10 on my PC?  When I try to open a Raw file I get a message 'wrong type of file'

    I believe you need ACR 7.1 which PSE10 cannot be updated to. 
    Use the DNG Converter to make DNGs from the RAW files and those should open in your older PSE version.
    You can also buy a newer version of PSE.  Perhaps do a Trial (Try) of PSE12 and see if PSE13 comes out in the next week or so.
    The DNG Converter can be found on this page:  http://www.adobe.com/downloads/updates
    PSE12 Trial: http://www.adobe.com/downloads.html

  • How do I open RAW images from DSC_RX100M3?  I downloaded Adobe DNG converter 8.4, but could not convert the images?

    How do I open RAW images from DSC_RX100M3?  I downloaded Adobe DNG converter 8.4, but could not convert the images?

    Small correction to what SSprengel wrote...
    The RX100M3 is supported only by version 8.5.  It sounds like you need a newer version.
    Photoshop Help | Digital Negative (DNG)
    -Noel

  • How do I open RAW files from the Nikon D4s in photoshop?

    How do I open RAW files from the Nikon D4s in Photoshop? I have the updated newest version.

    The Nikon D4S is a brand new camera which has just been added by Adobe to Camera Raw 8.4.
    http://labs.adobe.com/technologies/cameraraw8-4/?tabID=details#tabTop
    8.4 has not yet been finally released but you can download and install a pre-release copy for CS6 and CC (it is not compatible with CS5 and earlier)
    CS6:http://labs.adobe.com/technologies/cameraraw8-4/
    CC: http://labs.adobe.com/technologies/cameraraw8-4-cc/

  • How do I change a URL from a tab?

    How do I change a URL from a tab?

    I'll tell you my situation.
    I have a page, with 4 tabs. At the beggining the page didn't have tabs and it had content like pictures and ome text. When I added a tabs, that same content is displayed in each one. So, if I erase the image of tab 'C', for example, that image erases for all the tabs too.... If I add content to tab 'C', another example, and I only wanted to displayed that info on that tab, it's displayed in all the tabs too... What's wrong?

  • How do I remove a url from "Always view this page in IE"

    How do I remove a URL from "Always view this page in IE"?

    After the new server is added to the cluster and the AG, remove the old one by first
    ALTER AVAILABILITY GROUP [YourAG]
    REMOVE REPLICA ON N'OldServer';
    Remove a Secondary Replica from an Availability Group
    Then evict the old server from the cluster with the cluster administrator or
    Remove-ClusterNode OldServer
    Remember to verify the quorum configuration after adding the new server and removing the old server.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • How can i open the popup from java class

    Hi,
    Please tell me how can i open the popup from java class.
    I am using jdev 11.1.1.7.0
    I have used the below code which works fine in jdev 2.1 but it will have some errors in 11.1.1.7.0.
    Please tell me some way to do this in all jdev versions.
    Bean obj = (Bean)RequestContext.getCurrentInstance.getExternalContext.getPageFlowScope(“obj”);
    Code for hide pop-up
    FacesContext context = FacesContext.getCurrentInstance();
    String popupId = obj.getPopUpBind().getClientId()
    ExtendedRenderKitService service = Service.getRenderKitService(FacesContext.getCurrentInstance(),
    ExtendedRenderKitService.class);
    String hidePopup = "var popupObj=AdfPage.PAGE.findComponent('" + popupId +
    "'); popupObj.hide();";
    service.addScript(FacesContext.getCurrentInstance(), hidePopup);
    Code to Show pop-up
    StringBuffer showPopup = new StringBuffer();
    showPopup.append("var hints = new Object();");
    showPopup.append("var popupObj=AdfPage.PAGE.findComponent('" +
    obj.getPopUpBind().getClientId() + "');popupObj.show(hints);");
    service.addScript(FacesContext.getCurrentInstance(), showPopup.toString());
    Code need to be added in jsff pop tag
    binding="#{pageFlowScope.bean.popUpBind}
    Variable need to be added in Bean.java
    private RichPopup popUpBind;

    Hari,
    Since you're using a non-public build of JDeveloper, you should be using a non-public forum.
    John

Maybe you are looking for

  • IPhone 4 and iPad wont sync with iTunes

    I bought a mac mini a few months ago to replace my powerbook (don't need it anymore). All of the files transfered fine but iTunes will not allow me to sync my iPhone 4 or iPad. When I try to transfer files or sync in anyway, iTunes prompts me with "T

  • I am also looking to get whether or not the document is open in a browser window which can be done with event

    I am also looking to get whether or not the document is open in a browser window which can be done with event.target.external, but I want it to happen without any user interaction and all the events that I tried while loading the document cause an er

  • How do you get the iMac to recognize the keyboard?

    Hi guys, I received a used iMac and never really used one before. I am not sure what the model is, from the pictures on wiki it could be iMac G5 or after that. I have a problem, does the keyboard (and mouse) need something to work with the iMac? Some

  • PDV - Export to Excel

    Hello All, I am having a PDV iView which displays a set of columns. In the same page (this page contains two iViews), is another iView configured to hold a Web Dynpro application. Can we in any manner pass a list of columns from the PDV iView to the

  • Nice effect, need help

    Hi, I'm trying to achieve an effect, I'm hoping someone can help me with. I want an image to fill the entire screen of a browser window & automatically resize to fill the window area no matter the size of the browser; here is the exact effect I'm loo