Resolve Base URL

Hi,
I'm working with java.net.URL to code a simple program that read a file and get the archive described in this file. Actualy, the file is an HTML document done by a third party, and the program just have to read this file and download all the other document referenced via an tag. The problem is any valid HTML should be accepted, so the anchor may contain a relative URL. I just can't figure out how to get the absolute URL.
I was first surprised that no method does this in the URL class, then I realized it's the server's job to do so. There are some thricky case, like this intern URL we realy have at the office :
http://wiki/index.php/Accueil
The base URL is http://wiki/ and /Accueil is actually a parameter of index.php (I hate PHP).
I couldn't find the base URL in the HTTP header either. But the server has to give it somehow, or else my FireFox would not be able to render links or images on our wiki.
Is there anyway in Java to ask for the base URL of a specific document, or compute it ?

sarekca wrote:
The problem is any valid HTML should be accepted, so the anchor may contain a relative URL. I just can't figure out how to get the absolute URL.Use the constructor that takes a URL as a context and a spec for another URL. I believe that handles relative URLs just fine.
I was first surprised that no method does this in the URL class, then I realized it's the server's job to do so.No it's not.
Is there anyway in Java to ask for the base URL of a specific document, or compute it ?If you have a document that you retrieved from a server, you must know what the URL of the document is. Preserve that URL after you retrieve its content, then when you parse the content and retrieve (possibly relative) URLs, use the first URL to provide a context in the new URL objects you create.

