I have to provide a way in which a server will monitor its client's resources (i.e. cpu usage and ram) and store the data in a database.
I am learning about the JSF right now and aim to develop a web application that will use OperatingSystemMXBean methods on the client to get the resources of that machine. The problem is that I am not sure if this is the right approach to the task or even possible to do it with the JSF - operatingSystemMXBean combo.
My question - is it possible to do it this way? And if yes, is this approach worth the effort or is there a far simpler way of doing it.
Thank you.
You can not run java code on the client side. As you are new to JSF you should read more about this technology. The java codes that you write in jsf pages compile in the server side and the result will pass to client browser. If you want to get client resources like ram and cpu you need third party apps on the client side. Maybe there were some plugins that installs on client browser to do this(or you write your own) that you should search more about this. And also another approach is that you write a program which installs in the client pc to send his resources information to your server over internet.
Related
Im newbie in java.
I want make a web application (like a remote controller) for 3rd party server(via xml api).
I think to make a java applet for user gui and a service for parcing xml to (and from) 3rd party server. Whole app will run on separate server with apache.
Is it correct way in general or i need change my concept?
And I need advice how to make communication between web user gui (applet) and service, that parcing xml, on same host? Through or make it in one application with different threads?
Applet? So 1998.
Web UIs in browser speak HTTP to web services now. Applets are NOT the way to go.
IF you deploy on a Java EE app server or, better yet, Spring Boot, all that threading stuff will be taken care of for you.
It's not for newbies. By all means attempt if you want to learn; get some help if this is real.
I have to make a final project (Software Engineering) which should be on web (I chose javafx over HTML5). The project's purpose is to learn people typing blindly. The user gets a sentence and he should rewrite it. The application should save all the information of users so that is why I need a server.
I have got some questions:
Can I use simple java socket server with javafx?
If the answer is yes, are there web hosting services that support simple socket server? I heard something about tomcat or something like this. If the answer is no, what other choices do I have?
What is the best plugin for eclipse to work with javafx? I mean, I need a designer.
Another thing that I need from the server is to send sound files to the client, which type of java server allows it?
Can I use simple java socket server with javafx?
Yes. It's a Java application, after all, and you can open a socket (client or server).
If the answer is yes, are there web hosting services that support simple socket server? I heard something about tomcat or something like this. If the answer is no, what other choices do I have?
You should not focus on this. Instead, try to create a set of (REST) services. Your application in the server side (Jetty, Tomcat or whatever) will be the producer and your Java FX application will be a consumer of these services.
What is the best plugin for eclipse to work with javafx? I mean, I need a designer.
This is off topic because it falls into personal preference. I don't know about such a designer. And IMO I prefer to design in my head and just write the code I come up with that.
Another thing that I need from the server is to send sound files to the client, which type of java server allows it?
A sound file is a file, after all, and a file is just a byte[] that will be sent through the net. Learn how to handle this when creating/consuming your services.
Ok so I have created an application, which is a Java Web Start application, but I have determined that I will need to write data to the server machine, hence the need for an additional server application. Pretty much I want the client to send different strings in order to process a clients requests in varying ways (eg create a new user file on the server machine or send user data read from a file to the client machine).
I was thinking of possibly using sockets, but if there is a better way then I'm all for that. Also I assume that whatever I do use, I will need to use threading in order to process many simultaneous requests, is this correct?
For your purpose you better create a webservice which communicates over http for exchanging data. I would recommend doing this in Java or maybe creating a WCF in C#.
Tutorials in Eclipse for java webservice: http://www.vogella.com/articles/REST/article.html#first_project
In netbeans: http://netbeans.org/kb/docs/websvc/jax-ws.html
The first tutorial is a restful service which is pretty popular and easy to grasp.
Good luck!
I need to create a user facing web interface (perhaps with HTML5 and Javascript) that allows a user to draw lines using a mouse. The interaction would involve mouse drag, clicks, etc. I need to send these inputs to a Java application on a remote machine and get back some result and update the web page the user's drawing on. So this would require a two way communication.
Since this is a proof of concept prototype, I need a solution that's easy and simple, and hopefully fast since the user would like to see the update quickly. What technology do you recommend to allow the communication between the web interface and java application? I was thinking about writing a simple server in Java and talk to the remote application using JMS... not sure this is the right direction.
Thank you for your insights.
Any servlet container, such as Tomcat, JBoss, Jetty, GlassFish or WebSphere would do.
I'm not sure JMS is a good fit here.
The browser would communicate with the server the way all web-apps do, via http requests. So, on the server you would use servlets, or some frameworks that builds on top of servlets, running in the container of your choice. You webapp would periodically send an xml http request (XHR/AJAX) to update the state of the drawing. Or it would do it when the user wanted to save their design.
Keep in mind what you are describing is a Web Application. This means that an application is running in the browser, so it can maintain its own state independent of the server. It just needs to sync up every now and again. You don't need to continuously send requests to the server.
it can be done also using RIA: actionscript3/flash+xml socket+java server. You can handle events via actionscript3 and then send parameters to server and after receive answer. There is lot of source for as3 drawing api after you can modify for socket connection.
have you tried this ? Look at the demo section on the shared canvas.
http://jwebsocket.org/
I'm starting to study GWT now, and have a very general question, I could maybe teach myself with a little more experience, but I don't want to start it wrong, so I decided to ask you.
I always develop using JSF, having separate packages for beans, controllers and managedbeans.
However, as the GWT uses RPC, I will not have managedbeans, right?
So, GWT automatically handles user session for me, or do I have to do it myself?
What is the best package structure for the project?
It is best to use RPC, or create a webservice and access the webservice in GWT?
It's hard to host the application on a tomcat server?
Is there a test saying which server is faster for GWT?
Thank you.
However, as the GWT uses RPC, I will not have managedbeans, right?
True, GWT RPC uses POJOs.
So, GWT automatically handles user session for me, or do I have to do it myself?
GWT is pure AJAX APP - client code (normally) runs in one browser window (similar to gmail) and does not reload the web page. This means that the application state is always there - no need for sessions (as a means of saving state). You still might need sessions for user authentication, but this is usually handled by servlet container.
What is the best package structure for the project?
Three packages: client, server and shared. Client for GWT client code, server for server (also RPC) code and shared for POJOs that are used by both client and server.
It is best to use RPC, or create a webservice and access the webservice in GWT?
Go with GWT-RPC or (better, newer) with RequestFactory.
It's hard to host the application on a tomcat server?
It's straightforward: GWT client code is compiled to JS/html and is hosted as any static content. RPC server code is just Servlets - normal web.xml registration.
Is there a test saying which server is faster for GWT?
No clue, but IMHO does not matter, because most of the latency will come from database and network.
Also have a look at http://code.google.com/p/gwt-platform/
This framework is really great and follow all suggested best practices(e.g. MVP) by google and give you as well great support for gin, gwt dispatcher, website crawling, history with tokens, code splitting via gwt async etc.
If you want to set up a good project structure try to use the maven gwt plugin(http://mojo.codehaus.org/gwt-maven-plugin/) it helps you a lot with setting up an initial structure and manage your build process.