Running FFMPEG and FFserver from Glassfish Java Servlet - java

I'm planning to design a web interface to control my FFserver remotely. The question is, is it possible to start/stop the FFserver running on my Linux server using a Servlet running on the same machine?
I'm using Glassfish server and Java EE 7 for my web application. Currently I managed to get my web app to obtain http streams (which are started manually in terminal with predefined config file) and play them on the web. However, now I want to find a way to stop the streams and start the streams on demand.
Is it possible for me to run a Bash script via the servlet? Or are there any better solutions which allows Servlets to run linux commands in the servlet?

Related

Using Java Spring, Is it possible to run a service that execute on the client side?

I want to create a simple strict service that tells the client if a PDF file is searchable or scanned images (not OCRed). Then I thought that the code is very simple and could run very fast, but the heavy lifting is in uploading the file especially if the file is large. Is there a way in Java and Spring to execute the code on the client's machine (if the client has JVM) by sending the code to the client to be executed and get the result?
Are you looking for Java Web Start?
https://www.java.com/en/download/faq/java_webstart.xml
The Java Web Start software allows you to download and run Java
applications from the web. The Java Web Start software:
Provides an easy, one-click activation of applications
Guarantees that you are always running the latest version of the application
Eliminates complicated installation or upgrade procedures
A signed Web Start application can request permissions to access local resources, native libraries and hardware.
To send the result back to server, you can simply have the Web Start application send it via HTTP[S]. The JNLP used to launch the Web Start application can be dynamically generated, so you can set parameters for the Web Start application, to have it send the parameter back to server, so you can identify which user session it is.

Can Java Web Start be used to run server-side programs?

I have a Java application that needs to run the proprietary software PowerWorld on the server and then return output to the client side Web Start window. Is this possible? How do I go about doing this?
I am using Apache Tomcat to run the server. My Java code uses Runtime.exec() to run a Python script that runs PowerWorld. I made sure that the python script, powerworld file and java app are all in the same directory and reference each other using relative file paths
Java WebStart will install a desktop application into the cache of the client. That will run on the client not on the server, however you can easily create a webapplication as a service, i.e. on Tomcat. The webapp will be able to receive client requests, i.e. via RMI, RESTfull service or webservice, call the proprietary programm and return the results.

Java JVM versus Glassfish

I'm really new to Java and I have a basic question. I'm getting ready to deploy a Java web service that I have created in Netbeans/Glassfish. I used Netbeans because of the development GUI and tools. Of course I also deployed to Netbean's built in GF server because of easy and simplicity. I have a Windows 8 server with IIS that I now need to deploy this to. I was thinking that since Java 1.7 EE was already on my IIS server, than I wouldn't need a "container server" like GF but that doesn't appear to be the case. So, I'm confused. What's the difference between the server that Glassfish creates and the JVM that Java EE creates when it is installed? If I have to install Glassfish on my IIS server, am I going to have competing web services and port conflicts to resolve?
Thank you.
The Java Virtual Machine (JVM) is used to execute any Java program. However, all it does is execute the byte code in a Java binary, for example a Java archive (.jar) file. It does not include implementations of many of the Java EE libraries.
A web application, typically deployed as a web archive (.war) file, usually requires libraries not provided by the JVM. In addition, the standard Java web application architecture means that the entry point for the application is not in the .war file - it is in the web application server, which then calls into the code provided in the .war file.
The web application server, which includes full J2EE containers like Glassfish and also more limited web servers like Tomcat and Jetty, acts as an intermediate layer, running on a JVM and executing the web application provided in the .war file.
Probably the best way to run your application on an IIS server is to set up the IIS server as the front end - so the client facing ports would be under IIS control - and set up the web server as a back end to which IIS forwards the relevant requests. The answers at the following question provide some links that may be useful:
Deploy War File in Microsoft IIS 7

Start Java WebStart with procrun

I'm trying to launch a Java WebStart application as a Windows Service using procrun. In order to do this, I created a small Java application which only launches the Java WebStart using ProcessBuilder. If I run this application directly, I don't have any problems and the Java WebStart is started too. If I run this application configured as Windows service using procrun, nothing happened. The procrun logs show me that nothing bad happened but the Java WebStart is not launched (no UI seen and no request on the servers from JavaWS).
I'm wondering if it is possible to do what I'm trying to achieve and if there is alternative ways to do it?
My goal is to launch a small Java application which uses JMS and somes Swing UI using JavaWS and start it as a Windows Service (it must be always started in the system).

Client Side Java Web technologies

I have a bunch of shell scripts on every client machine. I need a web interface to provide settings for these scripts and it should invoke these scripts.
If i run a web application from a server to run scripts, it will overload the server due to multiple client requests, so client side web app is preferred.
Applets can solve this. But, it is outdated and I dont like it.
Is there any other new/good technologies to do such client side computing ?
Are you talking about web application or desktop application?
If this is a web application, so as far as I know - no. You must use applet embedded at your web page to run the script.
If desktop application - it can use the API for execution processes at Java.
Another option is maybe to download some small server code that will be used to invoke scripts, and have you web application communicate with it, in order to invoke a process.
The downside of this is that this is not a "straightforward" usage of your web application.

Categories