Getting Application root directory name dynamically

hi all,
For some reason I need to get Application root directory name dynamically
and use it somewhere.
Im using resin and default app dir is "doc" i've another directory "abc" and set
that as application root directory.
So from jsp i need to get the application root directory name.
thx in adv,
kiran

http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/ServletContext.html#getRealPath
use the following in you jsp
<%=application.getRealPath("/")%>this will give you the application root directory.

Similar Messages

  • How to get the current application root directory

    Hi Experts,
    I am deploying an ADF Application to a Standalone WLS 10.3. During development I am using Integrated WLS (which comes with JDeveloper 11.1.1.5.0). During development, I configured my application to create log files in my local machine (where Integrated WLS is running) by using absolute path for my log file. Now, I am moving to a standalone instance of WLS for testing (before moving to production).
    Now I need to keep my log files under my application root directory. Please let me know how to get the absolute path of the deployed application root directory from WLS ENV/System property into my application's Java Code.
    I tried the below java code,
    Current weblogic server name is: " + System.getProperty("weblogic.Name") --> This gives me the name of the server where my application is running.
    Current weblogic server name is: " + System.getProperty("weblogic.Root") --> This returns NULL. How to get the Root directory of my application using some system property inside my application at runtime??
    Thanks
    Rathnam

    One method is to create a File(""); and do getPath() on it.
    At least it's worked for me.

  • Getting XI business system name Dynamically

    Hi All,
    I am using RFC lookup for one of our project requirment. we will be using one of our inputs as business system which hosts the RFC function module (RFC_READ_TABLE). in our dev it is our XI business system. But when we move these objects to quality or prod, this mapping fails because the name of the XI business system changes. Can anyone suggest me how we can get the xi system name dynamically.
    Best Regards,
    Deepika

    Hi Deepika
    You can use the function "Sender" or "Receiver" (depending upon whether your business system is sender or receiver) which is available under 'Constants' category in Standard funtions of Graphical mapping.
    These functions give the current value of the businees system in the environment where the interface is running.
    Let me knwo if you are still not able to pick it.
    Thanks
    Ram

  • Get the root folder name once user will upload any files to subfolder with in this root folder using sharepoint designer WF??

    Hi,
    How to get the root folder name using sharepoint designer WF? i have a document library with root folders and subfolders. so i am trying to get the root specific root folder name attaching with email once user will
    upload any files to subfolders within that root folder.
    Thanks in advanced!

    Hi,
    According to your description, you might want to get the root folder name in SharePoint Designer Workflow when there is file uploading.
    The “Path” field of the current item holds the relative path of a file, as a workaround, you can retrieve the value of the “Path” as string, then split the string
    value with a delimiter character of “/” to meet your requirement.
    In SharePoint Designer 2010, there is no OOTB action to split the string. You can use the custom workflow actions below to achieve it.
    Here is a link about the related actions I use in this scenario:
    https://spdwfstringactions.codeplex.com/
    Settings of workflow as below:
    It works well in my environment:
    Best regards
    Patrick Liang
    TechNet Community Support

  • Websphere Application Root Directory

    I installed the Websphere application server ( Community Edition ) on my windows machine. I'm trying to figure out the application root of the server. Can someone please help me out with this?
    Installion directory is C:\IBM\WebSphere\AppServerCommunityEdition
    Thanks.
    GT

    i have the same problem but it give me error in for the Local Application server root directory.
    my input was :
    1.Deploy Type = Single Server
    2. Server Instance = server1
    3. Host Name : localhost
    4. soap port : 8880
    5. admin user id : given
    6. password : given
    7. local application server root directory =D:/Program Files/IBM/WebSphere/AppServer/
    i try input in the host name the ip and try the machinename but also can't proceed.
    Any HELP will be Appreciated.

  • Get filename and directory name during runtime

    Hi guys,
    I am developing a file to file interface without content conversion, just a simple file transfer from one ftp server to another. I have to read the same filename (invent.txt) from multiple folders (mstransfer/M01/IN1, mstransfer/M02/IN1, mstransfer/M03/IN1....) that represent different stores and transfer it as it is with the same name to exactly the same directory name in the target ftp location.
    My problem is found inside a dummy mapping that I have created in order to specify the target directory and the name of the file. I am doing the following:
    A) A Java UDF to specify the filename
    trace = container.getTrace();
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    String filename = conf.get(key);
    trace.addWarning("filename = "+filename);
    conf.put(key, filename);
    return "";
    //return filename;
    B) A Java UDF to specify the directory name
       //write your code here
    trace = container.getTrace();
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","Directory");
    String directory  = conf.get(key);
    trace.addWarning("directory before = "+directory);
    directory = "/usr/sap/trans"+directory;
    trace.addWarning("directory after = "+directory);
    conf.put(key, directory);
    return "";
    //return "/usr/sap/trans"+directory;
    In receiver file adapter I do not specify neither a filename nor a target directory.
    When I am testing it, I always get a mapping runtime error.
    Any ideas?
    --Evaggelos

    Guys,
    First of all, I am doing an end to end testing, i.e. I let the FTP adapter pick the file up and another FTP adapter delivers the file to target folder. I am definitely not testing the mapping in mapping editor.
    I get the error in Request message mapping (pipeline step, which I can see in SXMB_MONI transaction) which is a dummy mapping between two message types that I have created and are based on two data types with two fields each.
    The UDF's that I have created go in-between the source and target fileds of the message types/data types.
    The error that I see in the trace section of the XML message in SXMB_MONI is the following:
    "<Trace level="1" type="T">RuntimeException during appliction Java mapping com/sap/xi/tf/_MM_G_SRS_FileTransfer_MNS_</Trace>
      <Trace level="1" type="T">java.lang.NullPointerException at com.sap.aii.mappingtool.tf3.AMappingProgram.exceptionCaught$(AMappingProgram.java:59) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException(Transformer.java:182) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:149) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:102) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:91) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at"
    I have included some trace.addWarning() lines in Java code to help me debug my code, but I cannot see them anywhere inside the trace to be getting executed.
    I will try Bhavesh's idea and I will write the code in the Java Section of my message mapping ( either Intialization or Destrcution ) section.

  • Get domain root directory programmatically

    hello,
              There is any way to get the domain root directory path programmatically ??
              i.e : D:\bea\user_projects\domains\platformR1
              thanks

    John,
    OK. If you want to go the JMX route, have a look at the CurrentDirectory attribute of the ServerRuntime mbean. It would report your directory as this:
    C:\bea\user_projects\domains\myDomain\.
    Mike
    Weblogic/J2EE Security Blog: http://monduke.com

  • Impdp: looks right, but still getting ORA-39087: directory name invalid

    This is fairly mysterious, particularly since I've done this many other times without problems.
    I created the directory C:\OracleImportTest on the server's filesystem, created a corresponding directory object DP_DIR in Oracle, and granted my user read and write access to it. I've been staring at it and trying different things all morning, but I still get the following results:
    C:\test>impdp cgernon/**** DIRECTORY=dp_dir SERVICE_NAME=test1 DUMPFILE=export.dmp LOGFILE=import.log
    Import: Release 11.1.0.6.0 - Production on Friday, 27 May, 2011 12:01:08
    Copyright (c) 2003, 2007, Oracle.  All rights reserved.
    Connected to: Oracle Database 11g Release 11.1.0.6.0 - Production
    ORA-39002: invalid operation
    ORA-39070: Unable to open the log file.
    ORA-39087: directory name DP_DIR is invalid"But Mercurial!" you say, "surely you screwed something up setting up the directory and either it doesn't exist or you don't have access to it!" I would be the first to agree that is the most likely cause of the problem, but performing the following queries to double-check leaves me in a state of complete confusion:
    select * from all_directories;
    OWNER DIRECTORY_NAME DIRECTORY_PATH
    SYS   DP_DIR         C:\OracleImportTest                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
    select * from user_tab_privs where table_name = 'DP_DIR';
    GRANTEE OWNER TABLE_NAME GRANTOR PRIVILEGE GRANTABLE HIERARCHY
    CGERNON SYS   DP_DIR     SYS     READ      NO        NO       
    CGERNON SYS   DP_DIR     SYS     WRITE     NO        NO        Does anyone know of any other conditions that can trigger this error, or see anything I'm missing here? I am thoroughly mystified. Thanks!

    Good suggestion, but I'm still getting the same error ... using that command, as typed above.
    HOWEVER, changing the command as follows works:
    impdp cgernon/****@test1 DIRECTORY=dp_dir DUMPFILE=export.dmp LOGFILE=import.logWhich brings up another question. In the past, I've used the SERVICE_NAME option to specify the TNS Name for the database instance I want to connect to. Is that not what this option actually represents? And if not, why was it working for me in the past?
    At this point, I guess my original problem is resolved, but if anyone can explain the SERVICE_NAME option to me, I would appreciate it - thanks!

  • How to get the root tag name

    I have a problem: I receive several XML files in my transaction input
    <?xml version="1.0" encoding="UTF-8"?>
    <NAMES>
    </NAMES>
    <?xml version="1.0" encoding="UTF-8"?>
    <VALUES>
    </VALUES>
    and I want to obtain the root tag name (the string NAMES, VALUES, ecc.).
    I obtained this result using a XSL transformation, bui I think that the best (and easiest) way is to use an XPath command. I tried but I can not find the right command.
    Does anybody know how to do this?

    I found it:
    Transaction.Source{name(/*)}

  • Get application path directory

    hy,
    i'm trying to create a plug-in that run an application located in the same directory of the plug-in file.
    If i do
    system("./Rec.app/Contents/MacOS/AlbumExpressRecord");
    the application search the file in my home directory.
    Is there a function in the SDK that say me wath is the path of Photoshop directory???
    Thank you

    An FSSpec is the best we can do? Please tell me there's a way that doesn't use deprecated types and supports 64-bit? (Sorry, that's more of a rhetorical question to Adobe than directed at you).
    #if __LP64__
    typedef struct SPPlatformFileSpecification { /* this handles unicode file names */
    FSRef mReference;
    }  SPPlatformFileSpecification;
    #else
    typedef struct SPPlatformFileSpecification { /* Various things are casting this to FSSpec, so make sure the layout matches */
    /** The version number. */
    FSVolumeRefNum vRefNum;
    /** The unique identifier. */
    SInt32 parID;
    /** The file name string.  */
    StrFileName name;
    } SPPlatformFileSpecification;
    #endif
    typedef struct SPPlatformFileSpecificationW { /* this handles unicode file names */
    FSRef mReference;
    } SPPlatformFileSpecificationW;
    So I guess we only get modern types if we're 64 bits. I haven't touched an FSSpec in the last 8 years...

  • How to get immediate parent directory name of a file

    Hi,
    I have file Object that points to a file. I want to know how I can get just the name of the parent immediate to the file For example, if the path of this file is, c:\\ProgramFiles\first\second\third\myFile.txt
    In the above, how can I obtain the last directory in which myFile.txt resides ?
    Thanks
    Sangeetha

    File myFile = new File("c:\\ProgramFiles\\first\\second\\third\\myFile.txt");
    File parentFile = myFile.getParentFile();
    String parentDirectory = parentFile.getName();
    System.out.println("Parent directory is "+parentDirectory);Here's the explanation...
    1) New File is created
    2) File.getParentFile returns the immediate parent of the current File, which happens to be a directory.
    3) File.getName() returns the name of the File, without the entire directory structure.
    Hope this helps :)
    Simon

  • How to get the root directory of a domain?

    I have a domain setup at
    C:\bea\user_projects\domains\myDomain
    I have tried the following;
    Getting the domain object : get attr DomainConfiguration from DomainRuntimeServiceMBean
    Get root dir : get attr RootDirectory from domain object
    It returns ".", but I need the full path.
    Is there an issue with the RootDirectory from domain object or in my approach?

    John,
    OK. If you want to go the JMX route, have a look at the CurrentDirectory attribute of the ServerRuntime mbean. It would report your directory as this:
    C:\bea\user_projects\domains\myDomain\.
    Mike
    Weblogic/J2EE Security Blog: http://monduke.com

  • Get the class attributes name dynamically?

    Hi all,
    I have to call a transformation and give it as result parameter an internal table with ABAP_TRANS_RESBIND_TAB type.
    How can I get the name & the adresse of the current class parameters ?
    Thanks.
    Edited by: Noureddine MOUTAA on Oct 20, 2008 2:01 PM

    I have to call a transformation and give it as result parameter an internal table type ABAP_TRANS_RESBIND_TAB.
    And to fill this internal table, I need the name and the reference of the attribute
    I mean by REFERENCE the result of this instruction GET REFERENCE OF, as shown below:
    DATA: attribute TYPE string.
    DATA: the_reference TYPE REF TO data.
    GET REFERENCE OF attribute INTO the_reference.
    Thanks.
    Edited by: Noureddine MOUTAA on Oct 20, 2008 4:37 PM

  • Dynamic directory name in Receiving File adapter

    Hi,
    In File to File senario, In receiving system i want to create directory name dynamically. In my mapping there is a field called name, the directory name in the receiving system will be value in the name field. Any one can help me how to do this one...
    Thanks
    Rao

    Hello,
    Please follow the below to achieve the same.
    input - Store number,
    UDF
    String dynaname = input;
    DynamicConfiguration conf = (DynamicConfiguration) container
    .getTransformationParameters()
    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION );
    DynamicConfigurationKey key = DynamicConfigurationKey.create(
    "http://sap.com/xi/XI/System/File","FileName");
    conf.put(key,dynaname);
    return "";
    UDF mapping
    Source[input]   -
    > UDF -->    Rootnode of target structure.           
    Hope it helps.
    best regards,
    raj.

  • Obtaining root directory of web application

    Hi all.
    I am beginer in web application developing. You probably know how it is. Problem after problem:)
    So I started developing in JSF using NetBeans 6.0 with Tomcat 6.0.14 and i have the folowing problem:
    How can I programically get the root directory of my web application? I need it because I use some kind of filter, which redirects to error page, when unauthorized user tries to access protected resources. This error page is in root directory of my web application and has commandLink to logging site (action is set for method, which returns some string and navigation is defined for this string in facesconfig.xml), which is also in root directory. When I want to access for example /restricted/user/userPage.jsp and I am not logged in, the error page is displayed, but command link does not work. I supose the is a problem in current directory which is probably set for /restricted/user/.
    Thank You for any clues.
    Regards,
    Jahn Gurda

    Hello!
    I am also new to web applications and JSF. But I can tell you that its a little hard to programically achieve the security you want to achieve i.e. displaying some error page if the user is not logged in, however you can do it relatively easily using web.xml or sun-web.xml files by defining some roles, filters etc.
    I read that somewhere, try searching on Google...I have not implemented that myself.
    As far as obtaning the root directory of web application is concerned you may try following in your button_action method or any where in Page Bean class:
    ServletContext theApplicationsServletContext = (ServletContext) this.getExternalContext().getContext();
    String rootPath = theApplicationsServletContext.getRealPath("/");Then use "rootPath" where ever you want, it contains the path of the root directory.
    It atleast works for me.....
    Its strange that no one has answered this query for so long. Hope someone does early, I also want the clear answer.
    Thanks!
    Edited by: T.B.M on Oct 20, 2008 12:45 AM

