首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏大内老A

    UriTemplate、UriTemplateTable与WebHttpDispatchOperationSelector

    1: public class UriTemplate 2: { 3: //其他成员 4: public UriTemplate(string template); 5: public UriTemplate(string template, bool ignoreTrailingSlash); 6: public UriTemplate(string UriTemplate对象关联。 而MatchSingle方法被执行的时候会在内部调用Match方法,如果没有匹配的UriTemplate,返回Null;如果只有唯一匹配的UriTemplate,则返回对应的UriTemplateMatch <UriTemplate, object>(new UriTemplate(template),operation.Name)); 22: } 23: } 24: 

    1.3K60发布于 2018-02-07
  • 来自专栏BAT的乌托邦

    三、原生Feign的核心API详解(一):UriTemplate、HardCodedTarget...

    ** public List<String> getVariables() { ... } } 该类并不是抽象类,并且它还有4个子类,分别对应着可以使用模版语法的几个注解: ---- UriTemplate 顾名思义,它是用于处理URI的模版,用于处理@RequestLine的模版 public class UriTemplate extends Template { public static UriTemplate create(String template, Charset charset) { return new UriTemplate(template, true, charset 使用示例: @Test public void fun1() { UriTemplate template = UriTemplate.create("http://example.com/ // 最重要的方法:用于把请求模版组装、加上Base Url、转换为一个真正的Request // 此input模版里包含有很多的:QueryTemplate/HeaderTemplate/UriTemplate

    4.5K42发布于 2020-02-21
  • 来自专栏跟着阿笨一起玩NET

    如何创建一个RESTful WCF Service

    WCF Service》中的web.config,因为需要AJAX,endpointBehaviors用了<enableWebScript />,但是enableWebScript 和REST需要的UriTemplate return Guid.NewGuid(); } [OperationContract] [WebInvoke(Method = "DELETE", UriTemplate { return; } [OperationContract] [WebInvoke(Method = "POST", UriTemplate Employee employee) { return; } [OperationContract] [WebGet(UriTemplate return Guid.NewGuid(); } [OperationContract] [WebInvoke(Method = "DELETE", UriTemplate

    92910发布于 2018-09-19
  • 来自专栏大内老A

    ASP.NET路由系统实现原理:HttpHandler的动态映射

    篇幅所限,我们不能对WCF REST的UriTemplate作详细的介绍,有兴趣的读者可以参考《UriTemplate、UriTemplateTable与WebHttpDispatchOperationSelector [源代码从这里下载] 我们创建一个新的ASP.NET Web应用,并且添加针对程序集System.ServiceModel.dll的引用(UriTemplate定义在该程序集中),然后创建如下一个针对UriTemplate 1: public class UriTemplateRoute:RouteBase 2: { 3: public UriTemplate   UriTemplate { get; 在匹配的情况下通过调用UriTemplate的BindByName方法得到一个完整的Uri。 我个人具有基于UriTemplate的URI模板比针对Route的URL模板更好用,其中一点就是它在定义默认值方法更为直接。

    2K60发布于 2018-01-15
  • 来自专栏程序那些事

    SpringBoot之:SpringBoot的HATEOAS基础

    所以Link还可以通过UriTemplate来构建: public static Link of(UriTemplate template, String relation) { return new Link(template, relation); } public static Link of(UriTemplate template, LinkRelation relation) { return new Link(template, relation); } UriTemplate是对URI模板的封装,我们看一个使用的例子: Link 除了直接使用string之外,还可以传入UriTemplateUriTemplate template = UriTemplate.of("/{segment}/something") .with

    60620编辑于 2022-06-17
  • 来自专栏程序那些事

    SpringBoot之:SpringBoot的HATEOAS基础

    所以Link还可以通过UriTemplate来构建: public static Link of(UriTemplate template, String relation) { return new Link(template, relation); } public static Link of(UriTemplate template, LinkRelation relation) { return new Link(template, relation); } UriTemplate是对URI模板的封装,我们看一个使用的例子: Link 除了直接使用string之外,还可以传入UriTemplateUriTemplate template = UriTemplate.of("/{segment}/something") .with

    46910编辑于 2022-07-27
  • 来自专栏BAT的乌托邦

    [享学Feign] 七、请求模版对象RequestTemplate和标准请求对象feign.Request

    可以把该类理解为UriTemplate的一个增强版,处理URI外,还有Headers、Body等更多的信息来支持一个标准的Http请求。 uriTemplate; // 注意:此处target表示的是最终准备请求的URL,并非feign.Target private String target; // 拼接在url后面的片段,一般表示锚点 = UriTemplate.create(this.uriTemplate.toString(), ! this.decodeSlash, this.charset); return this; } // 该方法作用:给request设置一个uri // 这里会解析UriTemplate ,·uriTemplate.expand(variables)· // 2、解析查询参数模版,这块相对复杂。

    9.6K30发布于 2020-02-21
  • 来自专栏卓越笔记

    drf 启动报错:AssertionError: `coreapi` must be installed for schema support.

    requests in /Users/yinzhuoqun/.pyenv/joyoo2/lib/python3.6/site-packages (from coreapi) (2.18.4) Collecting uritemplate Downloading uritemplate-3.0.1-py2.py3-none-any.whl (15 kB) Collecting coreschema Downloading coreschema e9bdef7dca4b276f7f28a03943f4059466188def81a65b1b44 Successfully built coreschema Installing collected packages: itypes, uritemplate coreapi Successfully installed MarkupSafe-1.1.1 coreapi-2.3.3 coreschema-0.0.4 itypes-1.2.0 jinja2-2.11.2 uritemplate

    1K20编辑于 2023-02-18
  • 来自专栏大内老A

    [WCF REST] 帮助页面与自动消息格式(JSON/XML)选择

    1: [ServiceContract] 2: public interface IEmployees 3: { 4: [WebGet(UriTemplate = "all") : [Description("获取所有员工列表")] 6: IEnumerable<Employee> GetAll(); 7:  8: [WebGet(UriTemplate 9: [Description("获取指定ID的员工")] 10: Employee Get(string id); 11:  12: [WebInvoke(UriTemplate Description("创建一个新的员工")] 14: Employee Create(Employee employee); 15:  16: [WebInvoke(UriTemplate 1: [ServiceContract] 2: public interface IEmployees 3: { 4: //其他成员 5: [WebGet(UriTemplate

    96870发布于 2018-02-07
  • 来自专栏玄魂工作室

    kali linux Python 黑客编程1 开发环境

    Downloading github3.py-0.9.5-py2.py3-none-any.whl (109kB): 109kB downloaded Downloading/unpacking uritemplate.py >=0.2.0 (from github3.py) Downloading uritemplate.py-0.3.0.tar.gz Running setup.py (path:/tmp/pip-build-LRgVNm /uritemplate.py/setup.py) egg_info for package uritemplate.py Requirement already satisfied (use --upgrade 2.0 in /usr/lib/python2.7/dist-packages (from github3.py) Installing collected packages: github3.py, uritemplate.py Running setup.py install for uritemplate.py Successfully installed github3.py uritemplate.py Cleaning

    4.7K60发布于 2018-04-11
  • 来自专栏熊二哥

    快速入门系列--WCF--03RESTFUL服务与示例

    对于SOAP协议来说,操作的选择是通过<Action>来决定的,而在这儿时通过UriTemplate属性表示的一个URI模板来决定的,常见的路由例子如接下来的,/filename. ="all")] 7 IEnumerable<Employee> GetAll(); 8 9 [WebGet(UriTemplate = "{id}")] 10 Employee Get (String id); 11 12 [WebInvoke(UriTemplate = "/", Method = "POST")] 13 void Create(Employee employee); 14 15 [WebInvoke(UriTemplate = "/", Method = "PUT")] 16 void Update(Employee employee); 17 18 [WebInvoke( UriTemplate = "{id}", Method = "DELETE")] 19 void Delete(string id); 20 } 21 } Service的实现 1 public class

    99070发布于 2018-01-24
  • 来自专栏菩提树下的杨过

    当wcf遇到JSON ?

    一切都很理想 后来因为项目需要,有人觉得Test这个名称太土,想换个名字,而程序员又不乐意,于是用UriTemplate起了个别名HelloWorld应付,如下: /**////

    / returns></returns> [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json,UriTemplate ; } 浏览器里用http://localhost/wcf/service.svc/HelloWorld 测试,报错如下: 使用“UriTemplate”的终结点无法用于“System.ServiceModel.Description.WebScriptEnablingBehavior returns></returns> [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json,UriTemplate

    1K50发布于 2018-01-23
  • 来自专栏Nicky's blog

    SpringBoot系列之实现RestTemplate Get请求传javabean参数

    UriTemplateHandler uriTemplateHandler = new DefaultUriBuilderFactory(); @Override public URI expand(String uriTemplate 构建请求的链接,也是拼参数的方法 UriComponentsBuilder builder = UriComponentsBuilder .fromHttpUrl(uriTemplate uriTemplateHandler.expand(uriString , uriVariables); } @Override public URI expand(String uriTemplate , Object... uriVariables) { return uriTemplateHandler.expand(uriTemplate, uriVariables);

    2.3K40编辑于 2022-07-28
  • 来自专栏大内老A

    [WCF REST] 一个简单的REST服务实例

    = "all")] 5: IEnumerable<Employee> GetAll(); 6:  7: [WebGet(UriTemplate = "{id}")] 8: Employee Get(string id); 9:  10: [WebInvoke(UriTemplate = "/", Method = "POST")] WebGetAttribute和WebInvokeAttribute和均具有相同的属性UriTemplate,该属性用于定义作为最终操作URI的模板。 我们不仅可以通过UriTemplate属性为操作指定一个相对于终结点地址的静态路径,还可以通过占位符实现路径中的动态部分与参数之间的映射。 用于返回指定员工ID的Get操作的UriTemplate被设置成“{id}”,意味着我们直接在表示请求地址的URI中指定员工的ID,而它会自动映射为该操作方法的参数id。

    95470发布于 2018-01-16
  • 来自专栏菩提树下的杨过

    ExtJs学习笔记(20)-利用ExtJs的Ajax与服务端WCF交互

    [OperationContract] [WebInvoke(ResponseFormat = WebMessageFormat.Json, Method = "*", UriTemplate [OperationContract] [WebInvoke(Method = "*", ResponseFormat = WebMessageFormat.Json, UriTemplate [OperationContract] [WebInvoke(Method = "*", ResponseFormat = WebMessageFormat.Json, UriTemplate SaveMyData用于Get方法,SaveMyData2用于Post方法 需要说明的是[WebInvoke(Method = "*", ResponseFormat = WebMessageFormat.Json, UriTemplate id={id}&text={text}")]这一行,这里标明该方法可用Get/Post来处理数据,输出格式是Json字符串,UriTemplate表示该方法支持RESTFul风格,可用/MyService.svc

    1.4K70发布于 2018-01-24
  • 来自专栏平凡少年

    WCFRESTFul服务搭建及实现增删改查

    JavaScript,甚至是 HTML FORM,或者直接在浏览器地址栏输入     WCF 中通过 WebGetAttribute、WebInvokeAttribute (GET/PUT/POST/DELETE)、UriTemplate (Name="user")] public interface IService1 { [OperationContract] [WebInvoke(UriTemplate WebMessageBodyStyle.Bare)] string GetData(string value); [OperationContract] [WebInvoke(UriTemplate WebMessageBodyStyle.Bare)] string addPeople(People p); [OperationContract] [WebInvoke(UriTemplate WebMessageBodyStyle.Bare)] List<People> GetList(string value); } } 注意:通过WebInvoke属性的Method值说明该请求的类型,UriTemplate

    93730发布于 2019-04-11
  • 来自专栏玄魂工作室

    Python黑帽编程1.3 Python运行时与包管理工具

    Downloading github3.py-0.9.5-py2.py3-none-any.whl (109kB): 109kB downloaded Downloading/unpacking uritemplate.py >=0.2.0 (from github3.py) Downloading uritemplate.py-0.3.0.tar.gz Running setup.py (path:/tmp/pip-build-LRgVNm /uritemplate.py/setup.py) egg_info for package uritemplate.py Requirement already satisfied (use --upgrade 2.0 in /usr/lib/python2.7/dist-packages (from github3.py) Installing collected packages: github3.py, uritemplate.py Running setup.py install for uritemplate.py Successfully installed github3.py uritemplate.py Cleaning

    1.2K150发布于 2018-04-12
  • SpringBoot Actuator 潜在的 OOM 问题

    request.getURI().toString())));     }     /**      * Creates a {@code uri} {@code Tag} from the given {@code uriTemplate      * @param uriTemplate the template      * @return the uri tag      */     public static Tag uri( String uriTemplate) {         String uri = (StringUtils.hasText(uriTemplate) ?  uriTemplate : "none");         return Tag.of("uri", ensureLeadingSlash(stripUri(uri))); 其余的还有 status

    19100编辑于 2025-06-07
  • 来自专栏张善友的专栏

    入门:添加一个支持获取单一资源以及支持POST,PUT和DELETE方法

    打开ContactsAp.cs 复制以下方法 [WebGet(UriTemplate="{id}")] public Contact GetItem(int id) { var contact Close {"ContactId":1,"Name":"Phil Haack"} 3、添加对POST的支持 以下代码是添加一个新的Post方法,添加一个新的Contract [WebInvoke(UriTemplate 添加PUT的支持 添加对PUT和DELETE的支持是非常容易的,像POST一样也是使用WebInvoke 制定PUT和DELETE 打开ConactApi.cs把以下代码拷进去 [WebInvoke(UriTemplate : Close {"ContactId":1,"Name":"Updated Contact" 8、添加对DELETE的支持 切换到ContactApi.cs并复制以下内容: [WebInvoke(UriTemplate

    1.9K70发布于 2018-01-22
  • 来自专栏菩提树下的杨过

    用JS + WCF打造轻量级WebPart

    )新建几个方法: Code //取得页面布局数据 [OperationContract] [WebInvoke(ResponseFormat = WebMessageFormat.Json, UriTemplate return ms; } //保存布局 [OperationContract] [WebInvoke(ResponseFormat = WebMessageFormat.Json, UriTemplate Result; } //取得新闻 [OperationContract] [WebInvoke(ResponseFormat = WebMessageFormat.Json, UriTemplate ms; } //取得图片地址 [OperationContract] [WebInvoke(ResponseFormat = WebMessageFormat.Json, UriTemplate

    1.1K100发布于 2018-01-22
领券