writing desktop application for connecting with server - java

I'm working on a server client base "Desktop Application". And what I want to do is this,
Client application sending some request code to server through internet(oh yes, these connections must be secured). and when server application gets this code it will again do some work and gather some data.
And then server application will return those data again to the client application.
As I am new in this, I need to know, what kind of tools to use?
Is eclipse good for that?
Where can I find good examples for writing client?
Where can I find examples for connecting client with server side?

I'd recomend checking out apache httpclient it really helps when dealing with web APIs.

Related

HTTP Client-Server resquest response

I am trying to write a simple client-server application in Java using HTTP request/response. I would like the client to be a desktop program which sends (posts) a request to a server. The server is a web page which will be hosted on Apache Tomcat server. The server must be able to read the information and display it on the browser and must be able to respond to the client with a status code 200. I am using eclipse and Apache tomcat server. I have so far tried various resources, but all I could find is a client which could request response from an already existing web server. Could someone please give me an example or some insight on how to make the client request the our own server which runs on the local machine.
Good question, though in your case, I won't recommend you implement a simple HTTP request/response approach as you will end up implementing a timer, heartbeat or Comet. You might wanna try javax or jetty WebSocket API. All you need is to create three parts:
a websocket.server
a websocket.client (desktop application)
a javascript websocket client (browser agent)
Your server and both clients will become full-duplex via onMessage and send events.
Here's an example which I believe is a bit relevant one.
https://dzone.com/articles/sample-java-web-socket-client

Java RMI for implementing server side of system

I am developing system, that consists of client (written in JavaFX) and server. Now I am going to implement server. Users will download clients. Clients will communicate with server (only one server and many clients). Server will communicate with data base and send results. Server will support authentication and different requests (not http of course). Is it a good idea to implement server with Java RMI? If no, could you advice me any good idea about server realisation.
Thanks a lot for future questions!
RMI is bit kind of traditional but still powerful to me ,it has some draw back . But, despite the RMI there is also a chance for you to use java sockets class ? just like a client -server application ...

Java web server to process Android client request

Since I'm a newbie to Java web server, I don't know where to begin to create a server in Java to reply from Android devices request( A WEB SERVER NOT AN ACTUAL SITE).
Which technology should I use and which document should i read?. I have searched on the Internet about Java but i found out many technologies and i don't know which one i can use.
Spring MVC,JSF,JSP,Struts,Servlet..............
Hope this question clear enough for you to reply. Thank you
It doesn't matter what be process android devices requests on server side. In this case main idea is http communication - client sends request, server process this request and sends response to client, and you can use any technology on server side - java, php etc.
If you prefer java I can suggest you try servlets, it is simplest technology of those you mentioned above.

android clients - java server implemenation

I am building a android clients - single server application, and want to use JSON objects for communication. Will have some simple database on the server. what would be a good scheme for server side implementation. Here are my options:
Socket programming - then can I still use HttpClient on the android client?
HttpServer - I heard it is not working well with android, and how do you do multithreading on server side?
any other recommendation would be helpful. thanks
There is some interesting discussion over at this SO question that may provide some useful info: How to call a SOAP web service on Android

Proxy Server in java

I am new to java.I need to develop a proxy server for IBC 2011 conference.I have some Questions regrading the Proxy server.
1.I am going to develop the proxy server using java.
Suppose A(sending the information) to B(receive the message) through the proxy server.
Here A is sending the information through HTTP serves(application running in A is a wed application) how can i receive the information send by A in proxy server and how can I forward it to the B which is also a HTTP serves.
2.What r the Things I have to now before I start developing the proxy server.
3.How can i get the information from the HTTP protocol.
4.How can i check frequently for the any message is there in line to forward to B from A or B to A.
Can any one helpme.Thanks in advance.
Use one of these instead http://proxies.xhaus.com/java/. Rolling your own proxy implementation will be much harder than you think once you've taken all the intricacies of HTTP into account.
there are many libraries which can you use.
for the A and B they can running hessian server(for listening) + client(for sending)
and for the proxy server you can use JMS + hessian server + client same as for A and B.
In this way you can send java objects.
But hessian is only on suggestion you can use RMI or spring remoting or maybe web services.
By far which a have working hessian is the fastest and very easy to develop.
from 1 to 4 you ask how to design a application which is out of the scope and you need to do it by you self :).
I did something similar in my course project.
As far as i am concerned, the core knowledge u need to learn about java for this a proxy server is socket programming.
you can setup two sockets: one communicates between your proxy server and the web browser, the other communicates between your proxy server and the target server.
Also, you will need some knowledge about thread in Java, open one thread for each connection will be a efficient way.
And I assume that you already have the knowledge about those computer networking stuffs like http, tcp.etc.

Categories

Resources