Maybe you are looking for

  • Federation/Distributed Model for SAP PI

    Hello Folks, To begin with this is in reference to an insightful blog by Niki Scaglione - Decentral Adapter Engine is Mandatory! We have been planning to consider having a distributed model i.e to have our central instance (PI 7.3 dual stack) running

  • How do I print multiple (4) photos on one page with a border around each?

    How do I print multiple photos on one page with a border around each? I've gone the contact sheet route and adjusted the number of columns but there's only outer margins and very little white space between the photos down the middle of the page.

  • D2K (Reports 3.0) installation in Win NT

    During installation of D2k reports3 in Win NT i getting the follwoing error. pl advice me to resolve this problem. Your current oracle home C:\ORANT is in OCSM client installation managed by your systems administrator you may not install or remove pr

  • How to read a Zip file in PL/SQL program

    Hi, I was Reading a ".csv" file from a web URL eg. "www.aba.com/zxc.csv" in my PL/SQL procedure using UTL_HTTP package and loading data in my DB. Now that file is in .zip format, is there any way that I can still read that .csv.zip file through my PL

  • In a 2-webserver environment, what about the hostnames in custom components?

    When you create a custom component like a form, Portal creates a stored procedure for that component which builds the component at runtime. If you change your hostname, you have to regenerate or recompile that code. How do you get around that problem