View source of URL

i want to view the source of a URL which contains some parameters
for example: i want to view the html source for the url
"http://forum.java.sun.com/post.jsp?forum=31"
i tried using URL u = new URL(args[0]); and datainputstream and i was able to retrive htmlcode of url without parameters eg:http://www.google.com ; but i want to get the html code for url's with parameters. how can this be done?
thanx in advance
soumya

Here's a little program I wrote when I was playing around with the URL class. It works, but the html returned is the Sun page that asks you to logon with your userid/password. I don't know how to get around that.
Hope it helps.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.HttpURLConnection;
public class URLTester
     private final static String PROTOCOL = "http://";
     public static void main(String args[])
          if ( args.length != 1 )
               System.out.println("Usage: java URLTester <url>");
               System.exit(-1);
          String urlString = args[0];
          try
               // Create URL object from the URL string
               URL url = new URL(PROTOCOL + urlString);
               System.out.println( "\nURL Info:");
               System.out.println( "\tProtocol = " + url.getProtocol() );
     System.out.println( "\tHost = " + url.getHost() );
     System.out.println( "\tFilename = " + url.getFile() );
     System.out.println( "\tPort = " + url.getPort() );
               System.out.println( "\tRef = " + url.getRef() );
               // The connection object has information that my be
               // retrieved without parsing the data returned
               HttpURLConnection conn = (HttpURLConnection)url.openConnection();
               conn.connect();
               System.out.println( "\nConnection Info:");
               System.out.println( "\tResponse Code : " + conn.getResponseCode() );
               System.out.println( "\tResponse Message : " + conn.getResponseMessage() );
               System.out.println( "\tEncoding : " + conn.getContentEncoding() );
               System.out.println( "\tLength : " + conn.getContentLength() );
               System.out.println( "\tType : " + conn.getContentType() );
               System.out.println( "\tDate : " + conn.getDate() );
               System.out.println( "\tExpires : " + conn.getExpiration() );
               System.out.println( "\tModified : " + conn.getLastModified() );
               System.out.println( "\tContent : " + conn.getContent() );
               System.out.println( "\tUseCaches : " + conn.getUseCaches() );
               // Get an input stream from the URLConnection object
               // Note: if you dont need connection information you can get an
               // input stream from the URL object ( url.openStream() )
               InputStreamReader isr = new InputStreamReader( conn.getInputStream() );
               BufferedReader in = new BufferedReader( isr );
               String line;
               System.out.println( "\nFile Info:" );
               while ( (line = in.readLine() ) != null )
                    System.out.println( line );
               in.close();
          catch(IOException e)
               System.out.println( e );

