duanji2772 2011-06-19 00:43
浏览 25
已采纳

何时使用url和path

Is there a rule of thumb in which cases I should use an URl and in which a path?

Example:

C:\some-path\to-my\local-dev-environment\xampp\whatever

vs.

http://localhost/whatever

EDIT: What I want to acchieve is a "safe" list in which cases I should use/avoid using and URl and in which I should use/avoid a path. Additional: What impact on performance does it have?

  • 写回答

3条回答 默认 最新

  • dongne1560 2011-06-19 00:48
    关注

    It's really a question of access.

    If the entity in question has legitimate access to your file system then go with the path.

    If the entity does not have access to your file system, but you would still like to grant him some sort of access via a web technology, then go with a URL.

    EDIT

    Performance:

    The Path is always be more performant since it is generally used on the same computer (server) or at least on the same intranet. Aside from also bypassing the Web protocols used by URLs.

    The URL is always considered less performant since the request is being routed through an HTTP,FTP, or other protocol which then converts the request to a Path request and then serves the file to the end destination. So what you should realize is that all URL (file) requests eventually get converted to a Path. In this sense, URL is just another way to access the Path of another computer via a web technology.

    "Safe" list (not comprehensive):

    Use URLs for

    • Wiki, Microsoft Sharepoint, other Portal type access
    • Integrating with a third party app that is external to your environment (hosted outside your network)
    • Sharing a document across your disconnected intranets
    • Sharing a public document to the world

    Use Path for

    • Local file CRUD operation (Create, Read, Update, Delete)
    • Integrating with a third party app that is internal to your environment (hosted on your network)
    • Local Intranet CRUD operations

    More or less here is here general rule of thumb.

    If you can navigate to the file without using a URL that's probably how you should access it with your program.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP