ICEfaces
  1. ICEfaces
  2. ICE-8734

showcase source servlet ur broken in some environment

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1, 3.2
    • Fix Version/s: 3.2
    • Labels:
      None
    • Environment:
      any

      Description

      It was found that httpRequest.getLocalName() in the SourceCodeLoaderConnection.java was returning an 0:0.0:0.0:0.0:1 for the device's IP address in environment, which have 2 nic interfaces and one of them is not bound to any ip. so that the contructed URL is a malformated one.

        Activity

        Hide
        Liming Wu added a comment - - edited

        By looking the source and noticed the url SOURCE_SERVLET_URL is constructed by httpRequest.getLocalName() as shown:
        SOURCE_SERVLET_URL = "http://" +
        httpRequest.getLocalName() +
        ":" +
        httpRequest.getLocalPort() +
        httpRequest.getContextPath() +
        "/";
        This is not reliable as getLocalName() may not return something url friendly. due to various native layer variations. It should be replaced by

        String hostName = "localhost";
        try

        { URL requestUrl = new URL(httpRequest.getRequestURL().toString()); hostName = requestUrl.getHost(); } catch (MalformedURLException mfException) {}
        SOURCE_SERVLET_URL = "http://" +
        hostName +
        ":" +
        httpRequest.getLocalPort() +
        httpRequest.getContextPath() +
        "/";

        ICE-8340 is not related to this issue but the improvement for ICE-8340 happens in the same code block.

        was:
        It was found that httpRequest.getLocalName() in the SourceCodeLoaderConnection.java was returning an 0:0.0:0.0:0.0:1 for the device's IP address in environment, which have 2 nic interfaces and one of them is not bound to any ip. so that the contructed URL is a malformated one.

        By looking the source and noticed the url SOURCE_SERVLET_URL is constructed by httpRequest.getLocalName() as shown:
        SOURCE_SERVLET_URL = "http://" +
        httpRequest.getLocalName() +
        ":" +
        httpRequest.getLocalPort() +
        httpRequest.getContextPath() +
        "/";
        This is not reliable as getLocalName() may not return something url friendly. due to various native layer variations. It should be replaced by

        String hostName = "localhost";
        try { URL requestUrl = new URL(httpRequest.getRequestURL().toString()); hostName = requestUrl.getHost(); }

        catch (MalformedURLException mfException) {}
        SOURCE_SERVLET_URL = "http://" +
        hostName +
        ":" +
        httpRequest.getLocalPort() +
        httpRequest.getContextPath() +
        "/";

        Show
        Liming Wu added a comment - - edited By looking the source and noticed the url SOURCE_SERVLET_URL is constructed by httpRequest.getLocalName() as shown: SOURCE_SERVLET_URL = "http://" + httpRequest.getLocalName() + ":" + httpRequest.getLocalPort() + httpRequest.getContextPath() + "/"; This is not reliable as getLocalName() may not return something url friendly. due to various native layer variations. It should be replaced by String hostName = "localhost"; try { URL requestUrl = new URL(httpRequest.getRequestURL().toString()); hostName = requestUrl.getHost(); } catch (MalformedURLException mfException) {} SOURCE_SERVLET_URL = "http://" + hostName + ":" + httpRequest.getLocalPort() + httpRequest.getContextPath() + "/"; ICE-8340 is not related to this issue but the improvement for ICE-8340 happens in the same code block. was: It was found that httpRequest.getLocalName() in the SourceCodeLoaderConnection.java was returning an 0:0.0:0.0:0.0:1 for the device's IP address in environment, which have 2 nic interfaces and one of them is not bound to any ip. so that the contructed URL is a malformated one. By looking the source and noticed the url SOURCE_SERVLET_URL is constructed by httpRequest.getLocalName() as shown: SOURCE_SERVLET_URL = "http://" + httpRequest.getLocalName() + ":" + httpRequest.getLocalPort() + httpRequest.getContextPath() + "/"; This is not reliable as getLocalName() may not return something url friendly. due to various native layer variations. It should be replaced by String hostName = "localhost"; try { URL requestUrl = new URL(httpRequest.getRequestURL().toString()); hostName = requestUrl.getHost(); } catch (MalformedURLException mfException) {} SOURCE_SERVLET_URL = "http://" + hostName + ":" + httpRequest.getLocalPort() + httpRequest.getContextPath() + "/";
        Hide
        Liming Wu added a comment - - edited

        Fixed in Eclipse tool bundle with IF 3.2 release.

        Show
        Liming Wu added a comment - - edited Fixed in Eclipse tool bundle with IF 3.2 release.
        Hide
        Liming Wu added a comment - - edited

        Affects: Sample App./Tutorial
        Fix Version/s: 3.3
        Resolution: Fixed
        Fixed

        Show
        Liming Wu added a comment - - edited Affects: Sample App./Tutorial Fix Version/s: 3.3 Resolution: Fixed Fixed

          People

          • Assignee:
            Liming Wu
            Reporter:
            Liming Wu
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: