Integrating a Swing App With Tomcat - mysql

I recently created a web application with GWT. Then re-used most of the code to create a Swing version of the application that accesses a local database in offline mode. I am now implementing the 'online' mode of the application and want to access the same data as my GWT application.
Any ideas? Considered connecting directly to the MySQL server via SSL, but that's not working and doesn't seem as scalable. Should I use REST?
Any suggestions would be helpful.

To solve this problem in the past, we've used Jersey to create REST Web services which returns protocol buffers. The Swing app would then interact with the protocol buffers. The GWT app would ask for content type 'json' and receive protostuff objects in return. It worked quite well. That way, both apps can communicate with the server in the exact way.
Edit:
To allow your swing app to communicate with GWT-RPC, look at this blog article.

Related

How to deploy Java Web Start under Apache Karaf?

One of our enterprise application is running over Apache Karaf , this application is accessed through web client.
We have another standalone desktop Java Swing based application. We want to invoke this application from browser.
So , we decided to deploy this application as Java Web Start and allow clients to invoke this application.
We have lot of examples how to deploy Java Web Start with tomcat like web servers.
But we want to deploy this in Apache Karaf . Anyone is having tutorial or notes for this?
I would strongly advise against Java Web Start.
If you don't want to rewrite the app, have a look at webswing. I have never used it but they claim they can convert Swing Apps to Web Apps instantly. I also have no idea how that would work with OSGi. Depends on what they actually do it may be easy or impossible.
If you are OK with some changes you can try JavaFX or Vaadin. Both are quite similar to Swing in terms of development style so it should be relatively easy to convert your app. Both can run inside OSGi container with some minor limitations and after some adjustments.

What is the difference between a Native Application & Server Application when talking about ADFS Application Groups?

I'm new to Federation Services and I'm trying to understand how ADFS works as a whole and I've started to get down into the details. I followed along with creating an app using OIDC to authenticate a user, however, within the tutorial, they specified using a "Server Application" when setting up an Application Group. This ended up not working for me so I tried setting up a "Native Application" application group for kicks and was able to successfully login.
The thing that threw me off is, I ended up hosting ADFS on a server outside of the domain in which I had my application running, so I'm confused as to how that is "native" in terms of ADFS.
I went looking for this answer within microsoft's documentation but I didn't find the information very clear.
Native Application:
"Sometimes called a public client, this is intended to be a client app that runs on a pc or device and with which the user interacts."
Server Application:
"A web application that runs on a server and is generally accessible to users via a browser. Because it is capable of maintaining its own client 'secret' or credential, it is sometimes called a confidential client."
This may seem simple to some, but I'm trying to really get a grip on what would be used when. To me it sounds like a native application is used when you're running the application natively on a pc in which the user is also using the same pc, and the server application is run remotely in which the user would not be using the same machine. Is it really that simple or am I misunderstanding?
A native application (in Microsoft speak) is something that is not browser based e.g. mobile. The code runs client side. It may use JavaScript in which case the secret key is publicly accessible. (The secret key is one of the OAuth parameters). You use ADAL / MSAL to access it.
A server application runs server side e.g a web API. The secret key is not publicly accessible. You use OWIN to access it.
These terms have no relevance to where ADFS is actually installed. Native applications typically are not domain joined.

Connect Xamarin.forms with MySQL

I know about xamarin connection with SQLite but it is locally
I need to connect my remotely MySQL database with xamarin.forms (I know about the security issue of this without using web services layer, but i will only use it for my own work)
This plugin is for xamarin.iOS and Xamarin.Android
I cannot add it using dependency service because i cannot add this component to the shared project
So is there any example of connecting MySQL database with xamarin.forms
You can't add references to your shared library. Shared libraries act like a list of files that are directly included in the project. The advantage of shared projects is just, that you do not have to maintain these included files for each project that uses code of the contained files. See the Xamarin documentation for further explanation.
What you have to do, if you want to consume a 3rd party libray within a shared library: Add the library to each project that uses the shared library (e.g. your iOS and Android project)
2ct to the mentioned security issue
You are right about the security issue. That's why I'd advice against, using mysql directly from your app. (I'll explain it for other readers that aren't aware of this problem and stumble over this question)
You should tunnel it through HTTPS because:
Some networks just block certain ports (HTTP and HTTPS are usually not blocked)
You publish your credentials with your app either statically or dynamically, but the credentials to your database are interceptable either way. You should authenticate a user and not an app. So there should be some kind of authentication / authorization that is revokeable. There was a nice talk from Kerry Lothrop on the Xamarin Evolve 2016 on this topic. https://www.youtube.com/watch?v=uLFtQHNxGaI

connecting an ios app to send information to a mysql database

Im doing my final project which is a taxi booking service. i intend to make an ios app for the customer so that they can book a taxi. the request will then be sent to the mysql database (held at the taxi base). i want to no how can i send the information from the app to the datatbase; and the datatbase to send a confirmation message back to the app confirming the taxi has been booked!>>>>>
i have read a lot about web servers but am very confused. can i use an web server e.g. windows home server 2008? any help would be appreciated.
I am not familiar with Windows home server 2008, but I'm pretty much sure that you can use it for your project.
If you want to keep things simple,
Just install XAMPP server which comes with all the components you need to work on this project including PHP and MySQL. It is one of the easiest servers to work with and most of all, its free and open source. http://www.apachefriends.org/en/xampp-windows.html
Then write the business logics inside your Web App using whatever the programming language you want to (for this one PHP would be enough, or choose Java if you want to have a more complex scalable solution). Writing data to a MySQL database using PHP is very easy and you can find ton of tutorials and sample source codes in the internet.
Now your web app is all set, the next step is to expose these services using REST where an iPhone can communicate with your services. Use JSON for interacting with your Web server from iPhone. Again, there are tones of tutorials on how to write a JSON RESTful service using PHP.
Finally in your iPhone app, you can access the service exposed from the server for saving data as well as to retrieve anything from it through JSON. For making this, use a good Objective-C framework such as AFNetworking. It comes with the JSON parser as well. Ref. http://afnetworking.com
Good luck with your project !
RESTful web services are going to be your best friend here.
Create a server side program in django or python or whstever. Connect it to a database (mysql).
You can host it on Amazon Web Services. I think they have windows 2008 instances. I would personally use the amazon linux ami.
Use afnetworking to invoke a get or a post on the server app and you are off to the races.
take a look at this open source taxi project
its work with RESTful web services but its better to forget about Microsoft Windows its better to use Linux hosting for your web service.

PhoneGap app to act as a server

I am trying to develop an HTML5 app to be ported to native via PhoneGap. Is it possible for the app to be able to act as a server on a mobile device, with the same app on another mobile device acting as a client and connecting to the former? This is all within a local network.
I am new to PhoneGap and I understand that most server implementations are on platforms such as node.js or PHP and that PhoneGap only supports HTML, CSS and JavaScript. I think I might be partially wrong here as there are various plugins that could help ease the abstraction between PhoneGap and the native developer.
Other alternative suggestions are very welcome :)
What exactly are you trying do by having a client/server app? I think your best bet would be to have one app that posts and gets info to your own webserver (not an app). Therefore, that one app can act as a server by "publishing" information to the server and the other can act as a client by only reading from the server.