Classpath classloader relative urls etc

hi,
i dont think i really understand all this classloader type stuff, and wonder if someone could tell me what i'm missing.
i have an app with this directory structure:
-appdir
    -lib
        app.jar
        someotherjars.jar
    -data
        propertiesfilemy classpath is just the jars in the lib folder. i want to read/write to the propertiesfile in the data directory. ideally via a relative path based on the lib directory. i don't want to use the user.dir system property cos that could be anywhere. i've tried all sorts of things to do with classloaders/getResource/getSystemResource etc, but all i get is null. is it possible to do this with a relative path?
thanks for any help!

hmm, still confused!
if i add appdir/data to my classpath and do this:
this.getClass().getResource("propertiesfile");i still get null. but if i do:
this.getClass().getClassLoader().getSystemResource("propertiesfile");i get the file, hooray!
BUT...
i don't really want appdir/data in my classpath (theres also a logs directory etc, really want to do it relative to the lib dir, or the appdir) if i add just appdir to the classpath its ok, this works:
this.getClass().getClassLoader().getSystemResource("data/propertiesfile");but if i just add the lib dir to the classpath and do this:
this.getClass().getClassLoader().getSystemResource("../data/propertiesfile");it doesn't. i can't really see why...
cheers anyway, at least i know i can get at my file now, thaks for the help!
ps err, anorak, hmm, how to explain that one? :) i guess its just another way of saying slightly nerdy really, i.e. people most likely to be seen wearing an anorak = computer nerds/trainspotters (not that i am either, honest, neither do i wear one...). british humour?? :)

