In java controller of Spring web app, I create a report and write it to AuditReport.html. The write works ok and when I search for the file, I find it in /home/emm/Oracle/Middleware/user_projects/domains/base_domain/AuditReport.html.
I want to write it to some place that I will be able to download it with a download link.
In Eclipse I modify the weblogic.xml file so it contains a Virtual Directory Mapping entry. Local path is set to "/app/config". In that folder I created "download" folder. I add URL Pattern of /download/* to we
In the jsp file I have link like this
<a href="download/AuditReport.html" download>Export Report</a>
When I click it in Chrome I see it trying to download it but then says "Failed - No file"
Any suggestions?
you mention the file is getting generated at /home/emm/Oracle/Middleware/user_projects/domains/base_domain/AuditReport.html
where are you mapping /home/emm/Oracle/Middleware/user_projects/domains/base_domain/ to your virtual directory ?
Related
I have a desktop application which uploads files to an upload servlet. I want that uploaded files to be saved into a folder outside Tomcat, which is already mapped.
The url for the mapped folder is: "localhost:8080/MyApp/documents".
Physical path for the mapped folder is: /Users/gyo/Documents/MyApp/documents
Probably I'm making a newbie mistake but I would like to know: Is it possible to save the files in the mapped folder? If yes, how can I do that since servletContext.getRealPath("") is returning me the full path where the app is deployed?
Here is a link that explains how to upload files in Java running on tomcat and spring. Look for permissions on that folder "ls -ltr /folder-path/" to see owner and write permissions.
http://www.gingercart.com/Home/java-snippets/upload-images-java-code-example
Also look at java policies set on Tomcat for file/folder permissions at $CATALINA_BASE/conf/catalina.policy
I currently have an application that downloads files from a server and by default they are stored under /storage/emulated/0/ . I set it up so they download to a folder called "data". The files successfully download and unzip to /storage/emulated/0/data/unzipped , however, when I try to load an html file, stored under the data folder, into a webview, I get an error saying the file can't be found. I double checked the file path of the html file using Astro File Manager and was able to verify I have the right file path. Here is the statement I use to load the html file into the webview.
wb.loadUrl(Environment.getExternalStorageDirectory()
+ "/data/unzipped/output.html");
I have tried it with and without the .html extension and still no luck. Any ideas? Are there are restrictions on accessing the emulated storage?
File paths are not URLs. Use the file:// scheme to access files.
How can I programmatically find the path of JNLP file?I am using Java Web Start to generate the JNLP file.
I know that manually you can find the JNLP file in the Java Cache Viewer in Resources with the name launch.jnlp, but I really need to know if there exists a Java class that can programmatically find the jnlp file by searching the in-memory cache.
How can I programatically find the path of JNLP file?
It is hidden deliberately. If you can find it from within code (shorting of asking the user to browse to it), the JRE has a security bug.
..for launching the installer I need the application jar files path
No you don't.
Put the installer inside a Jar.
Add the Jar to the resources of the app.
Get an URL using getResource(String).
Read the byte[] and write it to a temporary file at a known location (e.g. java.io.tmpdir).
Launch the installer from the known location.
String jnlpPath = System.getProperty("jnlpx.origFilenameArg");
I am working on reports. Now I have a jrxml file which I have to load so that I can parse it. However, the problem is, I want to load the file with its name directly
String path = "myreport.jrxml";
But I am unable to find that where should I place that file in my project so that the above path is valid. In simple java project, we just place our desired file in our project folder where src folder is placed, but it is not working in vaadin project. So where should I place my file.
Thanks.
Are you deploying your project to a web server? Then you would need to find out what is the default working directory of that web server.
You could use:
JRXmlLoader.load("/myreport.jrxml");
or if you want to test if the resource is found and take another tries you could load it as a resource and pass it load method from JRXmlLoader as follows:
JRXmlLoader.load(getClass().getResourceAsStream("/myreport.jrxml"));
i want to download folder containing files like pdf,jpg,png etc from web services.I have written a application that can download pdf,png file.But i want to download folder containing several files. So my question is- is it possible to download folder and if yes then how can i download folder from server in android. thank you
If you can download one file, why wouldn't you be able to download several? Create the folder on Android, queue the files and start the next download when the current is finished, filling the folder. Also Android supports ZIP, so that might be your best call.
Folder is nothing but an FILE but a different type of file. Once you get the folder you can list down the files in it. You already have URL with the folder, u just need to append the URL of the folder to the files in it and download them one by one.