How to read a web page using https ?

Hi,
I'm trying to read a page under a HTTPS connection. I got a certificate from my server and I'm not behind a firewall.
I find everthing confusing here, and the Java Secure Socket Extension Reference Guide from Sun is not helping too much.
If anyone could post some simple sample code to from the absolute 0, read the full page it would be really, really appreciated. It must include all the steps (from setting the trustStore pointing to the certificate, to actually reading the page).
And yes, I know this is really dummy, but I'm new to the connection part of the Java API and time is really short to solve this.
Thanks in advance,
- Juan

Amacfal,
First of, thank you for your help. But I'm trying to read a page using a HTTPS connection, and the code below (very similar to mine) doesn't work. At some point you must state where you got the PFX file. Where and how, I don't know.
Regards,
- Juan
Here is some sample code:
private void getWebPage(String searchPageURL)
//Local Attributes
String readString;
URL url;
URLConnection urlConnection;
BufferedReader HTMLpage;
try
//Connecting to URL
url = new URL(searchPageURL);  //e.g.
/e.g. searchPageURL = "http://www.yahoo.com"
urlConnection = url.openConnection();
HTMLpage = new BufferedReader(new
r(new InputStreamReader(url.openStream()));
//Looping through Web Page
while((readString = HTMLpage.readLine()) !=
)) != null)
System.out.println(readString);
catch (Exception e)
e.printStackTrace();
// NEED TO MANAGE ERRORS + LOG FILE
}You will need to import the following:import java.net.*;
import java.io.*;

