How to access the client hostname, HTTP headers, etc. From a Java WebSocket serv...
source link: https://www.codesd.com/item/how-to-access-the-client-hostname-http-headers-etc-from-a-java-websocket-server.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How to access the client hostname, HTTP headers, etc. From a Java WebSocket server?
I've followed many tutorials and sample sample code but I am yet to see a way to access client's HTTP header, hostname etc like the way we can in Servlet's request object.
How do I go about it?
Let's say I've onOpen defined as-
@OnOpen
public void onOpen(Session session) {
}
In above method, is there a way I can access underlying HTTP connection details using session field? I am okay even if I can get to underlying Servlet (if there is any)
see chapter 4.1.1.5 at Tyrus user guide. It requires some amount of work to get the info from ServerEnpointConfig.Configurator to endpoint instance, but it can be done. (see ModifyRequestResponseHeadersTest.java)
Related Articles
how to access the client application (Scanner or .exe) installed on the client device using the Asp.net web application
How to access the sub-method inside a method from a jquery plugin?
how to access the client-side file in the server side using asp.net
How to let the client download and upload files from S3 without compromising credentials
C # How to access the static class List & lt; & Gt; From another class
How to force the client browser to download images from the server rather than its cache
How to access the properties of an object returned from a primary key query in Realm Swift
How to access the buttons of a parent form from a child form that inherits
How to access the protected field of a super class in java from subclasses?
how to make the client socket wait for data from the server socket
How to add the client's http header in response to the Azure function
How to access the client cookie (with session ID) created by node.js Express?
How to access the URL of a website programmatically from the page
How to access the session in MVC.Net 4 from different threads
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK