how to implement a listener in web.xml? - servlet-listeners

i'm having problems trying to create a listener in my primefaces web aplication.
I have to differents web aplications both are in different servers, in aplication A I inserted the welcome page of aplication B, because the user need to create an order. When the order is finished aplication B must send an action to aplication A so i can close that external page and redirect to aplication A.
Do you have any idea how can i do that?
Thanks.

Related

Planting an Iframe as Aura component to show an external system that receives information from Salesforce API using oAuth web server flow

I have built a web app for our sales team.
The web app is currently using oAuth web server flow in order to authenticate with Salesforce.
Everything is working fine when running it on a separate tab.
We recently wanted to add some functionality from within Salesforce specific objects and display information from our web app.
So I've built an aura component displaying an Iframe with the URL from our web app.
Unfortunately, it crashes with a console error
Refused to frame 'https://***.my.salesforce.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'none'".
So I went to Salesforce's login page and indeed, there is a policy header that prevents it from being loaded from within an Iframe.
What is the correct way to authenticate the user with Salesforce in this situation?
Thank you very much
If you are calling a web app inside of an Iframe(Aura component) it would require the Salesforce domain calling it to be whitelisted in the web app.

Loading modules in angular2 application on the fly

In my current angular 2 (ionic) project I'm trying to achieve the following. I have a base application which authenticates a user to a known backend. When this is done, the user receives a number of modules he can use. These modules are separate bundles that are fetched from the server at runtime.
The logical view is something like this:
So, there is an application server that holds the server side of the application, and there is a device side of the application that is installed. Only the green parts are always there. The blue parts (the modules) are deployed separately and are loaded only then a user has access to it.
The modules use a shared services API (networking, authentication, access to device specific features via Cordova etc.) and have their own, also seperately deployable webservices on the appserver/backend.
I would like to give a module programmer the opportunity to create an angular component that consumes a webservice and use the shared API. How can I load a component from the appserver into my app running on the device?
[edit]
Q: Can you give an example of a loaded module?
A: Basically it can be anything that consumes a webservice deployed on the appserver. In a normal case it would consist of a combination of html and javascript (perhaps with some additional css).
Let's say we have a list of persons in the database, and a webservice that queries it, then the device gets a angular component with templates (I was thinking of the Ng2 version of a templatecache js file) which it should 'inject' into the running application.
It should be remarked that a restart of the application on the device is not out of the question.

Communication between a Mac app & local website/server

I want to control a mac app via a local website. I think the best way is to create a webserver with my mac app and then to send (primarily) integer values from the website and vice versa.
I found already CocoaHTTPServer, but I'm not sure how to do it.
For start with I want to have a slider on the website, that updates a slider in my mac application (and vice versa)
You will initiate on a separate thread or operation the web server and always wait for incoming requests. Whenever you receive a request you will handle it accordingly.
Also, if you are using this: https://github.com/robbiehanson/CocoaHTTPServer/
then there are a few examples that show how to do it. Copy the code from there to begin with the web server handling requests. After that, think through what you want to send and what you want to do. Build a form or something for the web site and submit a request to the web server.
CocoaHTTPServer will let you embed the web server into your application, which is a fine solution for what you're trying to accomplish.
Some thoughts on how to engineer it:
You'll need to subclass HTTPConnection.
Model your solution on the PostHTTPServer example.
You could get the data you want to send into the URL. Something like POST http://localhost:12345/updateSlider/123. (You probably don't need an actual POST, but no reason it wouldn't work. Technically a PUT would be more correct.)
Start by handling that part – where the browser sends a value to your application. To generate POST/PUT requests for testing purposes, use curl, or else build a static page and open it in your browser.
When you get that working, then worry about presenting a web page to the user.

Mac - Launch desktop application from browser passing parameters

I have written a click-once deployed application in .Net that runs on windows machines. I had a requirement to launch the application from a browser so that I can pass information to the application based on the current browser session (the HTTPHeadercontains a single-sign-on id that needs to be passed to the application so it can call secured web services).
So the click-once application is provided as a link on a jsp, and the required id is passed as a querystring parameter in the link, which the click once application can read).
Now I need to make similar functionality available for Mac users. Is there any way to do this that doesn't require Java? I would like to write in Objective C, but then the question of how to trigger the launch of the application from the browser, passing the necessarily information remains.
The flow is:
User hits link to our site
User is routed to single sign-on authentication form
User submits form and is redirected to our site (with id embedded in HTTPHeader)
Server builds page with a link to Click Once application with id appended as a querystring parameter
User clicks link, click once deployed app is downloaded and executed with full trust on the users computer (the app is signed with a code signing cert).
Application runs locally on users computer and calls RESTful web services on server passing the single-sign-on ID as a cookie along with the web request which allows the request to make it through.
I would appreciate any ideas that point me down the right path, as I am primarily a windows developer.
Thanks!
I just saw your request to my original post on this topic.
The need for this was put on the back burner for a time, but the solution that we will probably pursue is to have a server-side process that modifies the delivered Zip or DMG file on-the-fly. The additional information would be inserted into the application's Info.plist file. This will not invalidate the cryptographic signature, and does not require anything additional to be downloaded.

open screen/view (iPhone app)

I have a iOS developer. He is writing he iPhone app.
I am writing the web service that is used by the iPhone app.
The mobile app has many screens (or views what do you call it?)
What response does my web service need to respond with so that the mobile app knows what screen to open. There are many screens, and different screen input parameters.
Note: im not an objective-c developer. So I dont know what my developer wants my web service to respond with.
ASK YOUR DEVELOPER! (and they're called views). Someone developing a web service shouldn't be worried about views, that's definitely a dev issue
It depends on requirement you don't need to do anything with screens(views). This depends on Requirement of the project. What data has o be displayed for a specific screen you need to create functions for that only. The developer will call your web service function and your web service will return response in format of json(I prefer because it's lightweight and fast) or XML. The ios developer will parse the response and display the data on screen. Now it's up to him how he uses your web services. For example assume there is login screen so iphone app will send you user name and password your web service validate the credential and send response as success or failure. I hope you understand.