Get path to folder on server

Hi. I've got the following folder structure for my servlet,
-data
  -webapps
    -testApp
       -uploads
       -WEB-INF
          -com
             -mycompany
                -packageName
                   -UploadHandler.class
    -secure
       -gift_imgI need to tell the server to store a file that it receives via the UploadHandler class at this location, /data/webapps/secure/gift_img/. How do I give that path to the servlet? I've tried this:
String uploadDir = this.getServletContext().getRealPath("../secure/gift_img/");but it blows up with an InvalidArgumentException error when it tries to do the ImageIO.write() method. If I give it a path inside the app ("/uploads/"), it writes the file OK. How do I reference the folder outside of this app? Thanks.

So... you are assuming that getServletContext().getRealPath gives you a path that ends with webApps but instead ends with testApp

Similar Messages

  • C# Getting path of folder that is created in Visual Studio and it's located in app directory.

    Alright i created folder that will contain video resources for my app.But now i need to connect it with my code.I need to get file path of folder that i created in Visual Studio,but it needs to work on other machines.I tryed Path.Combined(Environment.GetCurrentDirectory
    + @"Video\Lekcija1.mp4") but it didn't work.Any suggestions?

    If you set the Build Action of the Lekcija1.mp4 file to Content (right-click on the file in the Solution Explorer in Visual Studio) and the Copy To Output Directory property to Copy always or Copy if newer you could use the following code to get the absolute
    path to the file:
    string codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
    string fullPath = System.IO.Path.GetDirectoryName(codeBase) + "\\Video\\Lekcija1.mp4";
    Hope that helps.
    Please remember to mark helpful posts as answer to close your threads and please start a new thread if you have a new question.

  • How to get path of image from server side in form of URL

    Hello,
    I want to access images stored on server side local folder. How do I create a URL for that. Images in the folder changes dynamically, so I should be able to display the new modified images. Please help me.
    Thanks in advance

    Are you asking from client side to access server (local folder) images...
    if yes
    where the security goes....
    please be in detail...

  • How to get path or parent folder

    Hello
    I'm overriding method extendedPreAddRelationship on class S_Relationship.
    My purpose is to check whether the document is being put in the correct path or not.
    I can get folder name and document name using following code:
    AttributeValue av;
    av = def.getAttribute(Relationship.LEFTOBJECT_ATTRIBUTE);
    S_PublicObject folder = (S_PublicObject) av.getPublicObject(this.getSession());
    av = def.getAttribute(Relationship.RIGHTOBJECT_ATTRIBUTE);
    S_PublicObject document = (S_PublicObject) av.getPublicObject(this.getSession());
    What I need is the whole path (or at least the parent folder). Can I get path somehow? Or should I try to search parent folders?
    Jaska

    My purpose is to check whether the document is being put in the correct path or not.Hi,
    I had a similar problem - I needed to compare the path of current folder with path from parameters. Because I wasn't be able to get the path of folder, I did it in reverse way, comparing the folders. To get folder from path I needed getRootFolder method, which wasn't in server-side classes, so I extend S_TieFolder class:
    * Analogy of LibrarySession.getRootFolder().
    public static S_Folder getRootFolder(S_LibrarySession session)
    throws IfsException
    S_Folder folder = null;
    try
    Collection c = session.getValueDefaultCollection();
    S_ValueDefault vd = (S_ValueDefault)c.getItems("RootFolder");
    AttributeValue av = vd.getPropertyValue();
    folder = (S_Folder)av.getPublicObject(session);
    catch(Exception e)
    throw new IfsException(21020, e, session);
    return folder;
    In extendedPreAddItem method of S_TieFolder:
    S_Folder paramFolder = (S_Folder)getRootFolder(session).findPublicObjectByPath(folderPath);
    if( this==paramFolder ) ...
    Radek
    [email protected]

  • Getting path of parent folder of a file during a workflow execution

    How can I get the parent folder/directory of a file during the execution of a workflow? I cant't find any actions i Automator that will give me this.
    I want to make a general applicable automated workflow. The path can not be hardcoded in the workflow as different files and folders will be worked on each time the workflow is run.
    The input to the workflow is a file or list of files. I want to be able to retrieve the path of the parent folder of these files at runtime.
    Will I have to do this through AppleScript? If so, then how?
    (in case you have seen my first post on this; it seems I wasn't specific enough so people didn't understand what I want to do. Therefore this second post. Sorry for the iconvenience)

    Hi anilsen!
    If all selected files are within the same folder, it would be like this:
    For example:
    • Get Specified/Selected Finder Objects
    • Run AppleScript
    on run {input, parameters}
    tell application "Finder"
    set output to (container of item 1 of input) as alias
    end tell
    return output
    end run
    Spazek

  • How to get the system32 folder path in java?

    how to get the system32 folder path in windows using java code?

    Zstar Electronic Co.Ltd, Wholesaler of fire cards for DS/NDSL/NDSi, Provide R4, R4i, DStt, iEDGE, AK2i,M3,M3i,N5
    www.zstar.hk

  • TS5376 I did as this article described.  The download was going smoothly until I got this error message "Click OK or enter alternate path to folder in installation package containing the file itunes.msi"   Where can I get "itunes.msi"  ??

    I did as this article described.  The download was going smoothly until I got this error message "Click OK or enter alternate path to folder in installation package containing the file itunes.msi"   Where can I get "itunes.msi"  ??

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • Getting image path from database( Remote server)  & display in jsp page

    hai frnds,
    i have one doudt regarding in my web application Development
    . I want to Getting image path from database( **Remote server**) & display in jsp page here iam forwarding my control through Servlets
    how this will passiable
    Thanks in Advance
    SonyKamesh
    [email protected]

    hai
    I think ur doubt will be...
    1) Getting a Image From Remote Server( & U stored a only path name in Data Base)
    2) Image r stroed in saparate Drive( Not in Webroot-- where u Created domine )
    Please Any Help Will be Appriciated
    [email protected]
    Edited by: Sonykamesha on Dec 18, 2007 11:02 PM

  • How to get crawler destination folder path through api

    with following code i am getting crawler folder source path
    com.plumtree.openfoundation.util.IXPPropertyBag propertyBag = oPTCrawler.GetStartLocation();
                   String oldFolder = propertyBag.ReadAsString("PTC_UNIQUE");
    how to get the destination folder path ?
    any help appreciated

    i would like to get the values from PT_TAX_DESTFOLDERS
    <A N="PT_TAX_DESTFOLDERS"><I N="DIMS">1</I><I N="MAX0">0</I><I N="0">1324</I></A>
    1324 being the folder id
    when trying
    com.plumtree.openfoundation.util.IXPPropertyBag propertyBag = oPTCrawler.GetStartLocation();
                   Object[][] propertyBags = (Object[][])propertyBag.ReadAsObject1DArray("PT_TAX_DESTFOLDERS");
    i am getting null

  • Need help with error on Lion Server (kernel: add_fsevent: unable to get path for vp ..)

    I have had some Xsan issues and one of my volumes kept failing. I did a complete hard reboot of the entire system after trying all the cvfsck options. Now the volume seems to be ok but I am now getting the following errors and can not figure out what they are. Any help to a new Admin would be greatly appreciated.
    5/7/12 1:59:13.000 PM kernel: add_fsevent: unabled to get a path for vp 0xb129000.  dropping the event.
    5/7/12 1:59:15.000 PM kernel: add_fsevent: unable to get path for vp 0xb12a4d0 (live.0.indexHead; ret 22; type 4)
    5/7/12 1:59:15.000 PM kernel: add_fsevent: unabled to get a path for vp 0xb12a4d0.  dropping the event.
    5/7/12 1:59:15.000 PM kernel: add_fsevent: unable to get path for vp 0xb129de0 (live.1.indexHead; ret 22; type 4)
    5/7/12 1:59:15.000 PM kernel: add_fsevent: unabled to get a path for vp 0xb129de0.  dropping the event.
    5/7/12 1:59:15.000 PM kernel: add_fsevent: unable to get path for vp 0xe3964d0 (live.2.indexHead; ret 22; type 4)
    5/7/12 1:59:15.000 PM kernel: add_fsevent: unabled to get a path for vp 0xe3964d0.  dropping the event.
    5/7/12 2:01:22.024 PM mdworker32: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
    5/7/12 2:01:22.525 PM com.apple.mdworker.pool.0: PSSniffer error: Invalid argument
    5/7/12 2:01:24.697 PM mdworker: FontImporter: Validation failed - "/Volumes/Matilda/Dexter/Randy project - Burke update/James E Burke Awards video revision/Past Video files/ETH742/tricyclestudios (After FX) Jeremy/Assets/FUTURA_4.TTF".
    5/7/12 2:01:24.697 PM mdworker: FontImporter: Validation Result - "(
        kATSFontTestSeverityFatalError
    Then I got a few more of the errors like the top lines.
    Please help!!
    Thanks,
    Kevin Rosenthal

    Turns out there were disk issues that I repaired by rebooting into Lion Recovery Mode (restart, hold Command-R during startup) and running Disk Utility. Disk Utility reported:
    Volume bitmap needs minor repair for orphaned blocks
    Invalid volume free block count
    It fixed both problems and the drive then verified clean.
    While I was there, I also repaired permissions, though I doubt that the permission oddities were the cause of the errors.
    After rebooting into normal Lion, two things happend:
    Time Machine quite happily went back to work and took a backup, no issue. Several hourlies have run since then, no problems.
    Spotlight did some re-indexing. This caused some hangs (spinning beachballs) at first, but it self-cleared. It definitely didn't last long enough to re-index the entire drive; I'm guessing that it needed to re-index some of the repaired sections.
    So far as I know, no files were corrupted -- but the drive is about 80% free space, so odds are that the orphaned blocks were not in a critical area.

  • F4 help for file path in the Application server

    Hi All,
    i want to provide the F4 help so as to enable us to give the file path in the application server (AL11). I'm in version 4.0
    Regards
    Shekhar

    Hi
    Copy paste the following code and see the result
    Here you can see 2 types of open dialogs
    1. Directory View
    2. File View
    Use any one as per your requirement.
    DATA : l_filetable TYPE filetable,
           l_rc TYPE i.
    DATA: l_folder TYPE string,
          l_file TYPE string.
    PARAMETERS: p_folder(100) TYPE c,
                p_file(100) TYPE c.
    *Provide a Dialogue box for getting a folder path
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_folder.
      CALL METHOD cl_gui_frontend_services=>directory_browse
        EXPORTING
          window_title    = 'Select Folder Path'
          initial_folder  = 'D:\'
        CHANGING
          selected_folder = l_folder.
      p_folder = l_folder.
    *Provide a Dialogue box for getting a file path
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title      = 'Select a Text File'
          initial_directory = l_folder
        CHANGING
          file_table        = l_filetable
          rc                = l_rc.
    Reward points generously
    Regards
    Akshay Chonkar
      READ TABLE l_filetable INTO p_file INDEX 1.
      CHECK sy-subrc <> 0.

  • Failed to get the Availability State on server Distriubtionpoint1 for role SMS Distribution Point

    Distriubtionpoint1-- Server share distribution point
    Distriubtionpoint1-- Acting as site system role (DP)
    Distriubtionpoint1--attached under the primary PR0 (Primary server0)
    Primary server0-- reporting to CS0 (central site 0)
    Distriubtionpoint1-- Windows 2008 sp1 r2 standard
    Infrastructure details:-
    =============
    Distriubtionpoint1 located in different domain with one way trust.
    1) Check ping status with FQDN from both domain and it is success.
    2) Check port 135, 445, 80,443 through telnet from both domain and success.
    3) Primary Server0 account is member of the local admin group on Distriubtionpoint1.
    4) Check the PR0-SCCM-DP$ folder NTFS & Share permission
    Share permission
    a) everyone & local admin group has full control
    Security permission
    a) System has full permission
    b) user has read & exec
    4) Local admin full
    Sitestat.log error message:
    ---->: Failed to get the Availability State on server
    Distriubtionpoint1 for role SMS Distribution Point. SMS_SITE_SYSTEM_STATUS_SUMMARIZER 4/22/2014 9:00:15 PM 952 (0x03B8)
    ---->: Now polling via NAL for SiteObject "["Display=\\Distriubtionpoint1\PR0-SCCM-DP$\"]MSWNET:["SMS_SITE=PR0"]\\Distriubtionpoint1\PR0-SCCM-DP$\" SMS_SITE_SYSTEM_STATUS_SUMMARIZER
    4/22/2014 9:00:15 PM 952 (0x03B8)
    for ["Display=\\Distriubtionpoint1\PR0-SCCM-DP$\"]MSWNET:["SMS_SITE=PR0"]\\Distriubtionpoint1\PR0-SCCM-DP$\, no connection account is available SMS_SITE_SYSTEM_STATUS_SUMMARIZER
    4/22/2014 9:00:15 PM 952 (0x03B8)
    ---->: The NAL path ["Display=\\Distriubtionpoint1\PR0-SCCM-DP$\"]MSWNET:["SMS_SITE=PR0"]\\Distriubtionpoint1\PR0-SCCM-DP$\ is currently not accessible. SMS_SITE_SYSTEM_STATUS_SUMMARIZER
    4/22/2014 9:00:18 PM 952 (0x03B8)
    Info>: Unable to get available space for the Site Object ["Display=\\Distriubtionpoint1\PR0-SCCM-DP$\"]MSWNET:["SMS_SITE=PR0"]\\Distriubtionpoint1\PR0-SCCM-DP$\ SMS_SITE_SYSTEM_STATUS_SUMMARIZER
    4/22/2014 9:00:18 PM 952 (0x03B8)
    STATMSG: ID=4701 SEV=I LEV=M SOURCE="SMS Server" COMP="SMS_SITE_SYSTEM_STATUS_SUMMARIZER" SYS=Distriubtionpoint1 SITE=PR0 PID=4112 TID=952 GMTDATE=Wed Apr 23 01:00:18.002
    2014 ISTR0="\\Distriubtionpoint1\PR0-SCCM-DP$" ISTR1="\\Distriubtionpoint1\PR0-SCCM-DP$" ISTR2="2014 04 4 17 04 31 31 000" ISTR3="" ISTR4="" ISTR5="" ISTR6="" ISTR7="" ISTR8=""
    ISTR9="" NUMATTRS=0 SMS_SITE_SYSTEM_STATUS_SUMMARIZER 4/22/2014 9:00:18 PM 952 (0x03B8)
    for ["Display=\\Distriubtionpoint1\PR0-SCCM-DP$\"]MSWNET:["SMS_SITE=PR0"]\\Distriubtionpoint1\PR0-SCCM-DP$\, no connection account is available SMS_SITE_SYSTEM_STATUS_SUMMARIZER
    4/22/2014 9:00:18 PM 952 (0x03B8)
    ---->: GetOperationsManagementData failed to connect to ["Display=\\Distriubtionpoint1\PR0-SCCM-DP$\"]MSWNET:["SMS_SITE=PR0"]\\Distriubtionpoint1\PR0-SCCM-DP$\; error
    = 5. SMS_SITE_SYSTEM_STATUS_SUMMARIZER 4/22/2014 9:00:20 PM 952 (0x03B8)

    I have tried to access the server share DP from the primary server by using my user
    credential. Yes I can able to access the share.
    But when I use the system credential to access the share received an error message as shown in below screenshot
    Hence i have provided the share and ntfs permission administrators, system, everyone,
    primary server account with full control on both tab. but still i am receiving error message.
    :\temp>whoami
    US\prasath
    c:\temp>dir \\PrimaryServer1\SCCM-DP$
    Volume in drive \\PrimaryServer1\SCCM-DP$ is Data
    Volume Serial Number is 22F0-661B
    Directory of \\PrimaryServer1\SCCM-DP$03/17/2014
    03:33 PM <DIR> .03/17/2014 03:33 PM <DIR> .
    04/01/2014 08:04 AM <DIR> SMSPKG
    0 File(s) 0 bytes
    3 Dir(s) 514,625,064,960 bytes free
    ===========================================
    C:\Windows\system32>whoami
    nt authority\system
    C:\Windows\system32>dir
    \\PrimaryServer1\SCCM-DP$
    Access is denied.

  • Get-ACL Error Continuation and Server List

    Hi All,
    I'm conducting an audit of all folders on network shares that are spread accross several servers.  I'm very new to PS but from my research I have put together the following:
    Get-ChildItem \\server\share -Recurse | Where-Object{($_.psiscontainer)} | Get-Acl | select-object path -expandproperty access | Export-CSV results.csv
    This has been working ok but I hit an 'unauthrosied operation' error when it trys a folder that I do not have permissions to (i'm running as domain admin).  That's fine but it's a termination error which I can't seem to work around.  I have tried
    things like -ErrorAction SilentlyContinue but it just stops without producing the error and will not continue.  I have also tried a try and catch which I found on Technet but can't seem to get the -recurse to work:
    $fse = Get-ChildItem \\server\share -recurse | Where-Object{($_.psiscontainer)}
    $fse | %{$f=$_; try { get-acl $_.FullName } catch { Write-Warning "Failed to access $($f.FullName)" }}
    I've tried my best to get the code to continue after the error but I just can't see what I am doing wrong.  Any ideas?
    Also, I have many many shares to test which are all listed in a spreadsheet.  I'm been trying to research how I can use this spreadsheet instead of writing in the server and share for every one I want to test.  However this is now going way above
    my head and I can't get anywhere near to a semi-working example.  Is there a way I can use the above to reference a spreadsheet and test each share that is listed?
    Many Thanks.

    OK I have got it to run by using
    try
    Import-csv .\test.csv | % {Get-ChildItem $_.Servername -Recurse -ErrorAction Stop| Where-Object{($_.psiscontainer)} |
    Get-Acl | select-object path -expandproperty access | Export-CSV results.csv }
    }Catch{
    $_.Exception
    continue;
    However it still terminates when it gets to a folder it does not have the permission to access the ACL.
    I'd add a separate ForEach-Object call for each object returned from Get-ChildItem. Does this work?
    Import-Csv .\test.csv | ForEach-Object {
    Get-ChildItem $_.Servername -Recurse | Where-Object { $_.PSIsContainer } | ForEach-Object {
    try {
    $Path = $_.FullName
    $_ | Get-Acl | Select-Object Path -ExpandProperty Access
    catch {
    # You can ignore this, write a warning, send this to a separate file, etc
    Write-Error ("Error calling Get-Acl on '{0}': {1}" -f $Path, $_.Exception.Message)
    } | Export-Csv results.csv
    That will simply write any errors to the screen. Is that good enough, or did you want to store them somewhere?

  • How to get the enclosing folder of an Application?

    Ok. re-visiting my Applescript to compare installed apps versus a list of predefined apps... here is my test code so far:
    set appsPath to (path to applications folder)
    tell application "Finder"
      set appList to name of every application file of entire contents of folder appsPath
    end tell
    set theApps to {"iMovie.app", "Microsoft Excel", "Microsoft Excel.app", "Adobe Acrobat 7.0 Professional.app", "Adobe After Effects CS4.app", "ColorEyes Display Pro.app", "Corel Painter X.app", "DiskTracker 2.3.2", "EPSON Scan.app", "Flash 8.app", "Product Ingest.app", "Product Tag.app", "Art Ingest.app", "TextWrangler.app", "Toast Titanium.app", "Suitcase Fusion 2.app", "Suitcase Fusion 3.app", "Fetch.app"}
    repeat with anApp in theApps
      set vers to version of (application anApp)
      -- get parent path of anApp!!!!
      if (parentFolder is equal to "Applications" or parentFolder is equal to "Utilities") then
      set parentFolder to ""
      end if
      display alert anApp & ": Version: " & vers & " " & parentFolder
    end repeat
    The only thing I'm stuck on is how to get the parent folder of anApp. Basically we use several versions of software here that are not easily identifiable by the version attribute. However their enclosing folder has all the versioning info I need (e.g.: MS Excel 04's vers would be 110113, but the enclosing folder is "Microsoft Office 2004", and some departments get Office 2008, Office 2011, etc., so I need a human-friendly way to get the right versions)
    I don't know if the "if" statement to check whether the parent is Applications or Utilities is correct as I haven't gotten that far in testing. I'm only interested in getting the parent of apps that have parent folder that is a sub-folder of Applications or Utilities.
    Basically what I am trying to do here is write a text file containing all departmental apps, homefolder sizes, relevant partition sizes, etc. and spit it out at the tech responsible for migrating a user to a new mac (display alert is just convenient for testing purposes). In the past we've had too many "missed" items in QC like wrong apps installed, or wrong versions, or data not copied over properly, etc. So this way they can run this on the old system beforehand and the new system after, line everything up and check off if it matches. This is just a snippet...
    TIA!
    Andrew

    Hi,
    Andrew Caldwell wrote:
    Is there a way to invoke these without the script opening each one?
    You must use the bundle identifier instead of the name
    Here a example :
    set theApps to {"com.microsoft.excel", "com.adobe.Acrobat.Pro", "com.barebones.textwrangler", "com.roxio.Toast", "com.fetchsoftworks.Fetch"}
    repeat with anApp in theApps
           tell application "Finder" to tell (application file id anApp)
                  set vers to version
                  set parentFolder to name of its container
           end tell
           if parentFolder is in {"Applications", "Utilities"} then set parentFolder to ""
           display alert anApp & ": Version: " & vers & " " & parentFolder
    end repeat

  • How to get path to file variable with applescript

    I've tried:
    `set file_path to path of myfile`
    but it's giving me error:
    `error "Finder got an error: Can’t get path of document file ..."`

    Code is:
    set theFolder to (choose folder with prompt "Select the start folder")
    set file_list to every file of theFolder
    repeat with myfile in file_list
        set file_name to name of myfile
        set file_path to path of myfile
        log (file_path & "/" & file_name as string)
    end repeat

Maybe you are looking for

  • How do I use camera raw?

    Hi, I've only recently moved from PC to Mac and have been used to editing my raw Canon pics in camera raw before saving them down in Elements. I've just tried to download Camera Raw and I think this has happened successfully (it shows up as a folder

  • IdeaPad S10 loud beep upon insertion/removal of power cable?

    Hello All, New poster here, just received my S10 and love it. My only issue is with the fact that every time I insert or remove tyhe power cable the system speaker beeps, loudly. This seems rather counterintuitive for a netbook, which is generally a

  • Tomcat Setup Problems

    I am setting up Tomcat in an attempt to complete the Java Server Pages Fundamentals tutorial. I am new to JSP so please bear with me. I have followed the directions for installing Tomcat and referenced posted topics in the forum archives with no succ

  • How to update IOS on iphone 4

    In the guide at the apple site its no true on iphone 4. I was hoping to update my software...

  • CS6 Dreamweaver Slowdown

    Dreamweaver CS6 has been working well for me until just the other day. In the middle of my work day Dreamweaver started getting very sluggish (and showing the rainbow wheel) when changing between DW windows. When the slow down happens 'Activity Monit