首页 \ 问答 \ 完美,快捷,从处理程序中的请求获取服务器地址(Perfect, swift, getting server address from request in handler)

完美,快捷,从处理程序中的请求获取服务器地址(Perfect, swift, getting server address from request in handler)

在请求处理程序中,处理例如GET https://example.com/collections/1或POST http://0.0.0.0:8080/collections如何获取服务器地址https://example.comhttp://0.0 .0.0:8080分别?

目前我正在像这样构建它

 var url = "\(httpPrefix)\(server.serverAddress)"
 if server.serverPort != 443 { url += ":\(server.serverPort)" }

其中httpPrefix是:

let httpPrefix = isLinux ? "https://" : "http://"

但感觉好像还有更好的办法......


In request handler, processing e.g. GET https://example.com/collections/1 or POSThttp://0.0.0.0:8080/collections how do I get server address https://example.com and http://0.0.0.0:8080 respectively?

Currently I'm constructing it like so

 var url = "\(httpPrefix)\(server.serverAddress)"
 if server.serverPort != 443 { url += ":\(server.serverPort)" }

where httpPrefix is:

let httpPrefix = isLinux ? "https://" : "http://"

But it feels like there's a better way...


原文:https://stackoverflow.com/questions/42958284
更新时间:2023-11-21 18:11

最满意答案

没有办法简单地从Code Review中排除源控制的DLLS。

Daniel是对的,对于这种外部DLL,最好的和干净的方式是通过诸如NuGet的包管理解决方案。 在TFS中有一个很好的扩展叫做Package Management。 这并不难,也不会花太多时间来做到这一点。

软件包管理是一个扩展,可以轻松发现,安装和发布软件包。 它与Build等其他Team Services和TFS中枢深度集成,因此软件包管理可以成为现有工作流程的无缝部分。

有关更多详细信息,请参阅本教程 - 团队服务和TFS中的包管理

此外,也没有任何内置的高级过滤器(例如排除注释,空白,新行)。 官方教程供您参考: 使用Visual Studio获取您的代码

你也可以尝试在VS中使用一些第三方扩展,比如这个: Review Assistant - 代码评论工具 ,它也支持TFS集成。


There is no way to simply exclude source controlled DLLS from Code Review.

Daniel is right, for this kind of external dlls, the best and clean way is via the package management solution such as NuGet. There is an excellent extension called-- Package Management in TFS. It's not hard and will not take too much time to do this.

Package Management is an extension that makes it easy to discover, install, and publish packages. It's deeply integrated with other Team Services and TFS hubs like Build so that package management can become a seamless part of your existing workflows.

For more details, you could have a look at this tutorial-- Package Management in Team Services and TFS

Besides, there is also not any built-in advanced filter (e.g. exclude comments, white spaces, new lines). The official tutorial for your reference: Get your code reviewed with Visual Studio

You could also try to use some 3-rd party extension in VS such as this one: Review Assistant - Code Review Tool which also support TFS integraton.

相关问答

更多
  • 正如Ivan所提到的,你的根本原因不在于缺乏分析工具,而是在开发团队和项目赞助商之间达成的(或目前正在团队成员之间)达成的质量和严格程度。 可能是团队的压力太大,导致重要的审查行动被忽略,或者团队(或赞助商!)与您或赞助商没有同样的质量愿望。 或者说团队没有足够的知识来防止这些问题的发生。 最好的方法是在短时间内尽可能多地修复。 警告 :我和很多团队一起经历了同时打开太多规则的影响。 一般来说,人们不愿意承认他们的工作没有达到标准,并且制定不直接导致错误的规则(例如,“标识符不正确”)可能会导致挫败感,严重 ...
  • 不幸的是,没有“适当”的方式来做你想要做的事情。 您可以将您的工作目录放在共享驱动器上,并在您准备好开始审核过程时通知您的审核人员,但是通过不在TFS中正式记录每个开发/审核迭代来实现问责制。 这意味着您应该检查您的工作并让审阅者完成他们的工作,然后继续以这种方式进行审阅者请求的任何更改,签入并获得另一个代码审查。 为了完整起见,我也会在这里的评论中提到我的建议。 我的建议是创建一个自包含,短命的开发分支,您将在其中进行开发并检查代码。 然后,一旦开发和审查完成到满意,该分支就可以合并备份并销毁。 这提供了 ...
  • 将项目A的变更集与项目B中的工作项相关联是可以的。 只需在工作项中添加一个Changeset链接,该链接指向存储在另一个项目中的代码。 它不会尝试将代码更改奇怪地合并到项目B中。 在封面下,Code Review实际上只是一个指向Shelveset的工作项,因此它与上面的场景相同,没有问题将它们放在单独的项目中,它不会影响Project B的源代码。 这里的诀窍是您可能想要在项目B中创建代码审查工作项,最简单的方法是确保团队资源管理器指向项目B而不是项目A. 将工作项和代码放在单独的项目中并不理想,但这很常 ...
  • 没有办法简单地从Code Review中排除源控制的DLLS。 Daniel是对的,对于这种外部DLL,最好的和干净的方式是通过诸如NuGet的包管理解决方案。 在TFS中有一个很好的扩展叫做Package Management。 这并不难,也不会花太多时间来做到这一点。 软件包管理是一个扩展,可以轻松发现,安装和发布软件包。 它与Build等其他Team Services和TFS中枢深度集成,因此软件包管理可以成为现有工作流程的无缝部分。 有关更多详细信息,请参阅本教程 - 团队服务和TFS中的包管理 此 ...
  • 我们不能改变状态,这是设计的。 但是,您可以使用查询类型: Work items and direct links来区分State = Requested的Code Review Response: 查询属于已关闭代码Code Review Response的Code Review Response项: 查询属于活动 ( 未关闭 )代码Code Review Response的Code Review Response项: We cannot change the sate, it's by design. ...
  • 您无法重新打开代码审核,您需要创建一个新的代码审核。 You cannot re-open a code review, you will need to create a new one.
  • 所以 - 在完成创建我的问题时找到了这个:-) 右键单击文件并选择添加文件注释。 So - found this when finishing creating my question :-) right click on file and select add file comment.
  • 所有代码审查请求实际上都是TFS工作项目。 您可以通过使用Excel批量更新它们来批量关闭它们,就像对任何其他工作项一样。 要做的方法是从团队资源管理器中代码评论部分右上方的链接打开您的代码评论查询 进入查询模式后,点击“保存查询”以保存您的代码审查查询。 现在点击“在Excel中打开查询”按钮 这将为你打开一个excel表单。 更改您想要更新的每个代码审查工作项目的状态。 然后单击“团队”菜单并使用“发布”按钮在TFS中进行更改。 All code review requests are in fact ...
  • 是的,这是可能的。 您可以为团队成员创建代码审阅提醒。 首先,您必须配置SMTP服务器以支持TFS。 其次,您必须是Project Collection Administrator或Team Foundation Administrator组的成员。 如果您不是这些组的成员,那么您将看http://tfsserver:8080/tfs/DefaultCollection/teamproject/_admin/_alerts用于管理警报的http://tfsserver:8080/tfs/DefaultCol ...
  • 是。 可以选择取消隐藏更改,并且可以完全按照您的要求进行操作。 Yes. There is the option to Unshelve changes and that does exactly what you want.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)