Review Board 1.7.22


Gadget Admin Code Does Not Take Into Account Ports In Gadget URLs

Review Request #2425 - Created Oct. 18, 2011 and submitted

Ryan Baxter
SHINDIG-1643
Reviewers
shindig
ddumont
shindig
If there is a gadget in the admin store, for example http://foo.com/gadget.xml and we try to render http://foo.com:80/gadget.xml shindig does not think http://foo.com:80/gadget.xml is the same as http://foo.com/gadget.xml are the same gadget so it does not think the gadget should be allowed to render.
Updated unit tests to test new functionality

Changes between revision 1 and 3

1 2 3
1 2 3

  1. http://svn.apache.org/repos/asf/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/admin/ContainerAdminData.java: Loading...
http://svn.apache.org/repos/asf/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/admin/ContainerAdminData.java
Diff Revision 1 Diff Revision 3
[20] 161 lines
[+20] [+] private String getGadgetAdminDataKey(String gadgetUrl) {
162
        break;
162
        break;
163
      }
163
      }
164
    }
164
    }
165
    return key;
165
    return key;
166
  }
166
  }
167
  
167

   
168
  /**
168
  /**
169
   * Creates a new URL with the default port if one is not already there.
169
   * Creates a new URL with the default port if one is not already there.
170
   *
170
   *
171
   * @param gadgetUrl
171
   * @param gadgetUrl
172
   *          The gadget URL to add the port to.
172
   *          The gadget URL to add the port to.
[+20] [20] 7 lines
[+20] [+] private String createUrlWithPort(String gadgetUrl) {
180
      if (origUrl.getPort() <= 0 && origHost != null && origHost.length() != 0
180
      if (origUrl.getPort() <= 0 && origHost != null && origHost.length() != 0
181
              && !STAR.equals(origHost)) {
181
              && !STAR.equals(origHost)) {
182
        if (origUrl.getProtocol().equalsIgnoreCase(HTTP)) {
182
        if (origUrl.getProtocol().equalsIgnoreCase(HTTP)) {
183
          urlWithPort = new URL(origUrl.getProtocol(), origUrl.getHost(), HTTP_PORT, origUrl.getFile());
183
          urlWithPort = new URL(origUrl.getProtocol(), origUrl.getHost(), HTTP_PORT, origUrl.getFile());
184
        }
184
        }
185
        if (origUrl.getProtocol().equalsIgnoreCase(HTTPS)) {
185
        else if (origUrl.getProtocol().equalsIgnoreCase(HTTPS)) {
186
          urlWithPort = new URL(origUrl.getProtocol(), origUrl.getHost(), HTTPS_PORT, origUrl.getFile());
186
          urlWithPort = new URL(origUrl.getProtocol(), origUrl.getHost(), HTTPS_PORT, origUrl.getFile());
187
        }
187
        }
188
        return urlWithPort == null ? origUrl.toString() : urlWithPort.toString();
188
        return urlWithPort == null ? origUrl.toString() : urlWithPort.toString();
189
      } else {
189
      } else {
190
        return origUrl.toString();
190
        return origUrl.toString();
[+20] [20] 22 lines
  1. http://svn.apache.org/repos/asf/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/admin/ContainerAdminData.java: Loading...