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

        Migration created issue -
        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.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #31980 Mon Nov 05 10:03:20 MST 2012 liming.wu ICE-8734 replaced httpRequest.getLocalName().
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/samples/showcase/showcase/src/main/java/org/icefaces/samples/showcase/util/SourceCodeLoaderConnection.java
        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
        Migration made changes -
        Field Original Value New Value
        Reporter Migration [ remote ] Liming Wu [ liming.wu ]
        Migration made changes -
        Assignee Liming Wu [ liming.wu ]
        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.

         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() +
                                         "/";
         
        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.
        Migration made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Fix Version/s 3.2 [ 10338 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: