i'm looking for nice tutorial or, maybe, some tips how to implements web sockets in multi-page web project.
For example i have welcome page and some link here. When i press on link i should be redirected to www.domainname.com/anypath with another fields and data.
To interact with the server i need to use web-socets. How many Server and client endpoint i should create? New endpoint for each page, or only 1 endpoint for each page?
I'm really trying to research it in google but there only tutorials with one page without any user navigation.
in simple realisation you create a websocket connection per each page, but if want optimize your application possible create one connect per all tabs.
for this optimize your can see how this realized in my open source comet server in file CometServerApi.js
In two words in file CometServerApi.js establishing a one connection to server from first opened tab ( i call this master tab), and other tabs send and receive message through master tab
For communications between tab i use event onstorage emerging on all tabs when i write any data to localstorage in any tab.
Related
I have done researches on Google, many posts and answers gave me ready-to-use packages or the example is not in Java. I am not looking for solutions to this question.
I want to understand how live streaming from security camera on the web pages can be implemented and in Java.
First of all, there is no video file recorded beforehand because it is about live streaming from security camera. But one should be able to watch the video later on as well.
My questions are:
Do I always need to record the video first and use that video on the web page so that video can be live-streamed and can be watched later on? Or live streaming and video recording/saving in a file can be in two separate processes?
Is WebSocket Server the only solution to push video data to the web browser continuously?
In case of WebSocket Server pusing video data to the web browser, what kind of data should be pushed to the web browser?
On the web page, must I use the <img> tag to show the live-streaming video?
Solution 1: From the post below, the Java WebSocket Server pushes the ByteBuffer object containing byte data to the web browser. But this solution first takes video data from the web browser (client), sends the data to the WebSocket Server and then just receives the converted version of data back. It is like a round trip.
https://javawebsocketsvideo.blogspot.com/
Solution 2: And this code sample shows that Java Server sends DatagramPacket object containing byte data to its client. But this solution works with existing video file (not live-streaming) and its client is not a web page.
https://github.com/ramanbuttar/video-streaming/blob/master/Server.java
That's why these solutions did not clear my questions.
I am using Struts 1.x framework in my web application .
When the user hits the application URL... ..intranet link is fetched from the db and it should generate the PDF and send this to the user..
Shall I use response.sendRedirect(intranet link);
Will this work in public server(internet)?
Please help me with this
A browser on the web will in general not be able to fetch something from the intranet.
The expensive alternative is to fetch the files from the intranet by your application, and stream them out.
If the intranet uses a user authentication, browser based, maybe Windows Active Directory (via LDAP), maybe SAML, then it gets even harder.
Pragmatic might be to send an e-Mail with the link, allowing the user to get the document in-house only.
I have one application who has two parts one is display module which is web based using j2ee and other is my backend service module which is on java. I have one page which has 4 tabs which has graphs. When click on tab, it sends start request to my backend application to start sending live data on my page. Problem is when I change the page to other page, my backend service keeps on sending the data. I want some way from which I can send stop request to my service program, when I change the page or close the browser. Please provide me some idea.
The first part of the requirement is to be able to embed our website (say www.mysite.com) into our partners' websites (say www.partner1.com).
Second part is the customer visiting our pages from the partners' website should be able to bookmark our pages (Bookmarked link www.partner1.com/page/sample.jsp should take the user to www.mysite.com/page/sample.jsp internally). Customer should see www.partner1.com/page/sample.jsp in the address bar and should not know that the page is being served by www.mysite.com.
Hence iFrame is out of question. Is there any better way of doing so? Is there a product that supports this kind of embedding?
We eventually want to embed our site with multiple partners and provide the same bookmarking feature.
What you're looking for is a reverse proxy. This is a web server component running on your partner's site, that fetches pages from your server and delivers them to the end customer. Apache defines a reverse proxy as:
A reverse proxy (or gateway), by contrast, appears to the client just like an ordinary web server. No special configuration on the client is necessary. The client makes ordinary requests for content in the name-space of the reverse proxy. The reverse proxy then decides where to send those requests, and returns the content as if it was itself the origin.
This in turn is more of a system administration question than a programming question. I don't know what web server your partner is using, but the relevant Apache documentation is here. If you want secrecy, check the web server headers carefully to ensure information doesn't leak out.
I have a simple requirement. I have an web application which has a login page, a dashboard and few other pages.
If the user wants to open the application in multiple browser window from a single computer, then I want the user to login only once in first browser window. From next time onwards, whenever user hits the application URL in another different browser window(or tab) in the same Computer, then the application should redirect the user to dashboard without a fresh login. So that user does not have to login each time he opens the application in another browser window.
Is this complete scenario possible in Java/J2EE using JSP and Struts. Here I am using container managed login in Struts for the authentication(login). I need to maintain different HTTP sessions for each window(this is inherent requirement of the application).
Plz guys, waiting for a quick reply as I am stuck with this very urgent requirement from my Client.
Thanks in advance.
Avijit
In the same browser (IE, Firefox, Chrome etc), this is easily achieved with (session) cookies etc.
After login, just set a cookie that subsequent page loads will read from.
Read this question for some good additional related information:
Managing webapp session data/controller flow for multiple tabs
As #Edwin Buck has already mentioned, have a look at OpenID (or a similar single-sign-on framework):
OpenID
You've also got the option of using the client's IP address, but this is hideously insecure.
Look at the single sign-on architecture, or other solutions (like OpenId) which do authentication without end user interaction.