代码之家  ›  专栏  ›  技术社区  ›  Alix Axel

构建Isaurus URL

  •  1
  • Alix Axel  · 技术社区  · 16 年前

    我试着用 Reducisaurus Web Service

    假设我有两个未统一的CSS在:

    http:/domain.com/dynamic/styles/theme.php?color=red
    http:/domain.com/dynamic/styles/typography.php?font=Arial
    

    根据文档,我应该这样称呼web服务:

    http:/reducisaurus.appspot.com/css?url=http:/domain.com/dynamic/styles/theme.php?color=red
    

    如果我想同时缩小两个CSS文件:

    http:/reducisaurus.appspot.com/css?url1=http:/domain.com/dynamic/styles/theme.php?color=red&url2=http:/domain.com/dynamic/styles/theme.php?color=red
    

    http:/reducisaurus.appspot.com/css?url=http:/domain.com/dynamic/styles/theme.php?color=red&expire_urls=3600
    

    对于两个CSS文件:

    http:/reducisaurus.appspot.com/css?url1=http:/domain.com/dynamic/styles/theme.php?color=red&url2=http:/domain.com/dynamic/styles/theme.php?color=red&expire_urls=3600
    

    现在我的问题是,ReduceSaurus如何知道如何分离我想要的URL?它怎么知道的 &expire_urls=3600 不属于 &url2=... 不是GET参数 url1 urlencode 我的网址?

    我瞥了一眼源代码,虽然我的Java非常差,但是 methods acquireFromRemoteUrl() and getSortedParameterNames() from the BaseServlet.java file 保留我问题的答案-如果GET参数名称包含 - _ 忽略 ?!

    多个呢 &url(n) 什么?

    2 回复  |  直到 15 年前
        1
  •  1
  •   pinkgothic sudip    16 年前

    例如。

    http://google.com
    

    变成

    http%3A%2F%2Fgoogle.com
    

    如果这样做,就不会有像?,&,=诸如此类的事情在可能使Web服务混乱的过程中幸存了下来。

    (不太清楚你的第二个问题是什么,抱歉。)

        2
  •  1
  •   Fortega    16 年前

    以url开头的所有内容都被视为新url,因此不能将名为url2的参数作为url1的get参数传递。

    每个不包含“-”的参数名都将被视为输入。

    所以如果你这么做了

    ...?file1=...&url1=...&max-age=604800,
    

    然而,

    ...?file1=...&url1=...&maxage=604800
    

    在这里,maxage将被视为输入。