Similar Messages

  • How to open a web page using indesigncs3  javascript ?

    i cant able to open web pages using this CS3 js.i anyone tell me the syntex?
    thanks
    subha

    Post your question in the forum 'InDesign Scripting'.

  • How to invoke a web service using https

    Hi,
    I have a few security related questions surrounding BPEL process manager.
    1. Does the BPEL engine have the capability to invoke a web service using https (HTTP over SSL)? Does it automatically do that if partner link URI starts with https:// ?
    2. If not, what needs to be done to enable accessing a https based web service?
    3. I need to write a web service that accepts a message and updates certain information in the database. The web service will be deployed in an OC4J instance in Oracle App Server. We want to allow the web service to be accessed from BPEL only by users registered in the database. What is the recommended way to pass username and password to a webservice if service is invoked from BPEL process manager? Note that specifying username/password in bpel.xml is not an option.
    Thanks,
    Pranav

    1. Does the BPEL engine have the capability to invoke a web service using https (HTTP over SSL)? Does it automatically do that if partner link URI starts with https:// ?
    We currently don't have support for HTTP over SSl. We are working on it to include this functionality in near future.
    2. If not, what needs to be done to enable accessing a https based web service?
    I am not sure it is possible with current product offering. I will confirm it after discussing with our concerned development group. There is some work going to integrate with Oblix security mechanism [recently acquired by Oracle].
    3. I need to write a web service that accepts a message and updates certain information in the database. The web service will be deployed in an OC4J instance in Oracle App Server. We want to allow the web service to be accessed from BPEL only by users registered in the database. What is the recommended way to pass username and password to a webservice if service is invoked from BPEL process manager? Note that specifying username/password in bpel.xml is not an option.
    This will be easier to do if we can use Oblix along with BPEL PM. Could you please let us know more about your application so that we can provide you the customized solution till it's part of the product. You can send this query to [email protected] so that our product management team can give you more detailed roadmap regarding this.
    HTH.
    Thanks,
    Rakesh

  • How to open a web page using HttpConnection class in cs3

    Hi all!
    Can anyone help me how to open a webpage using HttpConnection class in cs3?
    Thanks
    Senthil

    > If any other way to access database? advice me!
    Instead of using http, you are better off writing a command line script (that
    uses bash or cmd.exe or whatever) that does this and then call that script using
    app.system.
    The code is much simpler and far easier to test and debug.
    -X

  • How to read a web page as an ascii file

    I need to open an url and read the contents, as it
    were a simple local ascii file. This give me just
    garbage, as [B@fd2e84b (that change every time,
    seems to be a memory address, not the contents..).
    <pre>
    import java.io.*;
    import java.net.*;
    try {
    URL j_urlobj = new URL("http://www.google.com";);
    URLConnection j_urlcon = j_urlobj.openConnection();
    BufferedInputStream j_bis =
       (BufferedInputStream)j_urlcon.getInputStream();
    byte[] j_data = new byte[4096];
    int j_size;
    j_size = j_bis.read(j_data, 0, 4096);
    while (j_size != -1) {
    out.print(j_data);
    j_size = j_bis.read(j_data, 0, 4096);
    j_bis.close();
    } catch (Exception e) { out.print(e.toString()); }
    </pre>
    What is wrong?? Thank you!
    Stefano

    I try your code and it's work right with a little change....
    The problem is that you read bytes, so if you want something readable try to convert to a String.
    String s = new String(j_data)
    out.println(s);
    Here, the complete code:
    try {
    URL j_urlobj = new URL("http://www.google.com");
    URLConnection j_urlcon = j_urlobj.openConnection();
    BufferedInputStream j_bis =
    new BufferedInputStream(j_urlcon.getInputStream());
    byte[] j_data = new byte[4096];
    int j_size;
    j_size = j_bis.read(j_data, 0, 4096);
    while (j_size != -1) {
    out.print(new String(j_data));
    j_size = j_bis.read(j_data, 0, 4096);
    j_bis.close();
    } catch (Exception e) { out.print(e.toString()); }

  • How to read the Image Data using HTTp Request response

    i want to read image data from server please send me any code or answers.
    and also i want to exit application using button control for iphone simulator.
    thanks in advance.

    You would do a URLRequest and download the image. You could save it to disk and then load it or directly create a new image with the binary data.

  • How to show modal window without popup in a web page using javascript

    Hi,
    How to show modal window without popup in a web page using javascript, means when the modalwindow is opened it should not ask for popup blocker alert......
    pls help me.....

    Thanx for ur reply,
    Actually the senario is when i click on a button, another jsp page should be displayed in a modal window without popup, but the functions alert() and confirm() will not accept the url path of the another jsp page...

  • How can I add a podcast episode to an existing web page using iWeb?

    How can I add an episode to an existing web page using iWeb?
    I could probably figure this out but I am afraid if I make changes to the site and re-upload it to the podcast area I will have just doubled it. I see them repeated from time to time.
    What is the proper protocal? Thanks
    Mac G4   Mac OS X (10.4.3)  

    Hi apple-owner,
    Method 1.
    To create this scatter-plot, I selected the whole of Columns A and B. (Shift click on the Column reference tabs).
    The plot ignores blank rows, but they are "ready" for new data:
    Method 2
    If you did not select whole columns, you can extend the "active" rows. Rows 1-5 selected:
    Add more data rows and drag the fill handle (small white circle, bottom right) down
    Regards,
    Ian.

  • Using Java 5, how to develop customizable web-pages  like iGoogle ?

    Is it possible to develop customizable web-pages like iGoogle does, using Java 5 ( simply using JSPs, servlets, JSFs, AJAX etc. and without using portals) ?
    A simple example explaining how to provide 3-4 header graphics options ( like igoogle does) will be helpful. (iGoogle seems to create a cookie, which appears to be used to render the selected header-graphics).
    TIA
    Edited by: DevelopingJava2005 on Jul 7, 2008 9:36 AM

    Without using portals?
    Google uses RSS feeds to compile their mashups on iGoogle. The positioning of those boxes are managed with AJAX and upon placement are saved into a session so they stay there for each visit after.
    Please be a little more clear as to what you are looking for. Yes, it is possible to develop web pages using the technologies you specified to simulate something like iGoogle, so give us some more details on what exactly you're looking for.
    Code wouldn't hurt either.

  • How to embed 3D models in web page using JAVA?

    Hello
    I'm doing a project at University to create a virtual tour of a village. I am creating the buildings in MAYA using polygon planes and cubes and then exporting to VRML.
    I plan to embed each individual model into a separate web page. Then when the user clicks on a location in a 2D map they will be taken to the web page containing that building.
    However, I can't work out how to embed these 3D models into web pages using JAVA. Can anyone help me with this, please?
    Also, I've been told to use JAVA 3D to interact with the project but am unclear as to how JAVA 3D would be used in this project - aqny ideas/suggestions welcome!
    M.

    If you use Java-plugin, you can embed Java3D in a web page.
    Here is the URL(http://www.geovista.psu.edu/products/demos/LorenzAttractor3D/index.html) which used Java3D.
    I hope this helps.
    Masa

  • How to import html5 animation (created/published using flash) into a web page using Dreamweaver.

    I have created an animation in Flash and published it as a html5 animation.
    How do I get this into an exisitng web page using Dreamweaver?

    Hi Nancy,
    I am using Flash CC2014 which publishing as html.
    (When I publish as html with edge animate you can create an oam file which allow the inserting of the resulktant animation into a web page)
    The files produced with Flash CC 2014 are: html try.html and html.try
    I was hoping I could use some way to just insert the html animation produced by Flash.
    Source Code in html file is ....
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>html try</title>
    <script src="http://code.createjs.com/easeljs-0.7.1.min.js"></script>
    <script src="http://code.createjs.com/tweenjs-0.5.1.min.js"></script>
    <script src="http://code.createjs.com/movieclip-0.7.1.min.js"></script>
    <script src="html try.js"></script>
    <script>
    var canvas, stage, exportRoot;
    function init() {
      canvas = document.getElementById("canvas");
      exportRoot = new lib.htmltry();
      stage = new createjs.Stage(canvas);
      stage.addChild(exportRoot);
      stage.update();
      stage.enableMouseOver();
      createjs.Ticker.setFPS(lib.properties.fps);
      createjs.Ticker.addEventListener("tick", stage);
    </script>
    </head>
    <body onload="init();" style="background-color:#D4D4D4">
      <canvas id="canvas" width="550" height="400" style="background-color:#99CCFF"></canvas>
    </body>
    </html>
    Tony

  • Silent print a PDF from a web page using Flex. We are targeting Windows and Mac with Arcobat reader installed

    We are planning to Silent print a PDF from a web page using Flex. We are targeting Windows and Mac with Arcobat reader installed. I have tried using the AIR appliaction and it worked, But our requirement is NO INSTALL to the user machine for the silent printing. It is just from web page and silent printing to the default printer to the desktop/Laptop. Can anyone share your thoughts and experience with us. It will be very helpful..
    For AIR : I tried the thread Re: AIR and PDF showing/silent printing

    Hey CodeMonkey & Ross,
    Did you either of you ever find a solution? I'm stuck too, it seems I can get remote printing on all these PDFs to work but it just prints a blank page since I've been using Javascript in the browser, not Adobe's (they are Engineering drawings that I do not have permission to edit so I can't just insert code into them but I need to make work instructions). I've been scouring the internet for hours now, it seems that this thread is the only relevant/useful one at this point. No one else was trying to achieve this for similar reasons to mine.
    Thanks guys,
    Lox

  • HT4972 How can I zoom the web page only vertically or horizontally ,i.e.,wThen I want to read the web page can I enlarge the page so that the font only increases size ?

    How can I zoom the web page only vertically or horizontally ,i.e.,wThen I want to read the web page can I enlarge the page so that the font only increases size ?

    You can't.  (Fonts increase in size like everything else, not in height alone).

  • Need help to access a web page using midlet to retrieve some informations

    Hi everyone i'm trying to access a web page using midlet to retrieve some informations in text format, the web page is [http://daviddurand.info/D228/?villes|http://daviddurand.info/D228/?villes] for my project.
    the problem is that i always get error 10049 in socket::open meaning no adresse could be found i tried IP adresse and still the same.
    i managed to recreate the same web page to test it on local and the surprise that it works fine but when accessing it online i have this error.
    i tried also to get the page i created on a webserver i own to try it saying that there might be security issues but the same error appears again. so help plz
    here is my code :
    package mobileapplication5;
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class GetMidlet extends MIDlet {
    private Display display;
    String url = "http://dayaati.com/villes/index.php?villes";
    public GetMidlet() {
    display = Display.getDisplay(this);
    public void startApp() {
    try {
    getBirthdayFromNameUsingGet(url);
    } catch (IOException e) {
    System.out.println("IOException " + e);
    e.printStackTrace();
    public void pauseApp() {   }
    public void destroyApp(boolean unconditional) {  }
    public void getBirthdayFromNameUsingGet(String url) throws IOException {
              HttpConnection httpConn = null;
              InputStream is = null;
              OutputStream os = null;
              try {
    httpConn = (HttpConnection)Connector.open(url);
    httpConn.setRequestProperty("User-Agent", "Profile/MIDP-2.1 Configuration/CLDC-1.1");
    httpConn.setRequestProperty("Content-Language", "en-US" );
    httpConn.setRequestProperty("Content-Type", "text/html; charset=iso-8859-1");
    httpConn.setRequestProperty( "Connection", "keep-alive" );
    httpConn.setRequestProperty("Content-Length","51200");
              getConnectionInformation(httpConn);
              int respCode = httpConn.getResponseCode();
              if (respCode == httpConn.HTTP_OK) {
                   StringBuffer sb = new StringBuffer();
                   os = httpConn.openOutputStream();
                   is = httpConn.openDataInputStream();
                   int chr;
                   while ((chr = is.read()) != -1)
                   sb.append((char) chr);
                   // Web Server just returns the birthday in mm/dd/yy format.
                   System.out.println(sb.toString());
              else {
                   System.out.println("Error in opening HTTP Connection. Error#" + respCode);
              } finally {
                   if(is!= null)
                   is.close();
                   if(os != null)
                        os.close();
              if(httpConn != null)
                        httpConn.close();
    void getConnectionInformation(HttpConnection hc) {
    System.out.println("Request Method for this connection is " + hc.getRequestMethod());
    System.out.println("URL in this connection is " + hc.getURL());
    System.out.println("Protocol for this connection is " + hc.getProtocol());
    System.out.println("This object is connected to " + hc.getHost() + " host");
    System.out.println("HTTP Port in use is " + hc.getPort());
    System.out.println("Query parameter in this request are " + hc.getQuery());
    **Heeeeeeelp Please**

    [http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/crashes.html]
    SIGSEGV (0xb)Most common cause of that is JNI code used directly or indirectly through a 3rd party library.
    64-Bit Server VM (11.2-b01 mixed mode linux-amd64)Conversely that VM gets less traffic than others so you might have hit a bug in it.

  • Issue Loading Specific Web Pages Using the Airport Extreme Base Station

    I see that several other members have had this same issue - has anyone resolved their problem? Here is my issue:
    It all started when my wife tried to load her favorite Web page at http://hpana.com - the site now takes well over 5 minutes to load. This started some time after updating the recent security update 2007-009 Version 1.0 and shortly thereafter version 1.1. I have tried using the other Mac computers in the house, using the same wireless network and the same problem presents itself. I have tried loading the page using friend’s computers (Mac and PC, from out side my home) and the page loads within seconds. I have tried using Safari, IE and Firefox (at home), the problem remains. I contacted the hpana.com Webmaster and they have made no changes to their web site.
    I disconnected our cable modem, and connected the modem directly to the iMac (by passing the Apple Airport) and the page loads within seconds. I’m guessing it has something to do with the Airport Extreme.
    So, I contacted Apple Support. The issue was quickly elevated and eventually forwarded to the Airport Extreme Hardware guys – I expect to get an answer by Mid January 2008.
    I took a trip to the local Apple store and after explaining the situation, the store manger replaced the AirPort Extreme with the hope this would resolve the issue. After getting the “new” Airport Extreme up and running … the problem remained. This particular web site hpana.com still takes well over 5 minutes to load. I have no such issue with some of the other 60 or so sites I tried.
    I by passed the “new” Airport once again by connecting the cable modem directly to the iMac and, as before the web page loads within seconds.
    I’ll wait until I get a response from Apple come January, but I was wondering if anyone on the Forum would be willing to share their respective opinions.
    Thank You and Happy Holidays.

    Hi,
    There are some differences between the configuration of Airport equipment sold in different countries, however this is likely to not be the cause of your system's issues. ( See this document for details on that - http://docs.info.apple.com/article.html?artnum=58567 )
    Hong Kong has a very high density of population, especially compared to Australia.. I suspect your wifi signal is probably getting interference from your neighbours wifi, phones and microwaves. There's not much you can do about this, except getting an external antenna for the AEBS and trying to drown them out with it.

Maybe you are looking for

  • Can't install hp photosmart 7350 series printer on my hp laptop with windows 7 home premium

    I am trying to install the HP Photosmart 7350 printer on my HP Laptop (serial number {Removed for privacy}; serial number{Removed for privacy}). The driver was not listed so I searched for a compatible printer. I found the Deskjet 5550 was compatible

  • Dynamic attribute in XQuery

    Using XQuery I'm trying to dynamically create attributes as the result of a complex for statement. This works fine: <tag attributeName="{ for ...}" /> and I could just repeat this for every attribute. However the "for/where" statements are complex an

  • Conversion of LaTeX formatting?

    I have some text in a database that I write out in InDesign Tagged Text format for placing in an InDesign CS3 document. Normally, this text is just plain text. However, now I noticed some LaTeX formatting codes (LaTeX is a document formatting languag

  • EUL on Replication Server May Not Match Production EUL

    Hello:First let me thank you for the rapid response on the "Replication Impact on the EUL" issue. This is a follow on to that initial question. I intend to perform Discoverer administrative tasks on the replication server EUL. The tasks will involve

  • Please-Help with SQL NewBee

    Hello please help me with an sql, I have a table with 2 fields, I want to check if one of the field is blank, mining that it dosn't contain anything. if table called Test has 2 fields name ,age. how do I check in sql if age is blank. thanks