Пример #1
0
 public virtual JaxRsResponse Put(string path, string data)
 {
     WebResource.Builder builder = builder(path);
     if (!string.ReferenceEquals(data, null))
     {
         builder = builder.entity(data, MediaType.APPLICATION_JSON_TYPE);
     }
     return(new JaxRsResponse(HTTP.sanityCheck(builder.put(typeof(ClientResponse)))));
 }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: public JaxRsResponse post(String path, String data, final javax.ws.rs.core.MediaType mediaType)
        public virtual JaxRsResponse Post(string path, string data, MediaType mediaType)
        {
            WebResource.Builder builder = builder(path);
            if (!string.ReferenceEquals(data, null))
            {
                builder = builder.entity(data, mediaType);
            }
            else
            {
                builder = builder.type(mediaType);
            }
            return(JaxRsResponse.ExtractFrom(HTTP.sanityCheck(builder.post(typeof(ClientResponse)))));
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: private com.sun.jersey.api.client.WebResource.Builder builder(String path, final javax.ws.rs.core.MediaType accept)
        private WebResource.Builder Builder(string path, MediaType accept)
        {
            WebResource resource = _client.resource(Uri(PathOrAbsolute(path)));

            WebResource.Builder builder = resource.accept(accept);
            if (_headers.Count > 0)
            {
                foreach (KeyValuePair <string, string> header in _headers.SetOfKeyValuePairs())
                {
                    builder = builder.header(header.Key, header.Value);
                }
            }

            return(builder);
        }
Пример #4
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: public JaxRsResponse get(String path, final javax.ws.rs.core.MediaType acceptType)
        public virtual JaxRsResponse Get(string path, MediaType acceptType)
        {
            WebResource.Builder builder = builder(path, acceptType);
            return(JaxRsResponse.ExtractFrom(HTTP.sanityCheck(builder.get(typeof(ClientResponse)))));
        }