Trigger open&edit file with tomcat WebDav from Java Applet - java

Currently i have a java applet (with tomcat 6 as backend) that allow users to upload file and download file for document sharing. However, many users forget to upload the edited file back to the server.
Hence, I would like to enhance the applet to allow user to choose a file* for edit and save directly to the web server. Without having the user to save the file to their local harddisk, and upload the file* back to server manually.
After a few goggling, it seems WebDav is the way. I have configure tomcat with the webdav enable in the web.xml, and now i can view file and edit with a Webdav client CyberDuck.
Questions:
is it possible view / edit / lock the file* without installing a webdav client?
Reason is because i have more than 3000 desktop client using the software. Deployment of the webdav is an issue and how do i let each user to access different webdav so they do not see each other's file?
Is it possible to trigger local application to open a file* inside WebDav?
file* = means any file that are able to open from their local machine; examples: ms word, ms excel, ms powerpoint, pdf, PNG, JPG, txt and etc.

Ah, i manage to open it with:
Runtime.getRuntime().exec("winword http://:/xyz/.../pgl_page-bi.doc");
Problem is, every single type of files will need to have a different string inside the .exec(""); not as clean as i expected but at least it works.

Related

Unable to access file in hard drive using Apache Tomcat server

I'm developing local-only JSP application using Apache Tomcat server. I would like to put a promotion videos on my intro page, but I don't want to move them to webapp folder or anywhere else.
The promotion videos are located:
E:\data\videos\2018...
But writing a JSP/HTML like this wont launch the video, but however it works off-server (launching html from desktop for example, so the path may not be issue?)
<video src="file:///E:/data/videos/2018/promotion1.mp4" controls></video>
Local file links from remote resources are disabled by almost all browsers by default. There are certain possibilities to overcome that, e.g.:
http://kb.mozillazine.org/Links_to_local_pages_do_not_work
https://discourse.mozilla.org/t/opening-links-to-local-files-file/16449/2
To access your static media files from remote page you need to configure your Tomcat server as described here: http://teknosrc.com/access-local-files-static-content-images-videos-media-files-outside-web-application-system-apache-tomcat-server/
solution:
a.) make sure your server is on the same system where the media files are.
b.) If so, you have to create a folder (ex. media) in your application folder inside /src/main/webapp/ and have to put all media files inside a media folder. After that, you can surely access the media files through a server.

Weblogic : How to Download/Upload files from front-end (File Store ?)

I have a web application running on Weblogic 12c using Java7 as backend and angularjs in front end.
I want to be able to download/upload one (pdf) file from it.
The basic user cases are :
The user can click on a button to download the file.
The user can click a button and pick a local file, this file will then be uploaded and replace the previous one as the downloable file.
There will only be one file.
I've tried to find a solution online and I ended up creating a File Store (with a direct-write policy).
But I haven't found how to download the file when using my application.
Also, I'm not sure this solution will work for my upload case.
How can I et up my application to download/upload this file ?
Filestores are a wholly different concept, used to store JMS messages. Don't let the name confuse you, this is not a usecase for filestores.
Consider this Q for handling the file upload: How to upload files to server using JSP/Servlet? - and save the file on a folder in the filesystem. Your WebLogic 12c installation supports servlet 3.0 annotations.

Local File Access via Web-Application

I have a web-application that I want to have the ability to read a file from a specific directory on the users PC (and send this file to a remote DB via some REST call) - and vice-versa, get this file from the remote DB and write to the users PC in this specific directory. Besides an Applet, what are some of the more common / secure ways of achieving this?
Unfortunately, this is not possible using a web-application. The browser will not allow this - as it represents a security breach on the client side.
You will need explicit permission from the user to upload a file onto the server - most web-applications use a file upload mechanism - which is a manual process.
You could, however use HTML 5 Web Storage, which is similar to cookies, but allows the browser to store key value pairs.
From what I understand, an applet is a Java program which is run outside of the browser on the client machine - which is therefore able to read / write to the local machine.
Hope this helps.

Java - File parsing vs fetching html over http

We have a Java class that is supposed to fetch an HTML file and then read some content in it based on the id of certain divs and then return the content to a frontend which will then render it.
Now we have a set of HTML files on a common file system somewhere on the network. Multiple applications will access it. It is like a homegrown GUI help guide for our customer facing screens with a centralized storage.
We have managed to load the html file in 2 ways
Start an Apache web server and put all html files in htdocs. The calling Java class then makes an http call http://someIP:80/helpguide/userguide.html #firstname. This will fetch the help guide related to FirstName field on the screen. The Apache service has to be managed as it is accessed in Live but only accessible within our network.
Create a Shared directory and grant access to it to the Windows logon used to run the Windows service that runs Tomcat where the client facing web application is deployed. Then the Java client class uses new File("<file location>") to load the file and read its content. This works as well.
Basically we have 2 ways to load the html file. Now we are confused whether to use route 1 or 2?
The html files won't be that massive and will be of reasonable size. It may have inline css or youtube video links embedded in them.
Downside of (2) is if we want to include images later it won't work while it should work with (1).
However in terms of performance and efficiency how are teh 2 approaches different? (1) will open a Http socket connection over port 80 and get the html stream back. WIth (2) It will possibly use a File Inputstream to get the file on the server.

J2EE: file access from web server.

I am trying to develop a J2EE web application which reads files from the local machine. The user will be able to enter a path where the file exists and when a button is clicked, the file is read and a database should be uploaded. This feature works fine when I tested it locally, but when I moved the code to the web server, it is not able to find the file. This is because the application is trying to find the file at the server and not the local machine. Could some one please let me know if there is any way I could read the file from the local machine?
I ve been using struts/tomcat for developing this application
Thanks
An option: Check out this Rose India article
Another option: do a google search for "file upload jsp"
try
<input type="file"/>
It is impossible to read a file on a remote computer without sending it to the server... obviously!
Local file access is usually permitted if you run the browser App from the local file system, and not thru an Web server.

Categories

Resources