To Read the contents of the properties file which is located in webserver

Hi,
I have one requirement where I have to read the contents of a property file which is located in some path in server. Say for example, when you click on link abcd then contents of abcd.properties file should be displayed in one text view in webdynpro . I am trying to implement this in webdynpro for java. The main thing is like I am not able to retrieve the server path of the file and hence not getting the file contents. I tried using methods like  getApplicationPath() or getRealPath() but its not working. So can you guys please help me on to how to read the server file contents.
Thanks and regards,
Sai

Hi Romano,
Thanks a lot for your reply. However, I forgot to mention one thing in my question. Its like the path will be different everytime. Say, we have systems like development, acceptance, production. So when the user clicks on the link abcd, it should take the path of development system and similarly when the user clicks on the link in acceptance or production, the path will be different. say for example, in development the path will be
usr/cluster/dev/abcd.properties but it acceptance it will be usr/cluster/acc/abcd.properties. So just want to know whether this will work? Anyway, I will give this a try.
Thanks once again,
Sai

Similar Messages

  • Read the content of a properties file

    I have a properties file(.properties), which has contents in this format:-
    [1]TYPE=4
    [1]ENABLED=TRUE
    [1]Caption = "Kozos"
    [1]URL=https://kozos.com/access
    I want to display the value of url for kozos and when i try below code, i get an error :- 
    ConvertFrom-StringData : Data line 'D:\kozos.properties' is not in 'name=value' format. 
    Clear-host
    $FileName = "D:\kozos.properties"
    $file_content = $FileName -join [Environment]::NewLine
    $configuration = ConvertFrom-StringData($file_content)
    $environment = $configuration.'kozos'
    Write-host "Environment is $environment"

    The data you initially gave had more than that (Type and Enabled) which is what I was going on. From what I understand, you only want the Caption and associated URL available? Do you actually need the numbers from the file ([1],[2], etc...)? Here are a couple
    of alternative approaches (which may be changed depending on your feedback regarding my questions).
    $Configuration = [pscustomobject][hashtable](ConvertFrom-StringData (((Get-Content .\kozos.properties) -replace '\[.*\]') | Out-String))
    ($Configuration | Where {$_.Caption -match '"kozos"'}).url
    $Configuration = (ConvertFrom-StringData (((Get-Content .\kozos.properties) -replace '\[.*\]') | Out-String))
    $hash = @{}
    $Configuration | ForEach {
    $hash[($_.caption -replace '"')] = $_.url
    $hash.Kozos
    Others may have alternative approaches to this as well.
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book
    Boe,
    I want only the Caption and the url associated with it. I ran your code, this is the error i got :-
    ConvertFrom-StringData : Data item 'TYPE' in line 'TYPE=14' is already defined.  
    THis is what the properties contains :-
    [1]TYPE=4
    [1]ENABLED=TRUE
    [1]Caption = "Kozos"
    [1]URL=https://kozos.com/access
    [2]TYPE=4
    [2]ENABLED=TRUE
    [2]Caption = "Kozos1"
    [2]URL=https://kozos1.com/access
    [3]TYPE=4
    [3]ENABLED=TRUE
    [3]Caption = "Kozos"
    [3]URL=https://kozos.com/access and
    goes till 100.
    I apologise for not mentioning this on top.

  • Unable to display the Content of a data file from within another data file in Oracle webcenter portal.

    We have a Content Presenter taskflow. This task flow is added to a jspx page. The taskflow fetches the content from the contributor data file. The contributor data file is having a WYSIWYG editor. The content of the WYSIWYG editor is being displayed correctly through the task flow.
    We have some links in the WYSIWYG editor. These links again point to some data files. When we click on these links from within the portal, then we are getting a blank page(the url of this blank page is: http://localhost:7101/eWSIBPortal/faces/oracle/webcenter/sitestructure/render.jspx?datasource=UCM%23dDocName%3AWSIB_ARTICLE) and not displaying the content of the data file that we are pointing to from the WYSIWYG editor.
    We want to display the content of these data files(which we have pointed from WYSIWYG editor) in-line within the portal.
    Please help us to resolve this issue and let us know if any information is required from our end.

    Thanks for reply. However, can I use XSQL to dump the formated text to a file? or just can display to client through web browsers?

  • How to retrieve data from an Excel file which is located on server

    hi everybody,
                    I am using SAP NWDS 2004s .     
                I have done an application on how to export the table data into an Excel .
    Now i want to get the data from an Excel file which is located in server and display that data which is in excel in a View for example a Sample view in Webdynpro  .
    In Sample view i took a uielement textview to display the data ....   
    can any one help how to procced further
    Thanks in advance
    Madhavi

    Options to read Excel data to WebDynpro context
    Reading Excel Sheet from Java without using any Framework
    Reading Multiple Sheets of Excel Sheet from Java
    Few Threads
    How to Display the content of Excel file into Webdynpro Table
    Is it possible to upload data from excel file(.xls)
    Re: How to export the data as integer into excel sheet?
    regards
       Vinod

  • Can we Read/Display the content of Word/PDF file  in Flex 3/4 ?

    Hello All,
    Can we  read/display the content of Word/PDF file in Flex 3 or Flex 4?.  I have one word file containing  Arabic  and English content with some settings like  Bold, Color, Align etc. I want to display the content of this word file as it is in the flex web application.
    Awaiting for prompt reply.
    Thanks and Regards

    thank you for your immediate reply, but,
    sorry, this does not work.
    With this code:
    <cfpdf action = "read" source = "dok_1.pdf" name =
    "mypdf">
    <cfdump var="#mypdf#"/>
    I get this result:
    Everything, but no text of the document.
    PDFDocument
    Application name of application
    Author bimbam Verlag GmbH
    CenterWindowOnScreen [empty string]
    ChangingDocument Allowed
    Commenting Allowed
    ContentExtraction Allowed
    CopyContent Allowed
    Created D:20080710
    DocumentAssembly Allowed
    Encryption No Security
    FilePath [empty string]
    FillingForm Allowed
    FitToWindow [empty string]
    HideMenubar [empty string]
    HideToolbar [empty string]
    HideWindowUI [empty string]
    Keywords [empty string]
    Language [empty string]
    Modified [empty string]
    PageLayout SinglePage
    Printing Allowed
    Producer [empty string]
    Properties [empty string]
    Secure Allowed
    ShowDocumentsOption [empty string]
    ShowWindowsOption [empty string]
    Signing Allowed
    Subject [empty string]
    Title Rheinische Angler-Zeitschrift
    TotalPages 1
    Trapped [empty string]
    Version 1.3
    Maybe i do not understand the cfpdf tag the right way.
    What i want is a kind of pdf-to-text conversion.
    Do I have to use the processddx action? I do not think so.
    But there is a property DocumentText .. ?

  • How to read the content of a text file (by character)?

    Guys,
    Good day!
    I'm back just need again your help. Is there anyone knows how to read the content of a text file not by line but by character.
    Please help me. Thank you so much in advance.
    Jojo

    http://java.sun.com/javase/6/docs/api/index.html
    package java.io
    InputStream.read(): int
    Reads the next byte of data from the input stream.
    Implementation:
    InputStreamReader
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted.

  • Help on how to read the content of an XML file from the payload

    I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
    I’m trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
    In the Bean I want to read the content of the attached XML file, it could be the “order number”.
    The filename should then be “Order number”.XML.
    <u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
    <i><b>Frank</b></i>

    hi,
    check this: http://jakarta.apache.org/poi/

  • Can a search engine read the contents of a Library file embedded in a page?

    Can a search engine read the contents of a Library file
    embedded in a page? Or would SSI be the way to go. I'm creating a
    large library of text-based information and links, and I want to
    have much of it modular so I can add a link and all the many pages
    on my site updates to reflect the change. A big concern is that
    when a search engine visits my site, can it read the content
    embedded in the library item, or is SSI a better method to help the
    search engine read my content?
    Thanks

    Yes, search engines can read Dreamweaver library items. The
    library only exists on your own hard drive. Once you add the
    library item to your pages it's in there as regular HTML.
    If you have more than 20 pages on your site, they say SSI is
    better, because when you update you only update the SSI. If you
    stick with library items each page has to be uploaded every time
    the library is updated.

  • Issue in reading the contents of the file

    Hi all,
            How to read the contents of a text file and assign it to a single context variable and sent it to database I am using File upload control to upload the file. Up to my thing file upload control will give us the path of the file. We need to get the url and read it from it. If i am wrong please correct me and give suggestion to solve this.
    Thanks in advance.

    On UPLOAD click do this:
      public void onActionLoadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionLoadFile(ServerEvent)
         WDWebResourceType FileType = null;
         String FileName = new String();
              //get attribute info for context attribute 'FileUpload'
              IWDAttributeInfo attributeInfo =
                   wdContext.getNodeInfo().getAttribute(
                        IPrivateEmailView.IContextElement.FILE_UPLOAD);
              //get modifiable binary type from the attribute info,requires type cast.
              IWDModifiableBinaryType binaryType =
                   (IWDModifiableBinaryType) attributeInfo.getModifiableSimpleType();
              IPrivateEmailView.IContextElement element =
                   wdContext.currentContextElement();
              //if a file in the 'FileResource' attribute exists
              if (element.getFileUpload() != null) {
                   try {
                        String mimeType = binaryType.getMimeType().toString();
                        byte[] file = element.getFileUpload();
                        //get the size of the uploaded file
                        element.setFileSize(this.getFileSize(file));
                        //get the extension of the uploaded file
                        element.setFileExtension(binaryType.getMimeType().getFileExtension());
                        //NOTE: context attribute 'FileName' must not be set
                        //because the FileUpload-UI-element property 'fileName'
                        //is bound to it. Consequently the fileName is automatically
                        //written to the context after file upload.
                        //report success message
                        wdComponentAPI.getMessageManager().reportMessage(
                        IMessageEmailComp.SF_UPLOAD,
                             new Object[] { binaryType.getFileName()},
                             false);
                        FileType = binaryType.getMimeType();
                        FileName = binaryType.getFileName();
                   } catch (Exception e) {
                        throw new WDRuntimeException(e);
              //if no file in the 'FileResource' attribute exists
              else {
                   //report error message
                   IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
                   msgMgr.reportContextAttributeMessage(
                        element,
                        attributeInfo,
                        IMessageEmailComp.NO_FILE,
                        new Object[] { "" },
                        true);
              //clear the FileResource context value attribute
              //element.setFileUpload(null);
              String URL;
              URL = this.CreateAndGetPathFileUpload(
                                  wdContext.currentContextElement().getFileUpload(),
                                                      FileName);
    //          if (URL.length() == 1){
    //               //ERROR
         wdContext.currentContextElement().setPATHFileUploaded(URL);
        //@@end
      private String CreateAndGetPathFileUpload(byte[] FileUpload, String FileName){
           String URL = new String();
         try {
              FileOutputStream fos = new FileOutputStream(FileName);
              fos.write(FileUpload);
              fos.close();
         } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
         } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
         File fl = new File(FileName);
         URL = fl.getAbsolutePath();
           return URL;
    Forgot the method that give you the URL file.
    Message was edited by: Roberto Tagliento

  • How to read the content of this excel file in LV

    Hi could you please let me know how can I read the content of this excel file using the Read From Speardsheet function. It contains text and numbers
    Thanks
    The excel file is attached
    Attachments:
    Datalogging.zip ‏307 KB

    Check attached VI.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Attachments:
    ReadFromExcel.vi ‏27 KB

  • How to read the content of ms-word file use pure java???

    how to read the content of ms-word file use pure java???

    hi,
    check this: http://jakarta.apache.org/poi/

  • How to read the contents in the excel file on the basis of colunm heading?

    Hi,
    Here is my requirement like that  in excel file i got the customer number , amount etc....
    And my required fields are customer and amount. In file customer nr is under the heading 'CUSTOMER' and amount is under the heading 'AMOUNT'.
    Is there any FM for reading the contents under the colunm heading of excel?
    Please suggest me.
    Thanks,
    Harshal kulkarni

    Hi Harshal ,
    I dont think there is such function module /BAPI/Class-Method .
    but if your excel file is dynamic you can write your own logic using field - symbols.
    Regards ,
    Praveen

  • How to read the contents of the Uploaded file ?

    hi @,
    I have used the File upload and Download UI elements as per the tutorial available. Now my requirement is to read the contents of the file and transfer it to the Backend system.
    How can I achieve the desired fucntionality.
    Thanks in advance,
    Regards,
    Amit

    try this code to store image file in back end system.
    IWDResource res=wdContext.currentMyDataElement().getPictureres();
              InputStream in=res.read(false);
              ByteArrayOutputStream bout=new ByteArrayOutputStream();
              int length;
              byte[] part=new byte[10*1024];
              while((length=in.read(part))!=-1)
              bout.write(part,0,length);
              in.close();
    pstmt.setBytes(8,bout.toByteArray());
    If it is other than image file like word or text then try this in action
    IWDResource resource = wdContext.currentResElement().getResorce(); // your existing handle to the upload resource type
                try {
                   InputStream stream = resource.read(true);
                   byte b[]= new byte[1000];
                   stream.read(b);
                   String str = new String(b);
                   int i=str.length();
                   wdContext.currentContextElement().setOut(str);
                   wdContext.currentContextElement().setSize(i);
                   wdContext.currentResElement().setResourceurl(
                        wdContext.currentResElement().getResorce().getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    The in back end field where u store the file should be byte array.
    Regards,
    H.V.Swathi

  • Error in reading the contents of a zip file

    EHello Experts,
    I want to read the contents of a zip file.I have written the following program which reads the contents of a file named "index.xml" which resides in ReadZip.zip.My problem is , it is reading only the first line of that file & after that it is giving this error.
    java.io.IOException: Stream closed
    at java.util.zip.ZipInputStream.ensureOpen(ZipInputStream.java:43)
    at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:67)
    at components.ReadZipFile2.main(ReadZipFile2.java:26)
    public class ReadZipFile2 {
        public static void main(String args[]) {
            try {
                FileInputStream fis = new FileInputStream("C:\\ReadZip.zip");
                ZipInputStream zis = new ZipInputStream(fis);
                ZipEntry ze;
                while ((ze = zis.getNextEntry()) != null) {
                    System.out.println(ze.getName());
                    if (ze.getName().equals("ReadZip/index.xml")) {
                        long size = ze.getSize();
                        if (size > 0) {
                            System.out.println("Length is " + size);
                            BufferedReader br = new BufferedReader(
                                    new InputStreamReader(zis));
                            String line;
                            while ((line = br.readLine()) != null) {
                                System.out.println(line);
                            br.close();
            } catch (IOException e) {
                e.printStackTrace();
    }It seems that zis is getting close after reading the first entry of file.I am unable to guess the reason for this.Please help.Thanx in advance.

    [redacted confused advice]
    [_Compressing and Decompressing Data using Java - with many code samples_|http://java.sun.com/developer/technicalArticles/Programming/compression/|Yes Virginia, there really are code samples]

  • Text editor used to type the contents of the properties file

    ******To all those (expect iainsinclair) who view this message - Sorry for using this forum for my personal contacts **********
    Hi iainsinclair
    Thanx for explaining ur experience to me for my previous posted topic . U did mentioned a text editor called NETBEANS PROPERTY TEXT EDITOR .
    * Can u please explain more about this editor . Is this editor specific to some encodings ....
    * U said that as u enter the Japanese characters in ur keyboard the editor saves the characters in the unicode format. Are the characters displayed in their glyphs or as \u????.
    * Can u give me a list of languages f or which this text editor can be used . Bcoz u had suggested that it can be used for chinese also .
    * I need more info about a Japanese Computer and keyboard. I think we both are in the same level in this topic I18N . Iam working for I18N project in my company. This is my official mail ID- [email protected] .Can u send me ur mail Id so that we make sure that this forum members are not disturbed by our discussion .

    Hi, I'm happy if I can help.
    * Can u please explain more about this editor . Is this editor specific to some encodings ....
    It's the netbeans IDE from www.netbeans.org it's a free integrated development environment for java. It includes many editors, for .java files, .properties files and many others. It is designed to accept text in the non-ascii format and convert it for use in properties files.
    * U said that as u enter the Japanese characters in ur keyboard the editor saves the characters in the unicode format. Are the characters displayed in their glyphs or as \u????.
    They are saved as ascii characters, not glyphs. For example, I entered MSGothic (MS&#12468;&#12471;&#12483;&#12463;) in japanese using net beans and it looks like this when I use a normal text editor: MS\u30B4\u30B7\u30C3\u30AF
    * Can u give me a list of languages f or which this text editor can be used . Bcoz u had suggested that it can be used for chinese also .
    It should work for any language that your windows/linux system has support for (need the right fonts for a start). My system is native japanese, so I have all the required japanese fonts installed. If you want to use (for example) Chinese on an English system, you'll have to get the fonts and probably you will need to modify the jre/lib/font.properties file.
    * I need more info about a Japanese Computer and keyboard. I think we both are in the same level in this topic I18N . Iam working for I18N project in my company. This is my official mail ID- [email protected] .Can u send me ur mail Id so that we make sure that this forum members are not disturbed by our discussion .
    I don't think it's disturbing anyone. Forums are all about sharing information, and there is a lack of experience of I18N in the broader comminity, I feel. This isn't a busy forum... ;-)
    Don't forget to look for the article written by John O'Conner called 'Displaying Text' I don't have the URL handy but it was posted on this forum recently. It's required reading.

Maybe you are looking for