3 Replies Latest reply: Mar 16, 2014 3:02 PM by rp0428 RSS

    websocket integration with jsp and servlets

    user12021554

      Team:
      I am familiar with Servlet/jsp's and developed a web application using them. Now I am looking in Websocket of Java 7. Documentation is not clear how to integrate the two.

       

      1. Let us say in my listener, I have already determined database connections, log file for log4j  etc.. Can I use it in Websocket Java classes based on annotation API of web socket. What is not clear to me how I  will access Context parameters for webapp saved in Listener.
      Any pointers will  be greatly appreciated.

      2. I like jsp so I can dynamically modify the html to be shown. If I am using api, how will I do that, I know I can return data from websocket, but all the java logic which jsp provides, how can that be

      implemented using web socket api.

       


      Prem

      Show trimmed content 

       

       

       
        • 1. Re: websocket integration with jsp and servlets
          448095

          Your question is unclear. Please describe clearly what you're trying to accomplish, and why you think sockets are necessary/desirable. Unless you're communicating with some outside source you didn't mention, sockets aren't usually part of Web applications, which use HTTP and/or Ajax rather than sockets.

           

          Are you you thinking you need to eavesdrop on the the Web server's HTTP listener (usually on port 8080)? Unless you have a really unusual requirement, interfering with the server's listener is almost always a bad idea.

          • 2. Re: websocket integration with jsp and servlets
            user12021554

            I am talking abot websockets introduced in Java 7. They are bettwer than Ajax and http, because they provide two way connection and overcome http's stateless protocol.

            • 3. Re: websocket integration with jsp and servlets
              rp0428
              I am talking abot websockets introduced in Java 7.

              Yes - you said that - and without providing ANY link or reference to WHAT documentation you are talking about that is 'unclear'.

               

              You also just ignored what you  were ask to do:

              Please describe clearly what you're trying to accomplish, and why you think sockets are necessary/desirable.