Use ContextPath to Access File

I am using JDeveloper 11.1.1.6
In my application I am providing print capability to print a Jasper report. Currently the .jrxml file is stored within a location on my C: drive. Ultimately I would like to get the file within the application so that it can be portable to any platform and so that the developer doesn't have to place the file in that specific C: drive location. All of the current functionality works fine.
So here is what I have done to move the file to the application. The .jrxml file is now stored in the following location within JDeveloper: "/Web Content/reportFormat"
I am using the following code to get the context path:
FacesContext lFacesContext = FacesContext.getCurrentInstance();
HttpServletRequest lRequest =
(HttpServletRequest)lFacesContext.getExternalContext().getRequest();
String lContextPath = lRequest.getContextPath();
String lReportFilePath = lContextPath + "/reportFormat";
The issue I am having is that the application at run time can't find my .jrxml file there. In fact ADF can't find that location. Could you please provide guidance on how to access the runtime location of the .jrxml file?
Edited by: 915963 on May 24, 2012 1:39 PM

Hi,
In my case, I put the jrxml files in a folder localized in ViewController/src/%NAME_FOLDER%. And in the java file, I did:
                FacesContext lFacesContext = FacesContext.getCurrentInstance();
                HttpServletRequest lRequest =
                (HttpServletRequest)lFacesContext.getExternalContext().getRequest();
                String reportFolder = "report";
          String path = "/WEB-INF/classes/" + reportFolder + "/"+relatorio.getNameReport();
                path = lRequest .getRealPath(path); //here is a magic
                //continue jasper processingRegards,

