How to launch a Java Web start application with dynamic parameters - javascript

I'm trying to migrate a Java applet to a Java web start application. The applet was activated from a JavaScript with several parameters, some are not hard-coded (sessionId, tempFilePath):
deployJava.runApplet(attributes, parameters);
In order to migrate the applet I'm using a simple JNLP file with applet-desc tag. And from the JavaScript I call:
deployJava.launchWebStartApplication('$jnlp_path');
I just can't understand how to pass to the web start application the parameters that were created by the JavaScript.

OK, so it turns out that using deployJava.launchWebStartApplication(...) triggers security restrictions in Chrome and IE.
What I did is kind of work around: I sent an HTTP request to my server and the server's response was a JNLP content.
On the server side, I edited the JNLP on runtime and each time I inserted the required parameters.
When the browsers receive the JNLP content they trigger the download of the required jar.
And that's it!

Related

Accessing Bloomberg API from client's browser in javascript

Is it possible to access blpapi from javascript running in the client's browser?
I wish to access bloomberg's API from javascript running in the client's browser, in the assumption that the client has an open bloomberg session and therefore bbcomm is running.
Conceptually, this would be the same as accessing the blpapi on the client side from python.
However, all existing solutions I found in js appear to be server-side:
blpapi-node (node-based)
blpapi-httm (creates a server where to post http request)
blpapi-react (cannot make this module work)
Now you can access Bloomberg data natively in JavaScript via Web AppPortal. This allows you to write web based applications that run inside LP Components.
To learn more about Web AppPortal, go to MYAP 5
To download the SDK, please type SDK -> select SDK -> AppPortal Web SDK -> click Install.
This is obsolete, see Mourad Barakat's answer above
Conversation with Bloomberg Support confirms this is not possible**
BB say they don't support javascript access, and that one solution is to use their Server API to use the authentication of the client (who has a bb terminal open) to query data and return it to the client
An alternative hack
An alternative hack is to create an executable mini-server that the client downloads and launches, and that offers an http interface to get data to the webapp.
For example, this could be done in Flask in Python, and in fact it has already been done by blpapi-web (excluding the executable part, for which you can use PyInstaller and py2exe for Windows and py2app for Mac)

Working with HMAC authentication in Jmeter

I am doing performance testing of Web Services which involves HMAC authentication. Details are:
A java script has been developed which will create a signature, MD5
code and nonce number before a request is sent from the API
This information generated above will be passed on to variables
defined in the script which will authenticate before making a
request.
Once authentication is successful the request will be sent and
valid response will be obtained from DB.
script needs to be put in a beanshell preprocessor of Jmeter:
This script will be generating values for the header manager which in turn will do authentication process.
The problem is the language in which the script has been written ( JS ) is not compatible with Jmeter i.e jmeter cannot use the script created because it does not understands the language of the script. I came to know that the script has to be modified probably using jquery so that the jmeter beanshell can interpret it and generate values for
Date
MD-5
Signature
How can I change it to jQuery or is there any possibility to get similar JQuery code, as I do not have much java script coding background.
Try to use JSR223 Sampler with script language set to javascript (Language: JavaScript).
Reference:
https://stackoverflow.com/a/14853893/5159450

How to connect a Javascript client with Red5 server?

Anyone know how to connect a JavaScript client with Red5 Server?
I need to do this without flash, flash player or Java Virtual machine.
Thank you very much
You can write for example a servlet and invoke a REST call via JavaScript to the servlet. The servlet can then invoke a method and broadcast the message to all connected flash clients via RTMP.
Another possibility would be for example you integrate any other possibility to receive REST calls. Red5 is a regular Java Application server, normally deployed on Tomcat (or Jetty). So you could for example integrate Axis2 and have a full featured REST framework to handle JavaScript calls and forward those messages to the RTMP clients.
Sebastian

Connecting C++ backend to Javascript

I was hoping to make a website that displays a google map with points based of information returned by a C++ function. I know you can use Java Server Pages to call java methods on the server with javascript. Would there be a way to connect C++ code on the server with javascript in order to produce the same result as java server pages?
Since JavaScript runs at a completely different environment which is separated from the webserver by a HTTP connection, your best bet is to fire a HTTP request to the server side on a specific URL which has the particular C++ code attached.
You can fire asynchronous HTTP requests in JavaScript using XMLHttpRequest, the core technique behind "Ajax". The w3schools provides a concise introduction to Ajax. To make it all less verbose and bloated, you may consider to grab the jQuery library which has under each an $.ajax function for this purpose.
That said, Java Server Pages is absolutely not to be compared with JavaScript. JSP is a Java based server side view technology which provides a template to write HTML/CSS/JS in and offers capabilities to control the page flow dynamically and interact with backend Java code using taglibs and expression language. It runs all on the server machine, produces a HTML page and sends it over HTTP to the client side. The C++/C#/NET counterpart of JSP is ASP.

Execute a Application On The Server Using JavaScript

I have an application on my server that is called leaf.exe, that haves two arguments needed to run, they are: inputfile and outputfile, that will be like this example:
pnote.exe input.pnt output.txt
They are all on the same directory as my home page file(the executable and the input file). But I need that a JavaScript could run the application like that, then I want to know how could I do this.
I'm using just Apache, I don't have any language for web installed on it. My goal is to do a site using just JavaScript, without the help of anyother language than it, HTML and CSS.
You would need to make an Ajax request to the server - the server would then have a handler that would then invoke the executable with the appropriate parameters.
Without know which web server technology you are using, it's harder to give a more concrete answer (ex: ASP.NET, PHP, Ruby, etc).
EDIT: If you're talking about doing this without any kind of server side resources, then this is impossible, and for good reason. Think of the security exploits!
Any other way to this without using other languages that need to be installed on the server?
No, but you almost certainly already have languages on the server. If it's a Linux, BSD or OSX server you've got shell script; if it's a Windows server you've got JScript and VBScript via Windows Scripting Host (using a cscript.exe hashbang).
JavaScript is for Client Side of a web application, so you won't be able to directly use javaScript to access server side files. As mentioned by Tejs, you should use Ajax to make a call to server side and then use appropriate server side routine to do the task.
Even at client side, most browsers don't allow accessing of any resource( e.g files) by javaScript code.
For server side javascript in Apache you could use Sun ONE Active Server Pages, formerly known as Chili!Soft ASP. For an IIS server, javascript is plainly available as asp-language.
Look into Rhino and node.js. I dont know a lot about this, but thats a route you can use for serverside javascript.

Categories