Any way of modify base directory at runtime (in loaded jars )?

Hello all,
Well, I'm using tomcat to run my web application, which loads
dinamically many jars and execute them. My problem is that these jars
sometimes have a method that uses relative paths to do something (read
files, create files, etc). Currently, the current base dir is given
wrong for these loaded applications! Instead of the right path, it's
given "C:\tomcat" or something.
If it were with my Web Application itself, it would be easy to get over
this problem by using the getRealPath("") method provided by api. But
since I can't modify the jar code I will load, what can I do? Some
ideas?
Thanks you!
Bruno

I have found the solution. This is the code to write-access files from within JavaServer Faces backing bean:
FacesContext fc = FacesContext.getCurrentInstance();
ExternalContext ec = fc.getExternalContext();
ServletContext sc = (ServletContext) ec.getContext();
String realPath = sc.getRealPath(getDocumentURI());
FileOutputStream fos = new FileOutputStream(realPath);where getDocumentURI() is the method that returns the virtual path for document to write to.

Similar Messages

  • Any way to modify document safely?

    If you extend AbstractDocument (at some level), and you want to write a method that does a whole lot of operations on a document at once...like cutting, pasting, changing attributes, etc.. in one method call, is there ANY way to be able to do this safely (without the chance of another thread changing the document while you're working on it.)
    You can't use readLock() obviously, you also can't use writeLock() since all the lower level methods (that you DEPEND on) also use writeLock() before modifying the document, and calling writeLock() from a thread that already has the lock throws an exception.
    You can't control all edit paths since you don't have access to the undo stuff, otherwise you could add your own level of locks.
    Why in the world was AbstractDocument designed this way? It makes it virtually useless to extend it for functionality since all the functionality is effectively confined in AbstractDocument.

    Why "obviously"? The JavaDoc says:
    @exception IllegalStateException thrown on illegal lock
    attempt. If the document is implemented properly, this can
    only happen if a document listener attempts to mutate the
    document. This situation violates the bean event model
    where order of delivery is not guaranteed and all listeners
    should be notified before further mutations are allowed.
    So if you're getting the exception, you're doing it wrong.

  • [bug tracker issue] Any way to modify the bug detail of mine?

    Greetings,
    I just found i can't modify the bug report  after i reported a new bug in the bug tracker of archlinux.
    it is quite inconvent and weird, since it's quite common that you want to update the bug detail or change something wrong. 
    at least , in my opinion. -_-
    so Is any reason for such restirction?
    and is any way to make me modify my bug report?
    -Roadt
    Last edited by roadt (2009-12-28 06:55:52)

    Just add  your update as a comment.

  • Any way to modify an app to another sort of readable (not from ipod/ipad) document?

    i downloaded an app - it's a shopping guide i wrote - is there any way to change the file type so that i can view it as a pdf or any other sort of readable (not from ipod/ipad) document?

    No, that is not possible. If you wrote the app, though, then you have all the content. You'll need to take that content and assemble it into a document which you can then turn into a PDF. You might want to consider recasting your app as an iBook. With iBooks Author you can create interactive books as well as PDFs of the same content.
    Regards.
    Message was edited by: varjak paw

  • TS4123 Is there any way to modify Bonjour to work with other LSP?

    I'm having the problem pointed here http://support.apple.com/kb/TS4123 and the cause is a proxy software I use. It's a program I use every day and I cannot just disable it, is there any workaround to this? Any way to fix Bonjour instead? I really don't see why other companies must adapt their software to be compatible with iTunes and not the other way around.

    Not at present. It is built to use the frameworks of OS X.
    You could have both running on an Intel-based Mac with Parallels Desktop virtualization, but I don't think that's what you're looking for. Would you consider switching to OS X completely?

  • Any way to modify headers/footers added to reply/forwarded messages?

    Is there any way to change or eliminate the standard headers and footers that Mail adds to replies and forwarded messages (i.e. "on 11/30 name.com wrote" on replies; "begin forwarded message" on forwarded messages)?

    There is not a setting to do it. You can delete them in the message though.

  • Any Way I Can Make My Page's Images Load One At a Time?

    Hi folks,
    I have a page with a stack of large images. It takes several seconds for them all to load, but I was wondering if there's any way I could dictate the order in which all of these images load? This way, the top image would load first, then the the next one down, and so on, leaving little perceivable page load time for visitors.
    It seems like this would be a common necessity for a web page, does anyone know an easy (because I know very little about this) way to do this?
    Thanks!

    One major problem, is that you have scaled the images in DW, and not in a graphics program.   I have your page open in the background and it's been a while loading and it's still not finished  :-)
    eg:  the following images has properties of:
    http://www.selfeffacingtheories.com/web-content/pictures/picpics/holes.jpg
    933px × 699px  but you have scaled it to:  615px × 458px
    Trying to put your page through the Web Optimiser - doesn't show a very good result - it couldn't be tested because it exceed the size requirement.
    http://www.websiteoptimization.com/services/analyze/
    The size of this web page (4264698 bytes) has exceeded the maximum size of 3000000 bytes.
    This is just way too big a file size and seriously needs to be optimised.  The only way to do this is to scale down the images in either Photoshop or Fireworks.
    Why not use a lightbox effect, where you show a much smaller size of the image and then when someone clicks on it they see a much larger version of the image:
    My small demo here: (using the Dreamweaver Lightbox Extension)
    http://dreamweaverresources.com/tutorials/dreamweaver-lightbox/

  • Any way to get Java Plug-In-like handling of jar versions?

    I have jars intended for use with the Java Plug-In with version #'s in properties files (computed by the various tooling for updating these on the server). The jars themselves have no notion of jar #.
    I would like to re-use these jars and version #'s with Java Web Start to avoid conditional GETs, but without jar diffing in this case (as I already have many small jars due to lack of jar diffing in the Java Plug-In).
    Is there any way I can get Java Web Start to act like the Java Plug-In in this regard (i.e. the jar version # is a statement from the server, the client does a normal GET against the jar URL if its own version is not that stated by the server)?
    [Don't get me wrong, jardiffing is cool, but having to do everything differently between Java Web Start and the Java Plug-In is [b]not cool.

    Best way IMO would be to create a Socket connection to it so that you could connect with a client app and feed in data that way

  • Any Way to modify a users Library / Font as admin?

    The Users account Takes around 25-45 minutes to login...
    Im sure that the user has multiple Corrupt fonts and need to replace all of them with known good fonts.
    After the log in window the Desktop Background Image shows the Blue Spot light icon show up but noting else loads.. for around 25-45 minutes...
    Working at a News Paper the User has 1345 font's under her user account... While we only use around 500 fonts normally..
    using any other account login takes around 15 seconds or so.
    Should I try Safe mode and Nuke her fonts that way.. Or is it possible for me to modify her library font file form my admin account?
    Thanks

    Open the Terminal in the /Applications/Utilities/ folder and run the following:
    sudo mv /path1/ /path2/
    where path1 is the current location of the folder or file targeted and path2 is the desired location of it. This command will prompt for the administrator password, which won't produce anything in the Terminal.
    (35583)

  • Is there any way to modify the photo book size after I have created the book?

    I created a photo book then realized it was not the correct size. Is there a way to correct the size or do I have to start from scratch?
    I Found the answer after I posted this- CTRL D to duplicate, then choose new theme - Worked like a charm.

    Yes.  First click on the book in the Projects section and type Command +D (duplicate).  Open the book, click on Change Themes and in the next window select the size and type you want.
    The duplicate is to have in case you find any text that was removed in the resizing.  You can cut and past from the duplicate copy to the original.  Also verify that the resized book has all of its text, not text warning indicators and that all photos are there and in the correct order.
    Always create a PDF version of the book according to this Apple doucment, iPhoto, Aperture: Previewing an order in iPhoto or Aperture, to check for any errors, i.e. typos, missing text, etc., before ordering the book.  Keep the pdf file to compare with the printed version when it arrives.
    Opps!  Answered your question from the title without reading the full body of your post. However, the last 2 paragraphs are worth reviewing.
    OT
    Message was edited by: Old Toad

  • Any way to enlarge base font size in Safari?

    Simple question. Looked for answer, can't find. I can resize each page with finger gesture, but am looking for a basic resize that stays on all the time. Thanks.

    On second thought -- the way PB does persistent font size chugs is annoying. it first renders each new page at the STD size, then snaps it up to new size. This makes page loading slower by noticeable amount. Very annoying. Looking elsewhere now.

  • I have an IPhone 5 and did a factory restore now I cant boot past the Apple logo or even connect to ITunes - is there any way I can restore the phone or re-load the OS8

    Help - have tried everything to connect my phone to ITunes to restore and it just wont sync - is there any other ways to do this or do I need to send it back to Apple?

    iOS: Not responding or does not turn on - Apple Support
    click on link

  • Any way to default on FIRST of multiple clips loaded in the Source Monitor?

    When dragging 2 or more clips to the Source Monitor, or using the 'Open in Source Monitor' contextual menu in the Project window, the clip that automatically gets displayed in the Source Monitor is the last clip of the list, rather than the first one.  WHY? 
    Basic Human Logic 101 dictates that editors would always want the FIRST clip of the list to automatically be displayed rather than the LAST.  For example, if I open CLIP001 to CLIP025 in my Source Monitor, why on Earth would I ever want to trim and send CLIP025 to the Timeline first, before CLIP001 to CLIP024?  THIS BACKWARDS WORKFLOW IN PREMIERE DOESN'T MAKE ANY SENSE!!!!  Adobe, please fix this unhelpful annoyance.  I encounter it dozens of times on every project, and I imagine that every single editor out there that uses the Source Monitor to load several clips at once also encounters this illogical annoyance.
    If there's already a way to change this setting that I'm not aware of, I would love to know!  Otherwise I'll be sending Adobe an official FR to get this fixed.
    Thank you!

    I think you misunderstood what I'm asking for.
    I'm asking for the first newly loaded clip to always be shown by default when loading several clips in the Source Monitor.  So if the Source Monitor already contains CLIP001 to CLIP025, and you load CLIP026 to CLIP050, CLIP026 should automatically be shown, NOT CLIP050, as Premiere currently does.  Defaulting to the first clip in the list (CLIP001) when adding new clips would make as little sense as the way it currently works, so of course I wouldn't want, nor am I asking for that.
    I always load 25-30 clips in the Source Monitor for trimming at a time.  It's the most efficient workflow I've come up with and I'm quite surprised none of the responders work that way.  I load up a bunch of clips all at once, and then set IN (1) and OUT (2) points on the current Source Monitor clip, and then send the selected range to my Timeline (5).  Keys 3 and 4 go back and forward in the list of loaded clips.  JKL controls playback.  This allows the editor to quickly pre-select material for editing using only the keyboard.  Once I finish going through my clips, I load another 30 or so clips.  Quick.  Efficient... exept for the fact that Adobe decided to work backwards, by always showing the last loaded clip instead of the first.
    I think this would be a relatively easy thing for Adobe to fix.  I won't indulge any petty arguments about what Adobe should be fixing first, second or third.  That's for them to decide.  I'd rather spend my time and effort bringing up topics that others haven't yet.  Thinking outside the box is the only way for Premiere to evolve.

  • HT1414 I am restoring a new iPad, using iCloud, with all my old iPads info, it is taking forever, all day and I'm still only an 8th of the way there.  Is there any way to speed up all the game down loads or is there a way to re-organize my game icons manu

    I am restoring a new iPad, iCloud, with my old iPads info, it has been downloading all day and it's only 2pages in on my game apps out of about 10 pages.  Is there a way to speed this process, or is there a way to move my icons so that the games I want are at the beginning of the line as opposed to at the end because their name is alphabetically last

    There is no way that I know of to speed up the download. Restoring from an iCloud backup will take as long as it takes in order to download all of your iPads contents. You commited to iCloud and now you have to wait until everything finishes downloading.
    This relies on your WiFi connection speed, so unless you can speed that up, you just have to wait.

  • Is there any way to use -useLegacyAOT option in FlashBuilder 4.6?

    I need to build my ipa with old version of Engine because i have some problems about loading images from outside. Since with Air 15 it is default engine, and i cannot quit Air 15 because of the iTunes specs. I cannot add -useLegacyAOT=yes to compiler options on Adobe Flash Builder 4.6 because it seems that it can be added at FB4.7.
    So is there any way to add this options when i am using FB4.6
    Thanks in advance.

    DeepakJ wrote:
    Hi,
    Is there any way to use a control break on Dept column in a SQL query to have a Output-2 instead of Output-1.
    Is there any way to modify the SQL query.
    SQL
    select dept, loc, count(*)
    from dept
    group by dept, locOutput-1
    Dept      Loc       Count(*)
    10         AA        1
    10         BB        2
    10         CC        2
    20         AA        2
    20         BB        2Output-2
    Dept      Loc       Count(*)
    10         AA        1
    BB        2
    CC        2
    20         AA        2
    BB        2
    Yes, using the <tt>lag</tt> analytic function and specified ordering of the data:
    select
        nullif(d.deptno, lag(d.deptno) over (order by d.deptno, d.loc, e.mgr nulls first)) deptno
      , nullif(d.loc, lag(d.loc) over (order by d.deptno, d.loc, e.mgr nulls first)) loc
      , e.mgr
      , count(*) n
    from
        dept d
          join emp e
            on d.deptno = e.deptno
    group by
        d.deptno
      , d.loc
      , e.mgr
    order by
        d.deptno
      , d.loc
      , e.mgr nulls first;
    DEPTNO  LOC       MGR   N
        10  NEW YORK         1
                      7782   1
                      7839   1
        20  DALLAS    7566   2
                      7788   1
                      7839   1
        30  CHICAGO   7698   4
                      7839   1
        40  BOSTON    7698   2
                      7902   1

Maybe you are looking for

  • My MacBook Pro cannot connect to WiFi

         Hi guys. I have a MacBook Pro 15" which I got about two years ago. I'm using OS Lion 10.7. I didn't had any problems for two years but about a month ago our wifi had a little damage. So we bought another one, the same model. First none of the de

  • Laserjet 200 color mfp m276nw print black not grayscale

    I'm told the printer will print even black-and-white documents using "grayscale," which I'm told means it is using the color cartridges even to print black and white documents.  Is there some way I can change this so that it prints black and white do

  • Missing photo imports in iPhoto

    Hi all, here's my problem... I am missing a few days of photos that were previously uploaded to iPhoto, two months ago. I just opened iPhoto, and noticed they were gone. Here's what they are appearing as: I did a little research, and I cannot find an

  • Macbook Air Doesn't Connect To Wifi Upon Waking

    Since installing Yosemite, whenever I wake my Macbook Air from sleep, it doesn't connect to Wifi. In order to get it to work, I have to open up Network Preferences/Assist me/Diagnostics and go through that process (then it works). Any suggestions on

  • Problem changing scroll bar color using UIManager

    I am using the following code to change the color of a JScrollBar just before instantiating a JScrollPane: [ code ] //set colors UIManager.put("ScrollBar.thumbLightShadow", ltGrn ); UIManager.put("ScrollBar.thumb", grn ); UIManager.put("ToolBar.thumb