Interacting with a usb smartcard reader/writer (NFC) from Flex - java

I would like to be able to use a usb SmartCard reader/writer (NFC) using Flex but I cannot find out how to do it.
I know this approach does not seem the most secure, but I know that, for example, you can use with Flex a usb webcam if the users accepts to give that permission to the web application.
To give you a little background info about why I would need this: We have developped a web application which would be deployed in a local network of an enterprise and which server-side part is developped in java and which client side is developped in Flex. I have managed to use the reader/writer from the java part but that obviously is not practical as we can only use the tag reader/writer attached to the physical server. What we need is to be able to give the client the possibility to use the reader/writer connected to his PC.
If needed, I would have total access to the client machines (if I need to give the application any kind of special permissions).
Thanks in advance for any clue you could give me!

You can't do anything in native Air, which would be the runtime that would expose such an API. You can do a native system app (Windows or Mac) and that app leverages two processes that communicate with eachother.
The main process would spawn two processes
Air client
Smart Card Reader writer
So the main app would work as a HUB between the two.
Maybe it's worth to look at a FlashPlayer app that runs in the browser and communicates with a Java Applet via ExternalInterface.

Related

Bloomberg Open API, client server architecture, application, compatibility, tomcat

I'm working on a Project which aims to develop an app for a bloomberg anywhere subscriber. We have a Framework available, which we usually use to write our apps. These run ususally on a cloud as webapplications.
As apps using bloombergs open API can only run on the same machine as the subscriber is logged in biometrically, due to data acess restrictions and prohibition to distribute the data further, we plan to run our framework locally on the clients machine as a desktop application, in order to use the tools we are familiar with.
the back-end, which would use the bloomberg open api to get the data from the local interface provided by the local bloomberg-software, runs on a tomcat-server. the frontend is a javascript client, accessing the back end via API-calls locally.
My Questions are:
As bloomberg data-access is very restrictive, i'm wondering whether the bloomberg-interface accepts calls which come from a server software (like tomcat), even when running on the same machine an not used to distribute the data further?
Would set-up: framework running on a second machine (linux, its easyer to run there), calls Bloomberg Port on first machine via private local network, data not leaving second machine, be possible 1. technically and 2. legally?
Does anybody know that? Any advice highly appreciated, many thanks in advance!

Android app need help connecting to a JAVA localhost server

I've had a look around and could not find what I'm looking for, so please feel free to redirect me.
I'm writing a card game that uses a Java server that stores the card information. I want to develop an Android app that connects to this server (via TCP/IP is my initial thought) and issues the commands i.e. pick up cards, play cards etc. (as the cards are stored in arraylists within the server app.)
My knowledge of Android is extremely limited and I cant find any good sources that could possibly help me, or explain how android networking works.
You need tcp server socket communication >
http://developer.android.com/reference/java/net/Socket.html
I would recommend to use a REST service and communicate via JSON. You can use for example Robospice in combination with Jackson2 which also brings you async communication and caching out of the box.
https://github.com/stephanenicolas/robospice/wiki/Starter-guide
Socket communication is really old school ;-)

Extern access to a Java EE webapp

When developing a Java EE 7 webapp (Win8, eclipse Kepler, JBoss Tools 4.1.1, wildfly8.0CR) I can use the application at localhost:8080/app/
But I wonder what to do, if I want an extern access to that app, e.g. from my other PC. What configuration is needed, or do you need a "real" server for such a purpose?
Thanks in advance
How public to you want your website to be?
If you want to access it from another computer on the same network(for example your home network) you need to adjust your network and firewall settings so that that you would have access from one computer to anoher on the same network. Then if on the computer that contains the app you would access it for example http://localhost:8080/myapp then on another network you would access it http://ip-of-the-comuter-that-contains-the-app:8080/.
If you would like to access it from outside the local network then the process is same, but a static IP would be recommended to the computer that contains the app.
If you would like the general public to use the app, then hosting it from your PC may not be such a good idea and somekind of server solution is adviseable. There are lots of different cloud solutions like http://aws.amazon.com/ec2/ or https://developers.google.com/appengine/ that would provide enough flexibility for majority of apps. Or you could ofcourse have your own server hardware, but this can turn out to be much more expensive to keep stable and secure.
For a quick-and-dirty solution you can choose the "Enable remote access" option on the server (double click the server, and you should see a check box in the server editor).
This will tell the server to start listening on all network interfaces and not just the local one.
btw. we only listen on local network interface by default for security reasons since we don't want you to unintentionally get hacked if a vulnerability is found and used by someone malicious.