Similar Messages

  • Resolve Relative URLs in Http response.

    I am using java.net package classes to make Http calls to get HTML, which I display in a page (using JSP). Problem is that there are relative paths in anchor, images etc and so links don't work and images don't display. I would like to know if there is any way to convert relative urls to absolute urls.
    Thanks
    rcr

    I have found that ColdFusion has a tag CFHTTP that converts relative url to absolute url (by giving arttribute resolveUrl="yes"). I wonder how they do it.
    http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-p58.htm

  • External Link - relative url

    We recently upgraded from CM Patch 4 to Patch 28.  We have some KM External Link the point to iViews and we used the syntax /irj/servlet/prt/portal/prtroot/etc ....
    This worked fine in Patch 4, but now is expecting the http://server/ name to be included?  Has anybody else encountered this?
    Does anybody know of an alias I can use, e.g. - http://servername/irj/etc ...?

    HiJulian,
    Sorry I didn't explain the problem well enough the first time.
    An example is that I have an iView to an ESS transaction, but we wanted to be able to view it among other KM content.  We did this by geting the URL of the iView, creating an external link in the KM folder pointing to the iView on the same server.  To make it easier to move content bewtwen Dev,QA,and Prod, we used the relative URL's starting with /irj/etc... 
    In Patch4, this worked fine and it picked up the http://servername just fine.
    Now in Patch28, the resulting URL looks like http:///irj with the servername missing.
    Thanks,
    Mike Shroyer

  • Change relative URL of segments for HLS-VOD

    Simple Version:
    Can I change the URL of the TS segments delivered by the hlshttp_module in any way, or is it always relative to the requested m3u8 URL?
    Long Version:
    To try and protect my content from being accessed by third parties I want to use mod-auth-token, with a client inserted token in the request for the variant m3u8, and a server generated token in the HLS m3u8.
    My clients generate a token using a shared secret, and request the variant m3u8 from:
    https://myserver/hls-manifest/<clienttoken>/<hextime>/path/to/folder/manifest.m3u8
    This page is served dynamically (using php), and does not really have anything to do with FMS even though it is running in the same Apache instance. The m3u8 is generated with server tokens in the m3u8 URLs somethign like this:
    #EXTM3U
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=10240000,CODECS="mp4a.40.2, avc1.42001f"
    https://myserver/hls-vod/dc226454b9e39b9ffc44f9496505c70e/4ea6963f/path/to/folder/filename _1024k.mp4.m3u8
    I have installed mod-auth-token, and configured it on a LocationMatch for "^/hld-vod/(.*)\.m3u8$". Everything up to this works perfectly, and I can request both m3u8 playlists successfully. The problem is that the content of the m3u8 (the ts fragment URLs) are relative to the URL of the m3u8.
    #EXTM3U
    #EXT-X-MEDIA-SEQUENCE:0
    #EXT-X-ALLOW-CACHE:NO
    #EXT-X-VERSION:2
    #EXT-X-KEY:METHOD=AES-128,URI="https://myserver/hls-key/vodkey.bin",IV=0X560417e9155f2f2cb1fb9410397db72e
    #EXT-X-TARGETDURATION:10
    #EXTINF:10,
    filename_1024k.mp4Frag1Num0.ts
    The player is attempting to request files from:
    https://myserver/hls-vod/dc226454b9e39b9ffc44f9496505c70e/4ea6963f/path/to/folder/filename _1024k.mp4Frag1Num0.ts
    I want this to look more like this:
    https://myserver/hls-vod/path/to/folder/filename_1024k.mp4Frag1Num0.ts
    or even this:
    http://mycacheserver/hls-vod/path/to/folder/filename_1024k.mp4Frag1Num0.ts
    So the m3u8 needs to look more like this:
    #EXT-X-TARGETDURATION:10
    #EXTINF:10,
    http://mycacheserver/hls-vod/path/to/folder/filename_1024k.mp4Frag1Num0.ts
    I can think of lost of placeswhere this would have  useful applications. There does not appear to be anything in the Developer documents which would help here. Does anybody have a suggestion for something I can try?

    Hi Michael,
    Thanks for using FMS 4.5 and its new features.
    However, there is no way to not to put relative urls for the ts files. However, you might like to do either Apache's "URL rewriting rules" or redirection . For rewriting rules, you might check http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
    Though, you may suffer in caching benefits. Here, if the id that you have inserted is on per client basis, you may not get the caching benefits on the caching server as it will always caching on basis of
    https://myserver/hls-vod/dc226454b9e39b9ffc44f9496505c70e/4ea6963f/pat h/to/folder/filename_1024k.mp4Frag1Num0.ts
    while, if you use client side redirect something like
    redirect 301 url1 url2
    it may help. You might consider other similar solutions for example, client redirect on proxy servers etc.. just be ware of caching in your case (if applicable)

  • Can't view dashboard with relative url in BI 4 Launchpad

    I created a dashboard using BIWS connections and I am able to preview the dashboard when i have the full path of Web Service URL but when I use the relative url and publish to launchpad I get the "Cannot access external data......, Unable to load URL:/dswsbobje/Services/Session..." error message. Any ideas on how to solve this?
    Thanks

    Are you trying to preview the dashboard from dashboard designer tool ?  If yes, then you must have a full web service url, otherwise, it will not be able to resolve the server and port.
    But, if you use relative URL and export the same to BO repository, you will be able to view the same by logging into BI Launchpad. There it can resolve the server name and port from existing session.

  • How to set up use of relative URLs for a BSP application

    Dear all,
    I need to access a BSP application through our external portal.
    This is failing because generated URLs are absolute URLs (they mention physical server name, not known of course on the internet) where they should be relative URLs (they use external portal URL as prefix).
    How to set this up?
    I'm logged on http://myportal.com/irj/portal and want to call a BSP application. To build this page, my internet client (Internet Explorer) tries to get elements from the server. Looking at HTTP trace, I can see that my IE is trying to reach the physical server, not known on internet of course, then page loading fails.
    Ex absolute URL : http://myservername.domain.com/sap/bw/[...]/image1.gif
    This is the behavior I can see at the moment.
    Relative URL : http://myportal.com/sap/bw/[...]/image1.gif
    This is what I'd like to see.
    Many thanks in advance for your help.
    François

    Any idea ?

  • Sharepoint 2013 Wiki Page - Links in content rewritten to relative urls

    We have an issue where on all SharePoint 2013 wiki pages any URL to items within the site containing the wiki page are rewritten to be relative URLs. This causes a huge problem when we surface these pages and a snippet of their content through a search web
    part because the links fail being relative to the wiki page itself. To further illustrated with an example.
    A site collection root page http://www.sp2013.com/default.aspx contains a search results web part returning all wiki pages in the site collection. There is a custom display template that renders
    the linked title of the wiki page and the first 500 characters of formatted text (html) of the wiki page.
    A wiki page is created in a sub site (sub1) called wiki1 (http://www.sp2013.com/sub1/pages/wiki1.aspx) the text of the page contains:
    "Check out our new library: Document Library"
    Document Library is a hyperlink to (http://www.sp2013.com/sub1/Document%20Library/Forms/AllItems.aspx)
    Upon saving the wiki page the link is reformatted to be /Document%20Library/Forms/AllItems.aspx
    From the rollup web part at http://www.sp2013.com/default.aspx the relative url in the snippet text of the display template evaluates to
    http://www.sp2013.com/Document%20Library/Forms/AllItems.aspx which does not exist.
    I have attempted modifying the source of the wiki page as well as the link in the ribbon however upon save of the changes the link is always modified to be relative. Any assistance is appreciated as this is extremely frustrating. Thank you.

    Hi JonesEJ,
    According to your description, my understanding is that SharePoint converts a absolute URL to
     a relative URL when you save the wiki pages containing the URL.
    This is actually the preferred behavior in SharePoint and on the web in general. SharePoint saves all absolute URLs for the wiki content as relative. It only does this if the URL matches the URL for the web application for that current wiki
    site.
    There is no OOB way to change the relative URL back to the absolute URL. For your issue, you can try to use
    SPSite.MakeFullUrl() to convert it back.
    There is a similar post for your reference:
    http://sharepoint.stackexchange.com/questions/62887/absolute-urls-converted-to-relative-urls-when-saving-item
    Best Regards,
    Wendy
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Wendy Li
    TechNet Community Support

  • Relative URLs not working in JAR file once JAR is moved

    I've been loading images with the following:
    public static final ImageIcon anIcon = new ImageIcon("iconName.gif");
    This works fine when all the class files are in the same folder with the gifs. I then packaged the whole folder into a .jar file, moved the resulting .jar file to another directory, tried running it and none of the icons loaded. They are present in the .jar file, why doens't the relative URL still work? Is there simply another way to write the URL so that it knows to look in the .jar file?
    Thanks for help,
    Robert Douglass

    Is there simply another way to write the URL so that it knows to look in the .jar file?Once you put the class files along with your gif files in a jar, you have to access the gif file like this:
    import java.net.*;
    URL url=myClass.class.getResource("iconName.gif");
    ImageIcon anIcon = new ImageIcon(url);
    Where myClass is the name of your class file.
    V.V.

  • Problem with sendRedirect using relative URL in WebLogic 5.1 with SP7 & 8

    I patched to SP 7 (and also 8), and the request.sendRedirect() with relative
              URL failed. The browser simply displayed "404 - Page not found".
              This problem only happens in a cluster environment attached to a web server.
              SP6 or earlier does not have such problem.
              I noticed that the latest SP always formats the URL and returns it as a full
              absolute URL to the browser. The problem is it uses the Weblogic Server host
              URL where the request is processed (not the Web Server host URL) which is
              not visible to the internet.
              Is it possibly a bug in SP?
              

    I patched to SP 7 (and also 8), and the request.sendRedirect() with relative
              URL failed. The browser simply displayed "404 - Page not found".
              This problem only happens in a cluster environment attached to a web server.
              SP6 or earlier does not have such problem.
              I noticed that the latest SP always formats the URL and returns it as a full
              absolute URL to the browser. The problem is it uses the Weblogic Server host
              URL where the request is processed (not the Web Server host URL) which is
              not visible to the internet.
              Is it possibly a bug in SP?
              

  • Inspector-Hyperlink-An External Page = a Relative URL?

    I'm on iWeb '08 and have a question that I simply can't find an answer too despite searching many failed searches.
    I'm using iWeb to publish to a folder, so that I can later ftp the finished site.
    In my site, I want to add a hyperlink to an external URL, however the URL: box seems to only allow absolute url's to be entered after selecting Link To: An External Page.
    Is that right? Am I missing something?
    How do I create a hyperlink with a relative URL?
    Thanks in advance,
    JPS

    I don't understand what you mean by relative url?
    To create a hyperlink to an external page, click on Inspector in iWeb and then click on Hyperlink. When in Hyperlink click on 'link to an external page' and then type in the url that you want to link to and you can also have it open as a new page.
    Not sure what else you are trying to do?

  • How to use relative url

    I use xml file to save configuration and saved /WEB-INF/config.xml
    In my java class i can't use that file with relative url.
    document=builder.parse(new File("/WEB-INF/config.xml"));

    Try something like this:
    String thisPath = this.getClass().getResource("").getPath();
    document=builder.parse(new File(thisPath + "/WEB-INF/config.xml"));

  • Usage of relative url across site collections in sharepoint 2010

    Hi
    I have a webapplication with 2 sitecollections. In one sitecollection, created a link by going to navigation under sitesettings.
    Added relative url to map to 2nd site collection. Eg: /sites/site2/page1.aspx
    But by doing so, it is giving error. Help me out how to give relative url pointing to different site collection from another sitecolleciton.
    Thanks in advance
    Naina 

    Say, Site Collection 1 URL: http://sitecollection1.domain.com/
    Site Collection 2 URL : https://sitecollection2.domain.com/
    Now, on "Site Collection 1", In Site Actions-->Site Settings-->Navigation, when you use "relative URLs", it will always refer to the current Site Collection i.e Relative URL "/sites/site2" will always be "http://sitecollection1.domain.com/sites/site2".
    Anyways, what is the "requirement". What are you trying to solve by using "relative URL" for Site Collection 2 on Navigation of Site Collection 1. Reason for asking is, there might be different approach for your "requirement".
    Naveed.DG MCITP, MCTS -SharePoint 2010 Administrator "Vote As Helpful" If it helps!!

  • Relative URLs and Application Context

    How do you handle rendering relative URLs so that:
    1. Your application is independent of the application context it's deployed to
    2. You don't end up with lots of ugly code in your views
    3. The solution will work on any J2EE server
    I have several approaches, but I can't find any "best practices" discussions on this subject so I thought I'd start one.

    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
    "> Home</a>
    My main problem with that is that it's ugly as sin.                                                                                                                                                                                                                                                                                                                                                                       

  • Generating relative URLs in 12.1.3 menus

    Does anyone know if it is possible to get R12.1.3 to generate relative URL for all menu items?
    The new AJAX based menus are returning absolute URL for all menu item links.
    If this is the wrong forum please let me know
    thanks

    Hi,
    ERROR: I/O or zip error while attempting to read entry oracle/xdo/parser/schema/XSDIdConstraintTable$NodeTable.class in zip This error indicates one of the following:
    - Permission are not set correctly, so please verify the permissions -- See (Note: 339762.1)
    - The file is corrupted or missing, and you would need to find the file and copy it to the appropriate directory -- See (Note: 299723.1, 299964.1, 343639.1, 746167.1) for examples
    If none of the above helps, I would suggest you log a SR.
    Thanks,
    Hussein

  • XSQL XML demos not finding relative URLs

    I finally have the XML demos running under OAS 4.0.8.1 (while waiting for IAS on NT) but none of the relative URL references in the demo files work unless I map a virtual path to every directory.
    Mapping /demo to e:\xsql\demo allows me to bring up the demo page listing all demos but none will work.
    If I then map /airport to e:\xsql\demo\airport the airport demo will work form the demo page.
    What is the proper set of virtual paths to map.
    Thanks,
    Rick Post
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Rick Post:
    I finally have the XML demos running under OAS 4.0.8.1 (while waiting for IAS on NT) but none of the relative URL references in the demo files work unless I map a virtual path to every directory.
    Mapping /demo to e:\xsql\demo allows me to bring up the demo page listing all demos but none will work.
    If I then map /airport to e:\xsql\demo\airport the airport demo will work form the demo page.
    What is the proper set of virtual paths to map.
    Thanks,
    Rick Post
    <HR></BLOCKQUOTE>
    IAS 1.0 has Apache 1.3.x + Jserv 1.1, you could download this version for Windows NT from Apache Web Site. There aren't differences from IAS to Apache on windows NT except for Oracle iCache.
    Regards, Marcelo.
    null

Maybe you are looking for

  • Photoshop CC Update - Error Code: U43M1D204

    After literally waiting all afternoon for Photoshop to download and install from the CC, I got an error message that an update could not be loaded.  I tried then loading the update from within the software, and got this error: Adobe Photoshop 14.2 Th

  • Photo Orientation - Sending to PC Users

    Is there a way to correct the orientation of a photo I'm sending to a PC user from my Mac?  I've tried rotating what appears to be portrait 90 degrees clockwise on my Mac but the recipient still gets it in landscape mode, just 180 degrees from the pr

  • ACL - how to (easily) deny access to everthing but home directory

    I was trying to set up a very restrictive drop box for users to leave and take files from. I set up a special USER and then thought I could use the ACL's to deny access to the system except for the home directory. From reading the documentation I tri

  • [q] variables not seen in WLPI business operation window

    hI, I am assigning a java object instance to WLPI variable. Then I try to call one of the methods of this Java Object (Using business operation) but in the Drop Down list in the WLPI I don't see the assigned variable ! Am I missing something ? ( I Us

  • Curve 9300 as wifi router

    I am looking for a app to enable my Curve 9300 to be used as a wifi or bluetooth router. Want share my 3g with my android tablet. Some one know how to do it? Or how to convince the Blackberry to build a app for this?