Creation of a client-server desktop application [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I've in the past created client-server web applications using Javascript, AJAX, Node, Express and MongoDB, but now I'm required to creare a client-server desktop application. It will therefore basically consists of a desktop program which will connect to a server program by doing requests. The server program will respond to the client program with the requested data which it can fetch from the database.
Since I'm really new to these kind of applications in Java, I have no idea how to create such an application in Java. Since the project will be large, we cannot hard-code all the server. We need probably a framework on the server side that listens for requests, but I've not found any for now. For example, Play Framework seems only to work for web applications. Which frameworks are useful for these purpose? Is this the right approach for this kind of applications? How would I connect client and server applications?
Please, do not suggest "use sockets". This will be quite a big "serious" project, and we need high level tools. We don't know how usually these kind of projects are created. Please, explain a little bit which patterns are usually used. Examples of concrete programs, maybe with open source code will be useful for us to understand. Also a list of the requirements that we need for these project would be very useful.
Note: I'm not asking for a exhaustive list of frameworks that we can use. I rather asking which kind of tools (with concrete examples) should we use and how to combine them. How to structure such a project.

You could write the server side application in Node JS or whatever other server side language you prefer - and implement that using REST services. Then in your Java desktop application, it would just communicate with the server using HTTP REST / SOAP etc.
That way if you were to then want to swap to use something like .NET to make your desktop application you would be free to do so without it changing anything on the server side. Also you would be able to implement a mobile application / tablet app / other web application and reuse all of the server side implementation easily without changing anything server side.
Another option is to use ServerSocket for the Java server side, and then connect to that from the client but you seem to know and dislike that option.
Another option to connect each side of the application would be to use some kind of pub / sub middleware messaging service - check out JMS as a framework - you will need some kind of implementation of JMS such as Active MQ, Websphere MQ or one of the many other free implementations. Check out : http://docs.oracle.com/javaee/6/tutorial/doc/bncdq.html
Difficult question to answer, but those are 3 high level options.
Use web technologies to connect client to server HTTP REST, or SOAP
Use ServerSockets and Socket connections and do everything manually
Use a messaging framework such as JMS

Related

Best practices to build a hybrid Java application for both mobile and Web [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
We need to build a hybrid Java application for both mobile and Web. We plan to use Spring MVC and React Native.
Could you please advise us the best practices so that we can re-use the code as much as possible for both mobile and Web and it should be easy to maintain.
Should we build a common service layer and two different controllers for Web and mobile (using #Controller and #RestController). After that, these two controllers can call the same service.
For example, to display the information of all users of our application, we can have a common service UserInfoService, then we create two different controllers WebUseInforController (with path like /web/users/info) and MobileUserInfoController (with path like /mobile/users/info). These two controllers call the same UserInfoService. Is this a good idea?
Thanks a lot.
It all depends on your client requirement but I can suggest you some ways that may be helpful for you:
I worked on an enterprise financial application, on that application we follow the approach that we created a single server side (in your context single controller). That server side was used by by web application as well as android application. You can create services oriented or micro services application and expose your different services that will be reused in both android as well as web application.
**Web Application -----------> |Server side| <--------- Android Mobile Application**
Best Practise is that you should have a single server side and expose your services
And nevertheless there is another less economical and fast option as well:
You can go for web progressive applications. Progressive web apps are websites that look and feel like an app. This means users can access all information and capabilities without downloading a mobile app. Some big giants converted there applications into WPA e.g Ali Express, FlipKart, Twitter Lite, BookMyShow, Forbes and many more.
In the web progressive application you can follow any WEB architecture you want. You can even create an android application by using that website link in android. or that Application will work perfect in mobile browser as well.

How to run node.js, Java and PHP application on same server and same port [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
How to run node.js, Java and PHP application on same server and same port, I was trying to run but unable to run.
You need some kind of HTTP proxy layer in front of all this, typically Apache httpd or NGinx. From there you can configure different paths to go to different applications if necessary.
The configuration directives vary considerably depending on the solution you're using, but you can have / go through to PHP and /node go through to Node, while /java goes somewhere else entirely. Just make sure your sub-components are using non-conflicting paths so they can all play nicely together or you'll have to do a lot of ugly URL rewriting.
You could use the varnish cache as a load director and set up different back-ends for each of those servers. Then you could parse the incoming urls to redirect to the appropriate application server. You can absolutely run all of those app servers on the same machine, with varnish listening on one port, and all the other services listening on other ports. It would be easy to firewall those services from external access as well.
Running each service on different machines is also entirely possible and easy. We've used this solution numerous times in different environments because Varnish is extremely light-weight, reliable, and does not have the overhead of a web server such as Apache or nginx which, while good options, can be overkill.
You also get the added benefit of the robust caching it provides. Bonus!

J2EE to Java standalone applications communication [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
What are the best practices to have two applications on the same host, one J2EE and the other Java standalone, communicate one with the other?
More infos:
The j2ee application will be deplyed in Wildfly AS
The Java stand alone is a Netty NIO Server
EDIT ONE
Even more infos:
The Netty server is a cardgame server that will hold the business logic for the game itself and will allow players to play synchronously one with the other (up to four players per game, up to a max amount of games allowed from my hw server resources)
The J2ee application (deployed in Wildly) will take care of authentication&authorization
The J2ee application will take care of the DB connection and Persistence
The J2ee application will have to forward to the java standalone server the remote-socket-address of the authenticated player and eventually an object holding the state of that player
The J2ee application will potentially be the one triggering the communication although for my current flow, i am in need of a full duplex communication from both ends (hence my fear about a WS or Rest, isn't it kind of asymmetrical for a full duplex communication channel?)
The Netty server may be seen as a background task of the AS that will start it (and eventually other cardgame servers) in an attempt of pseudo horizzontal scalability
Have one open a socket and communicate to the other.
You could do more exotic stuff, but if anything about the environment changes, it will break. For a few ideas of "exotic stuff"
Write and read from named pipes
Set up a shared memory buffer, or two.
etc ...
I think it is not possible to give a good implementation pattern when you are not clear/explicit about the following relevant questions:
Is the standalone application a background task (possibly launched
with the container)?
If yes, do both J2EE and standalone have to
share session or conversation data?
Who triggers the communication
when communicating?
Do both applications possibly share the same back-end database?

Xmpp Vs Websocket [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm about to develop a website that has near real time chat. I know that it can be implemented using xmpp or websocket protocols. I know also that the xmpp protocol has been developed in 1999 , and I guess it should be mature nowadays .On the other hand , the websocket protocol has been developed in 2011.
What was the need for websocket if xmpp was good in handling real time conversations?
What are the major differences between the 2 protocols?
And when should I choose one of them over the other?
The short answer is 'both'.
XMPP is a set of application protocol for doing real-time chat (and many other things, for that matter) - it then has to be transported across the network somehow, so you need a transport binding. There are three main transport bindings for XMPP -
TCP/IP, which is what one usually uses on the Internet with native clients on devices
HTTP (called BOSH), which is what one has traditionally used when using XMPP in the browser (as TCP-IP isn't available to Javascript apps in the browser)
Websockets, which is one one uses when doing XMPP in a modern browser.
So if you're developing a chat application in a browser, you'd choose XMPP as the application protocol and you'd use websockets (in a modern browser) or BOSH (in an older browser) as the network transport. If you use an XMPP library for Javascript like Stanza.io (https://github.com/otalk/stanza.io), it'll support both and you'll just be thinking about 'XMPP' rather than the transport layer, other than at setup when you have to tell it what endpoint to connect to.
(You can't use 'just websockets' for chat - you can use websockets without XMPP, but what this really means is that you're inventing your own application-layer protocol for chat, and the odds are you're going to save a lot of time and headaches by taking advantage of the work that's already gone into writing one with useful properties (security, identity, extensibility etc.) and for which there are existing libraries and servers by going XMPP instead.)

Data hosting for a android application [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
i want to create a android application, where it will fetch stories (probably html or text) files from internet. i want to know where can host these files(no problem with paid service).
Users should be able to search the stories, rate , and options like mostread and NEW..etc
is there any predefined web services are available for this kind of purpose?
If NO, then what are the technologies i should be familier with to achieve this in a normal web server.
Thanks in advance
I suggest you start with shared web hosting.
Starting at ~ $5/month, shared hosting offers usually have the following advantages:
No need to set up yourself the linux system, Apache and MySQL server
cPanel administration
Support of your preferred server-side language: PHP, Python (less common than PHP) etc.
Migrating to another host is pretty simple
The choice of the programming language + framework depends on your taste and experience.
Two very popular options are PHP/Code Igniter and Python/Django.
Of course, if the traffic becomes significant or if you already expect a very fast growth, you may also consider a scalable solution (which shared or even dedicated hosting is not). Amazon, Google and Microsoft provide this kind of service in the cloud.
From my personal experience with Amazon S3, setting up a web service in the could is far more time-consuming than with a traditional web host. I would not recommend it unless your traffic forecast is over dozens or hundreds of hits/second.
If you want to create your own service - checkout Google App Engine (GAE).
Enabled Java deployment (no need to programming in PHP, Pythone etc.)
Scalable (almost every one mobile app has potential to gain 1M users)
free quotas (free start)
Good integration with Google services and tools (GWT i.e.)
Disadvantages:
There is no option to (easy) migrate your solution to other service.
No ready to install apps (forums, etc).

Categories

Resources