Hardware support from a web application

I have a web application running with support for some specific pieces of hardware. This is achieved in the following steps:
User runs a small installer that places java files (and a couple
others) on the client machine. The main piece is a jar called "hardwareManager"
User visits web app. The web app runs a java applet which, due to
a .java.policy file placed during the install, has permission to
interact with the client machine outside the browser sandbox.
The applet checks to make sure the hardwareManager is running,
and if not runs a command to start it.
User interacts with the web app which sends commands to the applet via
javascript. The applet then writes commands to a text file
on the client machine. The text file is constantly monitored by the
hardwareManager which runs any commands it reads in.
This works, but seems clunky. I have a couple ideas on how to improve it, but I don't know which, if any, are even worth trying.
Would it be better to set up the hardwareManager as a socketServer and have the applet connect directly to it, rather than going through text files? Is that even possible?
Is there a way to eliminate the applet altogether and have the javascript talk directly to the hardwareManager? Maybe by writing the hardwareManager to be a local http server? What port should it run on? Do javascript xss limitations fit in here somewhere?
It would be less clunky to start the Java application using Java Web Start. This would remove the need to daemonize or install the Java hardware manager.
Another alternative is to use a built-in browser inside Java. I supose this is not an option, since you depend heavily on Javascript (I suppose to provide a rich client experience).
If you already have to install something on the client machine, why did you make the choice to go with a web application?
Talking from experience: We had a Java EE application which needed to print to PoS printers at the client site. We installed a small "synchronizer" application that connects through SSH and synchronizes all clients files. Afterwards, it loads the JAR and executes the program. This program connects through RMI with the server and subscribes to a JMS queue to receive the print assignments.
Applied to your case: Why not let your Java application connect to the server directly? You can use HTTP, SOAP or even JMS over RMI. You can then launch the hardware command from the server (instead of from the limited JavaScript webbrowser environment). This way, you get tons of features: authentication, buffering of commands, and you can even share hardware between multiple clients.
Schematic:
<----AJAX------> Web browser
ApplicationServer
<---HTTP/SOAP--> Java hardware manager application
You can launch the Java application using Java Web Start, which allows you to update the application automatically (instead of needing to pass every client a new installer).

Controlling a USB device from a web application

I would like to be able to control a USB device from a web application.
I was hoping to use Adobe Flex but I don't think that Flex can support access to USB devices.
Is this possible using Java applets, or a similar approach using .NET?
Thanks.
I don't think any web client platform will allow this. On purpose.
If you find one that does, I will uninstall from all my machines.
With .NET, you could
Create a WinForm control and host it in IE with an object tag. This requires security settings to be set using CASPOL or ActiveDirectory, but you would have full-trust to the machine after this
http://weblogs.asp.net/spano/archive/2007/09/19/hosting-a-windows-form-control-in-a-web-page.aspx
If there is already a COM object on the machine that does what you need, you can access it via Silverlight with elevated permissions.
http://www.silverlightshow.net/items/Silverlight-4-elevated-permissions.aspx
With Applets, you could do it with a trusted applet.
Using a lot of different technologies, you could create ActiveX objects, plugins or browser extensions to do it.
We successfully connected POS devices with a Flex UI... for this we created a bridge application with Merapi which connects Flex (either Air or Web) with Java, and left the connection with the devices to Java... this was for a controlled environment where we where sure that the client had the bridge configured...
Other option is to try Air 2.0 which allows to execute Native code (e.g. Java) to connect to the devices, and you could release your app in Air or develop a bridge this time in Air instead of Java to connect with the browser app
HTH
Gus
Your question is a little unclear because you did not say what computers the web application is running on, what computer the USB device is on, and what computer is yours.
Depending on the details, one possible solution would be to write a Chrome Packaged App and use Chrome USB API. The app would need to be installed on the computer that has the USB device and then it could present a UI to the user or just connect to a remote server and allow the device to be controlled remotely.

Categories