tyrus
  1. tyrus
  2. TYRUS-93

ClientEndpoint session.getRequestURI()==null

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0-b12
    • Fix Version/s: 1.0-b12
    • Component/s: None
    • Labels:
      None
    • Environment:

      uname -a
      Linux mikc 3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:25:57 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

      Description

      The following code will raise NPE on line where we want to obtain the session:

      logger.log(Level.INFO, "Client connecting:{0}", s.getRequestURI().toString());
      
      public class ProgrammaticClient extends Endpoint {
          private static final Logger logger = Logger.getLogger(HandShake.class.getCanonicalName());
      
          @Override
          public void onOpen(Session s, EndpointConfiguration ec) {
              logger.log(Level.INFO, "Client connecting:{0}", s.getRequestURI().toString());
              final RemoteEndpoint remote = s.getRemote();
              s.addMessageHandler(
                      new MessageHandler.Basic<String>() {
                          @Override
                          public void onMessage(String recv) {
                              try {
                                  //FIXME TC: s.close(new CloseReason(CloseReason.CloseCodes.TRY_AGAIN_LATER, recv));
                                  remote.sendString(messageHandler(recv));
                              } catch (IOException ex) {
                                  logger.log(Level.SEVERE, null, ex);
                              }
                          }
                      });
              try {
                  remote.sendString("client:open");
              } catch (IOException ex) {
                  logger.log(Level.SEVERE, null, ex);
              }
          }
      
          public String messageHandler(String message) {
              logger.log(Level.INFO, "client message={0}", message);
              if(message.equals("client:open")) {
                  
              }
              return message;
          }
      }

        Activity

        Hide
        Pavel Bucek added a comment -

        fixed in the trunk

        Show
        Pavel Bucek added a comment - fixed in the trunk

          People

          • Assignee:
            Pavel Bucek
            Reporter:
            mikc22
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: