I have a WEB-application which implements Java Applet technology. Java applet itself is opened from WEB-app and it is a FTP-client which semi-automatically(pre-configured IP, un, pw...) gets a file list from a FTP-server and user selects a file to transfer.
In Applet, the file is downloaded via FTP and then streamed through HTTPS to the WEB-app.
This functionality now needs a replacement as the Applet are no longer supported by majority of the browsers.
My own thought is that this function would be replace with JNLP. As JNLP cannot be embedded into "same session", the upload phase to WEB-app must be implemented differently.
I've been thinking that WEB-app would provide an one-time upload URL which would receive the file and then continue processing it.
What other possibilities I have and what would you recommend?
If you want less to no code changes, go with JNLP, otherwise, refactor the view (if your using MVC) to use modern java web technologies such as Servlets, JSPs or JSF.
Related
I have a dynamic web project in eclipse. It has html files, Css file, js files, java files, jsp files, and etc. It also is connected to an oracle database, which the dynamic web project inserts, updates, deletes and shows data into webpage. The web project works fine in eclipse IDE, and can run it on the external web browser.
I need to take the dynamic web project and put it on the desktop, such as a shortcut icon. So, i want to be able to open the web project from the desktop and be able to run directly on the web browser, like chrome. The reason is I need to send that web project to other users to test, and see if what changes needs to be made. The users do not have eclipse on their systems. Is there a way I can send them the app. as a desktop application?
If not, Can anybody help me on how I can do it on my local system?
For the run of web_application with some jsp-files you need to have one servlet container as Tomcat or Jboss, Wildfly e.t.c. This container must be for you available over the network ( mayby official IP-Address is necessary). Then you can access to URL of your web-application with your local browser and observe the work of your application. With the icon and one link you can start the web browser with your required URL too.
My Java web application needs to serve up many static HTML reports.
The reports are generated on-demand using a 3rd party application based on user's inputs. The reports will always be different from run to run, so they can't be cached. The reports include multiple HTML pages (including JS and CSS pages), and relative links between files.
What's the easiest way to serve up these reports to the front-end user?
The reports don't need to stick around -- they can be deleted after a set time or after the user logs out.
I'm using:
Tomcat 7
Spring framework
Here is a similar example:
Suppose the web app is an online IDE, and you'd like to occasionally generate and display Javadoc pages for the project.
I would personally use a web server, such as Apache, to do this, since my Java applications are always behind Apache. Here is an Apache example:
# Serve /path/to/html/files/ with static files stored at /var/path/to/files/
ProxyPass /path/to/html/files/ !
Alias /path/to/html/files/ /var/path/to/files/
# Proxy / to Java application at localhost:8080
ProxyPass / http://localhost:8080/
If you must use a pure Java solution, you could try to set up a file download servlet, such as this one by BalusC. Just be careful about handling file paths supplied in request urls, as the servlet can be vulnerable to directory traversal attack.
Hey I'm beginning my journey with JSF and Java i have question in this subject.
Question:
Is it possible to load and use xhtml that is not actually stored inside a war file but somewhere outside? I'd like to store it in a database or eventually on a FTP server. Can i register it as a resource in JSF.
I am not sure about the Database part but there are some interesting approaches for connecting to NAS drives (which can serve as FTP location also).
If you are deploying as open WAR, Using links in the underlying OS allow you to map a location from the open directory to a mapped drive (NAS location) where you can FTP your xhtml pages.
If you are deploying on Weblogic (I am sure others have a similar feature) you can use the option in the web.xml to redirect all requests to an underlying NAS location.
I have used both the above approaches successfully with JSP and HTML so don't see any challenges with xhtml.
I know for a Java Program to run on another Computer it needs JRE(Java Runtime Environment). But for a J2EE application (Serlvet-JSP) or Struts2 framework application or Hibernate framework application or any Framework application of Java what are need to Run it Successfully on another computer where it is not developed....
I know JRE is required for both type of Application. and JDK is for developing an application.
I also know that for Mobile application to run on device it needs an Emulator that supports the particular OS (Android, iOS, etc). Just like an Standalone Java Application.
But for running J2EE application is there any other requirements than JRE??
For Example:- I have made a site called SocialMash.com I want to have a working prototype to deliver to user (User meaning like we all use Stackoverflow and other sites). What will I require to configure the site.
I know I will require a server like Tomcat/JBOSS/GlassFish but that all will be on my side (server side/ development side) but Do the Users to use the site will require anything among JDK, JRE, Server, or anything to use SocialMash.com or just URL will be enough?????
You need to have a JavaEE application server. It runs on top of JRE. You can check this open-source reference implementation (full-profile, my favourite):
https://glassfish.java.net/
or if you want to have only web-profile:
http://tomcat.apache.org/download-80.cgi
Web profile is different from full profile in that web profile supports only Servlet-JSP, but not JPA (or hibernate as stated in your question).
Users will not require anything except for the browser in case you write a web application (Servlets+JSP, Struts, JSF, etc. - just give them a web reference). But you can go further than that. You can write a Java SE desktop client for EJB, or SOAP service (they will be placed in full-profile server like Glassfish), and distribute for your customers. In this way they will not require any browser, but your custom desktop program.
Some of the libraries require to be added to your application server and configured manually. Like Struts. In this case you first need to decide which framework/library you would like to use, then go to their web site, and follow the tutorial on its installation.
To host an J2EE application, a webserver is required that has servlet container. servers included in XAMPP/LAMP/WAMPP will do for php based application. But for J2EE application servlet container is rquired which is there in TOMCAT/GLASSFISH/JBOSS.
On the user side, the user sees pure HTML with additional js/css. He does not see the jsp scriplets/servlet code written in your J2EE application. so no java technology is required on the user system. He only needs a browser.
A J2EE project intends to create a web service. In order to run this project on your computer, you need a local server.
Any IDE can provide you a local server like Tomcat or Glassfish, you just need to try to run this project to get these options.
If you don't need to access the code on the other computer, two options:
You compile your project to get a .war file, which you can deploy on your Tomcat server, or any else.
You put this on a server of yours, and share the url.
Assuming that you are in charge of the app hosting:
If that the app is running on your own remote server, you just need to share the app url and your user can access it with his browser (nothing more is needed).
If you run it in your own computer, as localhost, he won't be able to access it, and I recommand the usage of a host like Openshift to make it accessible (that's a free solution).
This question is kind of related to our web application and it is bugging me from last few months. So we use linux server for database, application and we have our custom built java web server. If we do any change in source code of application, we build a new jar file and replace the existing jar file with new jar file. Now update to take place in live application, we just execute a HTML file which contains this kind of code :
<frameset rows="100%"?
<frame src="http://mydomain.com:8001/RESTART">
</frameset>
How does this opening of port make the application to use new jar file?
The webserver is instructed to give the /RESTART URL special treatment. This can either be through a mapping to a deployed servlet, or through a hardcoded binding to a web container action.
It is very common to have URLs with special meaning (usually protected by a password) allowing for remote maintainance, but there is no common rule set. You can see snapshots of the Tomcat Administration console at http://linux-sxs.org/internet_serving/c516.html
EDIT: I noticed you mentioned a "custom built web server". If this web server does not provide servlets or JSP's - in other words conforms to the Servlet API - you may consider raising the flag about switching to a web server which do.
The Servlet API is a de-facto industry standard which allows you to cherry-pick from a wide array of web servers from the smallest for embedded devices to the largest enterprise servers spreading over multiple physical machines, without changing your code. This means that the hard work of making your application scale has been done by others. In addition they probably even made the web server as fast as possible, and if not, you can pick another where they did.
You're sending an HTTP GET to whatever's listening on that port (presumably your web server). The servlet spec supports pre- and post-request filters, so the server may have one set up to capture this particular request and handle it in a special fashion.