Similar Messages

  • View Source not showing up in context menu?

    Yes I did choose to allow view source during the release
    build. I also uploaded the source folder to the server. I can
    manually go to the view source folder and it is working fine, only
    thing is, the option is not in the context menu of the application.
    I suppose I can add it there myself but I thought that was
    automatic?
    Thanks!

    quote:
    Originally posted by:
    levancho
    if you are using FB3 you can you feature called : "Export
    Project" and it does everything for you, including view Source
    Feature,
    just select your project and then click on Project -->
    Export Project
    and in dialog select "View Source" and then finish.
    That is exactly what I did, I go to Export Release Build, I
    select View Source, I choose which files to show, I name what
    directory I want it to be in. I click Finish, Then I upload
    everything from the release-bin to my server. I can manually go to
    the view source URL and that works, but the option does not appear
    when I right click the .swf. But as a work around I can add the
    option to the context menu myself and use navigateToURL to send the
    user there.

  • How can I view source on an app (preferably before installing)?

    An app for Firefox OS is programmed in HTML and JavaScript. So, just like a webpage, I should be able to View Source, right? That's always been the empowering Mozilla approach, as far as I understand. View Source is great for learning by example (just like how I originally learnt HTML!), but also for open audit. Ideally I'd like the opportunity to look over the code before I agree to install.
    If I go to https://marketplace.firefox.com/app/astroalpaca using my desktop browser, or if I find it in Marketplace using my ZTE Open, I can't see a View Source option anywhere. Where is it please?
    I can understand not showing it on a small phone screen, but there's no reason why someone visiting Marketplace with a laptop/desktop web browser shouldn't download and inspect the app package.
    If it doesn't exist (I'm starting to suspect this is the case), then where's my empowerment? What makes these fxos apps any less of an impenetrable consumer black box than android apps?

    Wow OK. So for future reference, "View Source" (Ctrl+u) doesn't do it, since I guess the button comes from JS. So instead you need to:
    * Open the inspector (Ctrl+shift+c)
    * Click on the install button (to inspect it, not to install it).
    * In the panel you get to see the source code for the button which includes the URL to the .webapp file (it might be hosted separately as in the example, or on the marketplace)
    * You can copy and paste that URL and then open that file to see where the app content is delivered from, and then if you follow those paths you can view the HTML, JS etc.
    So that's really quite buried, but I'm glad that at least it's technically possible! Not quite as easy as Ctrl-U ;)

  • View Source Supressed in Yahoo

    Hi!
    I know this may be offtopic.
    But how do u supress the view source as they do it on Yahoo groups.Once logged in you only see a blank page on the view source.No blank lines inserted in this case.
    Is there a way to read the source HTML in this case?
    Regards,
    mat430.

    I know the URL, but I can't read the HTML source, please can you tell me how to do this (can you send me a code, please).
    Thanks,
    RIM.

  • How can I edit an html file in Firefox using View Source?

    I have created an html webpage and saved it to my pc. I can't edit the html file in firefox when I right click on the page and select "View Source". I can view the code but I can't edit it. I can do this in IE9.
    I thought I was able to do this before in Firefox.
    Did my settings change somewhere that I can no longer do this?
    Do I have to have something checked in the Web Developer extensions for it to work?
    I'm using Firefox 24.0
    Thank you for any help with this. :)

    The View Source window in Firefox cannot be used to change computer codes. Nor can the Web Developer tools.
    Sorry for any inconvenience.
    I suggest using Programmer's Notepad.

  • HTML code displays on one line in browser view source

    Hi,
    In Dreamweaver, my HTML code displays returns, spaces, etc. However, in the view source option in a browser (Firefox in particular), all the code is displayed on one single line. I only found about this because I was having problems with my Google Ads not displaying. (A Google customer service person helped me to find a workaround for this since I still haven't figured how to get my code to display correctly.) So I have gone to Preferences in DW and changed my Code Format Line Break type. The result is the same with each of the three options: the code is all on one line when you check it under view source in a browser. (The server is Linux.)
    Does anyone know how to fix this? Also, I think I know how this happened in the first place. I copied my code to TextEdit for a quick backup the other day, and then I pasted it back to DW. Bad idea? Is the only way to get the code back to normal to re-write it in a new HTML file in DW?

    Pssh. Problem solved, but I'm not quite sure how. I did go back and try to clean up some redundant CSS and other things, but the HTML/CSS validator still shows that I have this one invalid <header> tag (www.nextmontenegro.com), but since that was written as part of the DW template, I just left it. Weird. Anyway, the code flows down the page now.
    Thanks for the quick replies and helpful hints:-)

  • What happened to my View Source menu item?

    I'm pretty sure that I used to be able to view the coded contents of web pages in the past. I just tried to do this with a web page and my "View Source" selection item under the "View" menu is gone.
    Am I mistaken that Firefox used to have this feature? I have used Firefox, exclusively, for about the last 3 to 4 years, now; haven't used IE in quite a while.
    Maybe with my latest FF upgrade, that feature was deleted in the upgrade.

    Thanks. Glad to find more than ONE solution (I code "no right click" on most of the web pages I do). Tools / Web developer / Page Source works for me!

  • Safari 5.1.7 to 6.0.1 (Missing "view source")

    Safari 5.1.7 you can "view source".  In Safari 6.0 this appears to have disappeared.  Is it anywhere else, or has it really gone?.

    "View source" is not available in Safari 6.
    But "Show Page Source" is available.
    Safari > Preferences > Advanced
    Enable "Show Develop menu in menu bar".
    Develop menu > Show Page Source

  • How can I turn off word wrap in the View Source output?

    I'm trying to extract HTML from Word and one way to do that is to save the Word file as a .htm file and then View Source in a browser and copy that. But the words are wrapped in the View Source file. I want each paragraph to be all on one line. Is there a setting for the View Source feature that will turn off word wrap?
    Once I have that done and copied into a plain text editor, I will use Search>Replace to get rid of all the stuff Word puts there and just end up with the simple paragraph tags at the end of each paragraph, all on one line.

    You can disable wrapping and syntax highlighting in the View menu in the Edit > View Source window.

  • View source doesn't work / is broken / not working in 6.1.0.1

    View source in IE6 works on the guest users mypage when they first land on the site and on the login page, but any other community page once you login - it breaks.
    I'm having to use the 'view partial source' in my right click context menu as offered once you install 'webdevaccess.exe' (a developer plugin unsupported but offered by Microsoft - google it) to see any source. I must admit, I just ctrl-a then 'view partial source' and I get everything but the initial <html> and <head> tags pretty much - but it's a pain.
    Has anyone else seen this behavior and is there a fix?

    It appears that this is indeed a problem with certain versions of IE6 while using server-side compression for all portal pages (a new feature on ALI 6.1 that is enabled by default).
    The Release Notes actually contain two known issues related to this:
    - Some versions of IE6 on Windows 2000 have a bug where they do not render compressed pages properly. End users should upgrade to the latest version of IE6 if compression is enabled. (Issue #54230)
    - You may experience issues downloading Excel spreadsheets from Analytics reports using the Microsoft IE6 browser. (Issue #54827)
    This problem is directly related to one or more of the following bugs in IE6 SP1 resolved by the KB articles listed below. Please require users to either upgrade their browsers by installing IE6 SP2 or patching with the specific downloads listed in the KB articles.
    http://support.microsoft.com/kb/871205
    http://www.microsoft.com/downloads/details.aspx?FamilyID=0c7055c3-0bec-4042-b6aa-3443739c66ab&DisplayLang=en
    http://support.microsoft.com/?kbid=823386
    The other workaround is to specifically disable compression for Excel spreadsheets in the httpcompression.xml setting file, located in %PT_HOME%/settings/portal.
    I upgraded to MSIE 7 and did not encounter the problem. I also confirmed that the problem does not occur with IE6 when HTTP compression is disabled. This is now controlled by a new httpcompression.xml file.
    John

  • How can I view the underlying URL to a hypertext link in text from galley or story mode?

    How can I view the underlying URL to a hypertext link in text from galley or story mode?

    click inside the hyperlink and open Window > Hyperlinks (in InCopy). The link is highlighted there. If you can't see it in the editable field, double-click the highlighted entry and it'll open in a dialog box.
    AM

  • "Date picker" in report - - View source shows no label for the date picker

    Hi
    In one of my reports, I am using multiple types (textarea/text/date picker/select list)
    I wanted to use a javascript based on the label, but I do not see "<label>" for Date picker in the view source due to which my Javascript fails.
    Snippet of view Source:
    <td class="t3data" ><label for="f08_0001" class="hideMe508">CATEGORY</label><textarea name="f08" rows="4" cols="16" wrap="VIRTUAL" id="f08_0001">EMPLOYEE INDUCTION</textarea></td>
    <td class="t3data" ><span class="lov"><input type="text" name="f11" size="15" maxlength="2000" value="29-FEB-08" style="padding-right:5px;" id="f11_0001" /><script type="text/javascript">
    As you can see above, we have a "label for" for the text area but not for the date picker
    Is there a reason for the same?
    Thanks
    Nitin

    Hi,
    OK - the headers attribute should also help as these will identify the correct cells. You would need to know the html tags used within each cell for each datatype.
    Would using cloneNode help you? It's a method of creating a copy of an entire row in a single instruction
    Andy

  • I'm having problems opening various windows in Firefox. Eg. Downloads, View Source, History etc.

    For quite some time I have been having some issues with Firefox 5.0.1.
    I have been through all of the troubleshooting I can find but cannot fix the problem.
    Most of the features that require a window to be opened in Firefox do not work. Eg. Downloads, View Source, History. I cannot see the windows.

    I tried the localstore.rdf replacement from another machine running the same version of Firefox. Still didn't fix the issue.
    I noticed on the machine that I was having the issue with there was a file present called localstore-safe.rdf, this file was not present on the machine where Firefox was functioning normally. I removed localstore-safe.rdf (made a copy of the profiles folder first) and it works.

  • "View Source" problem in IE and Mozilla

    I'm parsing a HTML data source using JAVA.
    I do "View Source" of the page in both IE and Mozilla.
    #1 below is from IE and #2 is from Mozilla.
    1. <p><div class = "sub1"> <a name="..."></a>...</div></p>2. <p><div class =" sub1"> <a name="..."></a>...</div></p>Notice the spaces in the <div> tag. The spaces in IE and Mozilla are different. Could somebody please advise about this?
    Thanks in advance for the help.

    The two browsers use different programs to display the text of the source. IE usually takes the windows default and uses Notepad, whereas Firefox uses its own program. They are going to format it differently.
    My approach would be to use the Notepad version and have notepad save it to disk. Only your own program can tell for sure what is really in the file, without notepad introducing display artifacts (like extra newline to do word wraps).

  • I recently upgraded to FireFox 8.0. Now I can no longer see the option to view source code. Where has this gone?

    Nothing more to add, cannot find view source.

    "Ctrl+U" or in the View Menu
    If you want to see the keyboard shortcuts in Windows 7 menus, the removal was Microsoft's doing, and can be restored see item #9 in
    * http://dmcritchie.mvps.org/windows-7/win7.htm#steps
    If you made source be Notepad for you local files, you can still see the formatted source by bookmarking the following chrome shortcut. I give a keyword shortcut of "source:"
    * javascript:location="view-source:"+location
    Keyboard shortcuts
    * Keyboard shortcuts | How to | Firefox Help<br>https://support.mozilla.com/kb/Keyboard%20shortcuts
    * Firefox and other Browser Keyboard Shortcuts (Comparison Table)<br>http://dmcritchie.mvps.org/firefox/keyboard.htm
    Keyword shortcuts:
    * Firefox Keyword Shortcuts<br>http://dmcritchie.mvps.org/firefox/kws.htm
    You can make '''Firefox 8.0''' look like Firefox 3.6.*, see numbered '''items 1-10''' in the following topic [http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface Fix Firefox 4.0 toolbar user interface, problems (Make Firefox 4.0 thru 8.0, look like 3.6)]. ''Whether or not you make changes, you should be aware of what has changed and what you have to do to use changed or missing features.''
    * http://dmcritchie.mvps.org/firefox/firefox-problems.htm#fx4interface
    <p>There is a lot more beyond those first 10 steps listed, if you want to make Firefox more functional.</p>
    <p><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small></p>

Maybe you are looking for