Similar Messages

  • Xsl:include return incorrect base url

    I am using FOP to generate PDF file in servlet.
              I have 2 stylesheets (e.g. a.xsl and b.xsl), they are located in <myapplication>\webapp\application\stylesheet.
              In a.xsl, it includes b.xsl:
              <xsl:include href="a.xsl"/>
              When I test the stylesheet in the command line (dos prompt), it runs fine. However, when I run it in weblogic (6.0), there is an error:
              org.xml.sax.SAXParseException: File "file://C:/bea/wlserver6.0/b.xsl" not found.
              The base url for b.xsl should be the same as a.url. I believe there is a bug in weblogic, isn't?
              Is there anyone who knows how to resolve this exception?
              Thanks.
              - Christina
              

    'set' is a reserved word. So is your column 'values'. Always avoid using reserved words.
    MySQL :: MySQL 5.5 Reference Manual :: 9.3 Reserved Words

  • Base URL changed to HTTPS, but trying to download an protected PDF claims using (unsecure) HTTP

    Tried to configure an policy in contentspace to protect native PDF-files by Rights Management.
    Downloading such an file gave an error-message like (translated from german): "Acrobat-Security: you are trying to connect to an Adobe liveCycle Rights Management server over an unsafe protocol. Connection was refused. Please use HTTPS in the future."
    Then we configured the Rights Management Base URL to use the (already configured) HTTPS-protocol and port.
    But when trying an download again, the connection is still blocked claiming that HTTP is still used.
    Where is the additional place to configure the Base URL for the clients (or to be embedded in th eprotected documents)?
    Thanks,
    Dilettanto

    The Base URL is embedded in the PDF when a policy is applied.  You will need to need to re-apply the policy to the source PDF (with the correct Base URL set on the server).
    Regards
    Steve

  • Please help me in resolving the URL with parameters.

    Hello,
    Please help me in resolving the URL with parameters. If desformat is pdf, a pop up message �Acrobat Reader could not open �pa034922.fdf� because it is either not a supported file type or because the file has been corrupted���.
    if desformat is html or xml, the following URL is working.
    our requirement, report should be in pdf format.
    http://servername:7778/dev60cgi/rwcgi60?server=Rep60_mclaren&&userid=bizsystest/test@business&destype=cache&desformat=pdf&report=salary_dept.rdf&p_dept_list=''ABE','ASE','CE','CHE','CS','DE','DIAL','ECE','ERC','IE','ME','PTE','ARC','ASE1''&p_status_list=''ACP','AD','AP','ATP','D','FE','HD','INS','P','RP','S','TF','TP','TS','ST','GS','O''&p_sex=''M','F''&p_order_by='Name'&p_totals='NO'
    Thanks in advance,
    Usha

    We've seen this bug on machines running IE6 with a certain security patch (I forget its number). There's a thread in the Metalink reports forum about it. It appears to be somewhat tied to another problem where IE runs the report twice (you can see that in Showjobs. You're seeing the problem in 6i; I believe it persists in 9i.
    The workarounds are (1) set Acrobat so it doesn't open within IE or (2) switch to a different browser, like Netscape. For workaround 1, Start Acrobat Reader, Choose File -> Preferences -> General, Uncheck Web Browser Integration
    There's some evidence that it occurs more often with urls that include single quote characters. I think it's worse with XP, but I don't have any proof.
    If you check Adobe's site, you will see this isn't just an Oracle Reports problem. I think we're waiting for Microsoft on this one, so don't hold your breath for a quick fix.
    -- jim

  • Which table stores this value Transmission Servlet Base URL

    Hi All,
    EBS r12 12.1.3
    From the screen in Payment
    Update Payment System: FirstDataNorth
    i am looking for table that stores this value
    Transmission Servlet Base URL
    did look in these tables FND_PROFILE*but not available.
    Please help!
    Regards,

    Hi,
    I am not sure, whether you are looking at the correct place. Can you also let us know what made you ask to check the infromation from table.
    But there are configuration file which stores these information. I believe the source we are looking info might be wrong.
    Also have a look at:
    Oracle Payments Implementation Guide
    Best Regards,

  • Use flash charts from multiple base URLs

    My APEX apps are hosted by a shared service provider who uses a front end proxy. Following the instructions in this forum, I was able to get flash charts to work by substituting my client URL for #HOST#.
    Example, Change:
    <embed src="#IMAGE_PREFIX#flashchart/
    #CHART_TYPE#.swf?XMLFile=#HOST#apex_util.flash?p=&APP_ID.:5:&APP_SESSION.:FL
    OW_FLASH_CHART_R#REGION_ID#"
    to
    <embed src="#IMAGE_PREFIX#flashchart/#CHART_TYPE#.swf?XMLFile=
    http://mydomain.hostingcompany.com/pls/apex/apex_util.flash?p=&APP_ID.:5:&APP
    _SESSION.:FLOW_FLASH_CHART_R#REGION_ID# "
    I changed this base url in multiple locations in the chart source code and the charts now work.
    THE PROBLEM
    Users access the site via a public domain http://www.xyz.com. In order to get the charts to work I then need to change #HOST# to http://www.xyz.com/pls/apex. Then they no longer work when accessing via http://mydomain.hostingcompany.com/pls/apex.
    Is there some way to get the charts to work irrespective of which path users take to get to the site?
    ANOTHER PROBLEM
    Though the above fix works for stand alone flash charts it does not work for the charts in interactive reports or the sample charts displayed when using the chart builder wizard in the application builder.
    Is there somewhere to change in order to get the sample charts in the create chart wizard in application builder and/or the charts in interactive reports?

    Hello,
    Take a look at this thread -
    Re: #HOST# variable at Flash chart region source
    Which discusses the issue.
    John.
    http://jes.blogs.shellprompt.net
    http://www.apex-evangelists.com

  • Custom SSO & base URL settings

    Hi All,
    We are just implementing our Custom SSO product with 5.0.4 for windows. The basic implementation has gone very well but I do have a problem with rouge URLS.
    During the install we used this as the base URL - http://portalv5dev.wiley.com:8080/etc
    Our SSO set up is configured to http://devportal.wiley.com/etc
    Great we can get in but of course most of the URL's are pointing to the old address. I have changed the server settings through the admin console and also amended, n_config.xml, j_config.xml and wsserver_config.xml. Whilst this change has not caused any problems the URL's still haven't been amended.
    Has anyone had any success in changing this, if so could you shed some light. Many thanks, Adam

    How do you map your corporate user directory and EBS users? Is there any way to guarantee that users have the same credentials? Suggest you to forward the query to Portal and Security forum so that security experts can also have their opinion. Don't think it will work without partner application registration.

  • How to dynamically form the base URL for a region?

    For Application Express 2.2.1, I've created a URL region for a static html page:
    e.g.
    http://xxxx-dev.website.com/html/page1.html
    The problem is that when I promote this application to production (using export/import), this URL still refers to the development website.
    I need Application Express to use the base URL of its current URL path rather than http://xxxx-dev.website.com
    Can this be done?
    Thanks

    Hello,
    If you omit the http:// part from your static URL, the APEX engine will automatically attached the local server prefix to it.
    Regards,
    Arie.

  • Files on the base URL

    How can I explore / search for files on a Applets base URL. Is there a simple way to do this without using servlets or some kind of java security programing ?

    You need to give more info. Are you trying to look on
    your machine, some web server in your company, or the
    internet in general?The applet will be running on a WEB-server on a intranet or on internet.
    The idea is that the applet will display information from a selection of text-files, the text-files will also be stored on the same server as the applet.
    The number and the names of the text-files will be chaning but the storage location will be the same, ex a directory on the same area as the applet itself.
    What i need to do is to find out which files are stored in the directory, display this in the applet in order for the user to chose the file of interest.

  • Getting exception in log - Invalid external link base url

    Hi,
    I am using BI-Publisher Release 10.1.3.4 and I see that for all the reports I have in it, the below line is coming in my bi-publisher log.
    [092010_053617793][][EXCEPTION] Invalid external link base url: 'http://10.177.219.162:9704/xmlpserver/' -- the ip is my machine ip address.
    This line comes for every executing of the report. This is not causing any unwanted behavior but having an exception in log is always a concern from field.
    Can any one let me know what could be the reason for that exception?

    Hi,
    I come across the issue when I tried to view the BI Publisher report, the pdf report didnt load up and throws "[072811_123101921][][EXCEPTION] Invalid external link base url:" on the server console.
    with some the Acrobat error like "there is no page to display"
    Then I checked if the data was there or not in database table to which i had connected through the jdbc conection. I found that no data was present in the database tables. So i run the ETL process again setting some flags in the source database and then the data came up in the BI Publisher connected database.
    Then when I started Bi Publisher server and viewed the reports, it worked.
    Regards,
    krish

  • Firefox adress bar suggestions - base url?

    Hey people. When i put in a few letters to spawn search results in the firefox adress/location bar, i get this list of full url's, which, for the most part, are unusable to me.
    say i type email, to get www.email.nu (my email provider) as a suggestion, it returns http://www.email.nu/some-made-up-awkward-perl-script.pl. When i type google, to have http://www.google.com as a suggestion, it displays everything else than that. Old search strings and whatnot.
    I know i can bookmark web pages to have them prioritized in the "suggestion" algorithm, but that kind of defeats the purpose of the "search engine" (to some extent anyway).
    So, does anyone have any suggestions to make firefox "behave" (i.e. show base urls, or at least without all the ?php cruft)

    Hello pelle.k!
    "Posts: 666 from you" <- Are you satanist, hehe ? smile Why can't you find your exact url ? I can't understand.
    Hello djszapi! I'm most certainly not a satanist. However, i'm not very religious either. Nor am i an atheist, but i belive i am an agnostic theist!
    The Awesome-bar learns from your usage, so after a few times of typing in 'goo' and then searching it's suggestions for the option 'www.google.com' it will learn that you want that one and move it to the top.
    I will try it out. Thanks for the suggestion!

  • I can't see a Base URL for shared Calendars with new Mobile Me iCal

    Hi,
    I have a family .Mac membership and my events are being organised by a Windows user (with one of my other accounts) using the Mobile Me Web site. No other problems accept this.
    With the previous iCal on my Mac when I shared a Calendar I was always shown the Base URL which anyone with a web browser could access. With the new iCal on Mobile Me is a simple URL still an option? If so how can I find it?
    I don't wont subscribers to have to download a file or add the calendar, I just want them to click a URL and view the week's events, Read only, as with the previous iCal on my Mac.
    The old URL system does not work for the new iCal on Mobile Me I tried it http://ical.me.com/username/Calendar
    Any Tips will be greatly appreciated.
    Regards,
    Athena

    Do you have enabled auto-fill for the location bar?
    You can check the pref browser.urlbar.autoFill on the <b>about:config</b> page.
    You can also make the protocol visible.
    You can set the pref <b>browser.urlbar.trimURLs</b> to <i>false</i> on the <b>about:config</b> page to see the http: protocol.
    You can set the pref <b>browser.urlbar.formatting.enabled</b> to <i>false</i> on the <b>about:config</b> page to disable the highlighting of the domain and see the full URL more clearly.
    *[https://bugzilla.mozilla.org/show_bug.cgi?id=678352 bug 678352] - 'h' entered as first letter in location bar is overwritten with 'w' when browser.urlbar.autoFill is true

  • How to get the base url

    Hi,
    when configure the BPM, we set the base url (http://host:port/), which will be used in the default notification sent by bpm.
    now we want to include that url in our notification step. is there a way to get that url?
    Best regards,
    John

    Hi John,
    Would you please share the solution you found for this problem, maybe the EJB source codes or something like that? It would really help the ones like me who have the same problem and looking for a solution.
    Thanks in advance...
    Best regards,
    Utku.

  • Base URL on selecting "Favorites (Browser)" button from EP

    Hello Everyone,
    The "Favorites (Browser)" button that appears almost in every cProjects view is giving the backend base URL but not the portal URL when accessing cProjects from EP. Is there any way that this can be changed, so that it gives the relevant links. Please let me know if you require any further information on this issue. Thanks.
    Regards,
    Gopal

    Hi Matthias,
    Thanks a lot for your reply. We have actually noticed this issue in two other areas like "Link to the Sub Project" and "Operation Project" button that appears in the toolbar when a task opened from the task dashboard! It is strange that SAP has not done anything to dynamically create the URL when cProjects is being access from Portal!
    Regards,
    Gopal.

  • Can the base URL be canged after cal is configured?

    In cal 6, I have http://server:8080
    but I want it to respond on http://server:8080/cal
    Is this possible to change without a reinstall?
    I ren through the csconfigurato, but it only addresses port #.
    Thanks for any help!

    I met
    uiBaseUrl
    Specifies a URL for the base server address. For example: "https://proxyserver".
    Corresponding ics.conf parameter:
    ui.base.url (no default)
    in the config file trying to find a solution for a different problem.

Maybe you are looking for

  • Ipod touch stuck on portrait view - any ideas?

    My iPod touch has started to refuse to switch to Portrait view. It will use landscape when the App concerned is set in that view, but otherwise not. I can't find where there is any help about this. Any help much appreciated. Thanks, SD

  • GPIB/TNT PnP DOS Installation Issue

    I have a AT-GPIB/TNT PnP board that I am trying to install on a DOS computer.  I am using the latest NI488.2 software for DOS. On bootup, the GPIB software drivers install properly, but the interface cannot be found.  When I run ibdiag it detects the

  • WebDynpro border

    Dear experts, I'am working with the web dynpro explorer for abap and when I start the application and the internet-explorer apears all applications have a 10 or 15px margin at the top and left. Is it possible to deactivate or edit this margin? best r

  • Weblogic application server 7.0

    Dear all I have a great problem. I have built my final project on weblogic 6.1 SP2. I use the jdk 1.4.1 version. Now i shift my project on weblogic application server 7.0 . But it is not working with jdk 1.4.1. I have used JDK 1.4.x featuers in my pr

  • Importing svg's stroke-width not scaled up

      I am trying to import an svg in the illustrator, and it has stroke-width of 30px  but its wasn't scaled up, its showing 1px of the stroke-width always, In preferences i have checked the option ' scale and transform the stroke-width ' and i have cha