Similar Messages

  • Serialize tree in random access file

    I have a tree of objects, which are to be serialized. After deserialization,
    each object has to know its children and its parent. Each object need not know its sibling. There are no lateral references. The number of objects in the tree will be around 2000. The depth of tree is 7. Different parts of the tree will be saved and read at different points of time in the application. While the application is running, many of the objects in the tree keep undergoing changes which have to be saved intermittantly.
    I would like to use a random access file. But I have no clue how to serialize a tree of objects in a random access file which will meet the above mentioned requirements.
    I would be thankful if I could get an idea to implement.

    I have a tree of objects, which are to be serialized.
    After deserialization,
    each object has to know its children and its parent.
    Each object need not know its sibling. There are no
    lateral references. The number of objects in the tree
    will be around 2000. The depth of tree is 7.
    Different parts of the tree will be saved and read at
    different points of time in the application. This is an issue. When you Serialize something you serialize the entire object, not a part of it. If you're doing this then you're no longer talking about Serializing a Tree, you're talking about serializing some other thing that represents part of the tree.
    While
    the application is running, many of the objects in
    the tree keep undergoing changes which have to be
    saved intermittantly.
    I would like to use a random access file. But I have
    no clue how to serialize a tree of objects in a
    random access file which will meet the above
    mentioned requirements.
    I would be thankful if I could get an idea to
    implement.If you can come up with a "savable" representation of your tree that allows you to calculate where, in a file, a given part would be then you could use RandomAccessFile to read/write the thing. Just walk through your tree and seek to where you need to go in the file, then read/write the node.
    I hope that made sense
    Lee

  • I am trying to softproof an image using a CMYK .icc file. I sent an image from LR 5 to PS CC 2014, opened the Camera Raw FIlter, but the hyperlink to access workflow is not showing up in the CR dialogue box... Any ideas why this might be?

    I am trying to softproof an image using a CMYK .icc file. I sent an image from LR 5 to PS CC 2014, opened the Camera Raw FIlter, but the hyperlink to access workflow is not showing up in the CR dialogue box... Any ideas why this might be?

    I am trying to softproof an image using a CMYK .icc file. I sent an image from LR 5 to PS CC 2014, opened the Camera Raw FIlter, but the hyperlink to access workflow is not showing up in the CR dialogue box... Any ideas why this might be?

  • My DVR security sofware that I access remotely uses a "dvr .ocx" file....when I try it in Firefox , either the latest non beta (3.6.1.5) or the new beta version (4.0 rc) it will NOT work as it says the plugin is missing... it works in IE 8,but not IE9...

    My machine is Top of the range (my Company builds them so it had better be :) )
    Amd 1100t , 8gb ram , Windows 7 64 bit etc, etc...
    The is not a hardware problem , but a software problem with FF...Any help would be appreciated as I hate using IE 8 for anything at all :( but I have to keep it on my machines just to run my remote security cameras at my Computer shop ???
    Original question...as question length is limited ...not very bright that limit by the way :(
    "My DVR security sofware that I access remotely uses a "dvr .ocx" file....when I try it in Firefox , either the latest non beta (3.6.1.5) or the new beta version (4.0 rc) it will NOT work as it says the plugin is missing... it works in IE 8 (unfortunately) but not IE9...
    As I own a Computer company I am fairly computer literate but cannot find a plugin that allows this to work in Firefox.... but I would have expected it to work in the new Firefox :(
    All the best, Brett :)

    The longer this thread continues, the more ancillary comments you throw in that aren't directly pertinent to your problem with your DVR software not working with Firefox 4.0. Sorry, I don't intend to continue with this discussion.
    I do agree that ''something'' needs to be done better with regards to plugins for Firefox, but I do disagree with you as to whose responsibility that ''something'' is.

  • How can I access files from a flash drive that were previously saved using a Windows computer? When I attempt to open the file on MacBook Pro, it is asking to "convert file to"; I also have Microsoft Word installed on the Mac as well.

    How can I access files from a flash drive that were previously saved using a Windows computer? When I attempt to open the file on MacBook Pro, it is asking to "convert file to"; none of the options I choose work. I also have Microsoft Office (with Word) installed on the Mac as well.

    Format the external drive as FAT32 or ExFAT. Both computers will then be able to read and write to it.

  • Using VPN to access remote servers; copying files to desktop since "upgrading" to Mavericks no longer works. Can anyone help please?

    Hi everyone,
    I work remotely using Cisco AnyConnect (company provided) to access the company servers. Until "upgrading" to Mavericks I was able to copy files directly to my desktop – from either the servers themselves, from within Bridge, and/or by using the finder - you get the idea. Now I can only copy the files by opening them while still on the server using the native app (in my case mainly InDesign/Photoshop/Illustrator files) and saving them to my desktop that way.
    I'm a designer, I use a lot of files for my specific job every day and these files are often pretty large and doing it this way is time-consuming and really frustrating seeing as I had no such issues with the previous OS. It's not a total nightmare (yet) like some of things some of you are dealing with but I've spent more time restarting, freezing and trying to fix issues than I have actually using my darned machine. I have no choice but to access my work this way; I'm part of a much larger team and we all work on these files off and on during the day so I'm constantly needing to copy files and make sure I'm working on the most current version. Working off the server isn't an option as the speed decreases considerably... making the slightest task cringingly slow. As in 25 minutes for a PDF to be created slow.
    I've been used to my system running smoothly, without issues and fast so this upgrade is turning into a bit of a nightmare. Before I throw in the towel and try and downgrade, does anyone have any ideas? My technical knowledge where these things are concerned isn't beginner but I'm no expert  and I'm stumped. I just don't know where to start and I'm afraid of screwing something else up during the process of trying to fix this (so far) one issue and creating a snowball effect.
    I'm using a 27" iMac (late model 2012 purchased in March 2013) with a second Viewsonic monitor attached. I have a Cintiq 22HD hooked up (but not on all the time) and a Wacom tablet in use. I currently use both CS5 (work hasn't upgraded to CC yet) and Adobe CC (for personal use) on my system.
    Any help/ideas would be greatly appreciated!
    Thanks!
    G.

    Hi,
    By default, the Remote Desktop (RD) Gateway component that encapsulates RDP in HTTPS packets listens on port 443 (for TCP) and port 3391 (for UDP). After you changed the ports in Transport Settings tab, please make sure that you have opened the custom ports
    you selected in Windows Firewall.
    In addition, since you have mentioned the registry key, would you please share the entire path?
    It seems that you need to manually update the gateway in the RDP file with the port. Have you created an .rdp file? You can also refer to the link below:
    Create an .rdp file
    Best regards,
    Susie

  • Moved iTunes library to an ext hard drive to make space on my int drive... Followed steps from apple.  Now I cannot access my music... It says: "File could not be used because the original file cannot be found.  Would you like to locate it?"

    Moved iTunes library to an ext hard drive to make space on my int drive... Followed steps from apple.  Now I cannot access my music... It says: "File could not be used because the original file cannot be found.  Would you like to locate it?"
    I moved my iTunes library to my external hard drive some time ago and I followed the directions listed here on the apple support page.  It did copy my library and now is on my hard drive... I can open iTunes and use it to sync all of my devices but I would like to play my music... I can see all of my music files but can not play them if I click on an album or song it says the following:  "(file name) could not be used because the original file cannot be found.  Would you like to locate it?"  I click locate but do not know where to go from there?  I need a way to access all files and not to hunt down one at a time on my hard drive... I am pretty sure I deleted the original library to make space on my internal drive which was the reason for moving it.  I have tried and tried to fix it and do not have a lot of time to do so with a one and two year old at my house who do not like it whenI sit down at my computer.  What to do???  Any help is much appreciated!!!

    See Make a split library portable. Move all of the bits of the library together in the the correct shape and it should work. Or undo exactly what you did and then start over.
    If you're a former Windows user don't try merging two folders together that have the same name by dropping one into the same folders as the other, as that goes badly on a Mac.
    tt2

  • How do I access my encrypted User Account files from my Back Up hard drive?  Time Machine  was used to create the back up disk; File Vault was used to encrypt the files.

    How do I access my encrypted User Account files from my Back Up hard drive?  Time Machine  was used to create the back up disk; File Vault was used to encrypt the files.

    Thanks.  I will try going through TM.  Since my Simpletech is on the way out, I'll be plugging in a new external hard drive (other than the back-up drive) and trying to restore the library to the new drive.  Any advice or warning if this is NOT the right thing to do?
    Meanwhile, that is a great tip to do an alternate back-up using a different means.  It's been tough to figure out how to "preserve access" to digital images and files for posterity, knowing the hardware will always fail/obsolesce sooner or later, and that "clouds" are only as good as their consistent and reliable accessibility.  Upping the odds with redundancy will help dull the edge of my "access anxiety", though logically, it can never relieve it.  Will look into
    Carbon Copy Cloner.

  • After trying to change permissions on my computer so others on my network can access files, my external Hard Drive has a lock on it and I can't access files. I've tried repairing permissions, logging in under another Administrator account, using Terminal

    After trying to change permissions on my computer so others on my network can grab files, my external Hard Drive has a lock on it and I can't access files. I've tried repairing permissions, logging in under another Administrator account, using Terminal to fix the problem, downloaded BatChmod but nothing works… Any other suggestions? I have an Imac running OS10.6.8.

    There is suddenly a lock icon on my external backup drive!
    Custom Permissions

  • How to use Oracle SQL Developer 4.0 to connect to Ms Access file with .accdb extension

    Hi all,
    I am using Oracle SQL Developer 4.0 and Ms Access 2013 under Windows 7 (64 bits)
    After browsing and selecting MS Access file with accdb extention, I got  an error message  :[Microsoft] " Data source name not found and no default driver specified".
    On Administravitve Tools=> ODBC Data Source Administrator=>Drivers I have                                                File                                date
    Name :                                                                               Version
    Microsoft Acess Driver (*.mdb, *accdb)                                 12.00.4518.1014                                        ACEODBC.DLL                    26/10/2006
    Would you please advise?
    Thank you very much in advance

    That MS Access driver is 64-bit, I think.  If SQL Developer, or JDK is 32-bit you need to use the 32-bit driver.   You can see if you have a 32-bit driver installed using  c:\windows\system32\odbcadm32.exe

  • When in Windows 7 (using bootcamp obviously) I am able to see my files in my Mac partition. When I try to access them I am told that I need permission from the administrator. How do I give myself permission to access files between the two partitions?

    When in Windows 7 (while using bootcamp) I am able to see my personal files in my Mac partition. When I try to access them I am denied access, it tells me that I need permission from the administrator. How do I give myself permission to access files between the two partitions, Mac/Windows7?

    When in Windows 7 (while using bootcamp) I am able to see my personal files in my Mac partition. When I try to access them I am denied access, it tells me that I need permission from the administrator. How do I give myself permission to access files between the two partitions, Mac/Windows7?

  • Adobe Bridge shuts down when I try to access files on my external drive. Have been using the drive for months with no problems.

    Adobe Bridge shuts down when I try to access files on my external drive. Have been using the drive for several months with no problems.

    Due to the current unavailability of clairvoyants and mind-readers in the forum, we respectfully request you supply sensible, complete details.
    A lot more information about your hardware and software is needed.
    BOILERPLATE TEXT:
    If you give complete and detailed information about your setup and the issue at hand,
    such as your platform (Mac or Win),
    exact versions of your OS, of Photoshop (not just "CC", but something like CC2014.v.2.2) and of Bridge,
    your settings in Photoshop > Preference > Performance
    the type of file you were working on,
    machine specs, such as total installed RAM, scratch file HDs, total available HD space, video card specs, including total VRAM installed,
    what troubleshooting steps you have taken so far,
    what error message(s) you receive,
    if having issues opening raw files also the exact camera make and model that generated them,
    if you're having printing issues, indicate the exact make and model of your printer, paper size, image dimensions in pixels (so many pixels wide by so many pixels high). if going through a RIP, specify that too.
    a screen shot of your settings or of the image could be very helpful too,
    etc.,
    someone may be able to help you (not necessarily this poster, who is not a Windows user).
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • Using JNDI to access config file located outsite j2ee app

    Hi I'm wanting to store a config file for my J2ee app, somewhere on a tomcat server possibly inside the
    conf/ directory so that I can update this config file without having to redeploy the j2ee app every time a change is made.
    I've been told I can use JNDI to access this file, but I can't seem to find any examples or documentation on how I can do this.
    I'm new to JNDI and would appreciate any help, or suggestions.
    Thanks,
    Tim
    EDIT:
    So far I can access the file with this code:
    Hashtable env = new Hashtable();
              env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
              try {
                   Context ctx = new InitialContext(prop);
                   // look up context for name
                   //env.put(Context.PROVIDER_URL, "file:C:\\confluence\\confluence-2.5.1-std\\conf");
                   File f = (File)ctx.lookup("/confluence/confluence-2.5.1-std/conf/test.txt");My new problems are:
    1. The commented line env.put(Context.PROVIDER_URL, "file:C:\\confluence\\confluence-2.5.1-std\\conf"); it says in examples that this should set the dir to look in to the conf dir but if i change the lookup value to just test.txt it cannot find it.
    2. Can I somehow set the context to look into the conf directory of Tomcat without hard coding the path, as the path could change or be different on different machines??
    Edited by: Timothyja on Jan 15, 2008 7:00 PM

    Hi Kiran,
    Looking at the code you sent and the error, it looks like you should be casting the ds object to a javax.sql.DataSource object not a weblogic.jdbc.common.internal.RmiDataSource object.
    You may find some useful info at the following URL:
    http://edocs.bea.com/wls/docs81/jdbc/rmidriver.html#1026007

  • Open VDW files stored on file share using Visio Web Access

    Hi,
    Is it possiblwe to view VDW files that are stored in a file share using Visio Web Access in SharePoint?
    If so, how?
    Opening up a Visio Web Drawing stored in a SharePoint document library is straight forwards however I want to view a visio web drawing stored in a file system using the web access service.
    Hope I'm made myself clear.
    MDB

    Hi Jens,
    I will suggest you to call the support center, cause there are some bugs related to the issue you are having.
    http://www.cisco.com/en/US/support/tsd_cisco_small_business_support_center_contacts.html
    Regards.

  • How to use random access file to access file in disk?

    I have tried to use random access file stream to access the some files saved in disk, but not very successful. I want to know how I can find a particular file in the disk with file locator or sth else.
    Suggestion is highly welcomed, if you have codes to put, I will test it.

    The scenerao is:
    create a randomAccessfile
    write 100 blank records( for future use)
    open this file
    write data to the records inside file
    close the file.
    I will try to put a testing code for you later on.

Maybe you are looking for

  • Can I boot an internal hard drive through USB?

    I have an old 2008 Mac Pro running Snow Leopard 10.6.8 that just quit on me. When I boot up, I get to the apple logo and then the screen turns white and stays that way until I power off my machine. I have a few hard drives with operating systems inst

  • WHY FCS WILL NOT WORK WITH CANON XH A1, NOW, EVER, ANYTIME? HELLOOO APPLE?

    Well well. Trillions of dollars in Apple technology and canon ingenuity and yet these two behemoths of electronics and computer commercialism cannot create a simple easy to sue interface for a freaking Canon XH A1 camera. I have read forums, googled

  • Calling a webservice having an abstract element

    hi , I want to call a webservice which takes one element namely "data" as part of request info.But "data" is of abstract type and "EnterpriseData" is another element which is of type "data" . So when I form the request object as <mx:request> <data></

  • Photo info box?

    I'm using iPhoto. What do the two size listings (Mb) mean in the (i) - photo info box mean?

  • Installing new icc profiles on an Imac using CS6

    Can someone help, please, I am using CS6 on an Imac (new to mac) and I need to install some more icc profiles. I have tried unhiding the library/col sync/profiles folder and have installed them but cs6 print setup is still not showing them. I have al