http-get

Passing a list of int to a HttpGet request

落花浮王杯 提交于 2019-12-03 02:31:12
I have a function similar in structure to this: [HttpGet] public HttpResponseMessage GetValuesForList(List<int> listOfIds) { /* create model */ foreach(var id in listOfIds) model.Add(GetValueForId(id) /* create response for model */ return response; } However, when I do a Get request for the method: {{domain}}/Controller/GetValuesForList?listOfIds=1&listOfIds=2 I get an error when debugging stating that listOfIds is null. In our controller we have a number of public HttpGet methods that work fine, and when changing the parameter to a single int it works. I've tried changing the parameter type

Why isn't getSession() returning the same session in subsequent requests distanced in short time periods?

血红的双手。 提交于 2019-12-02 23:16:35
I am sending a $.getJSON (HTTP GET) request twice (with different data), one after another (lets say we have request1 and request2). I can see in the developer tools from FF and Chrome that I have the same cookie:JSESSIONID=FD0D502635EEB67E3D36203E26CBB59A header field. On the server side I try to get the session: HttpSession session = request.getSession(); boolean isSessionNew = session.isNew(); String sessionId = session.getId(); String cookieFromRequestHeader = request.getHeader("cookie"); If I print these variables for both requests I get, request1: isSessionNew:true

The type or namespace name 'HttpGet' could not be found when add 'System.Web.Http' namespace

无人久伴 提交于 2019-12-02 22:19:00
I have one issue in MVC . Currently I am working in MVC and the version is MVC4 . And I have 2 ActionResult Method, see below [HttpGet] public ActionResult About() { ViewBag.Message = "Your app description page."; return View(); } [HttpPost] public ActionResult About(ModelName ccc) { ViewBag.Message = "Your app description page."; return View(); } We need the using System.Web.Mvc; namespace for [HttpPost] and [HttpGet] attributes. So I added the using System.Web.Mvc; namespace in my controller . But i need to add another one Namespace using System.Web.Http; for httpsresponseexpection error

How do I print the content of httprequest request?

北城余情 提交于 2019-12-02 17:57:59
I've got a bug involving httprequest, which happens sometimes, so I'd like to log HttpGet and HttpPost request's content when that happens. So, let's say, I create HttpGet like this: HttpGet g = new HttpGet(); g.setURI(new URI("http://www.google.com")); g.setHeader("test", "hell yeah"); This is the string representation that I'd like to get: GET / HTTP/1.1 Host: www.google.com test: hell yeah With the post request, I'd also like to get the content string. What is the easiest way to do it in java for android? Juned Ahsan You can print the request type using: request.getMethod(); You can print

URL encoding iOS NSURL error

99封情书 提交于 2019-12-02 12:56:07
URL which opens in Firefox,Chrome browsers on desktop, doesn't open in WebView on iPhone. This URL is supposedly accessing a GET request. When creating the NSURL without percentescaping the url doesn't get generated. When using percentescape the url redirects to a Bad url content. Is there a different encoding used on desktop browsers and not on the iPhone? or mobile Safari? Are there different ways to encode the URL in iOS other than using -stringByAddingPercentEscapesUsingEncoding -CFURLCreateStringByAddingPercentEscapes which generates bad request content pages from server. Any help would

ASP.NET core HttpGet single Web API

*爱你&永不变心* 提交于 2019-12-02 09:44:12
问题 Good Morning, I’m having difficulty setting up my HTTPGETs and then testing the solution in Postman. I’m trying to return a single result on both occasions however when I input the parameters nothing loads. So I'm clearly missing something which i need some help on please. I have 1 parameter {id} in my CashMovementController and if I navigate to localhost/api/cashmovements/{id} it loads however if pass the {id} parameter in postman it fails. Then in my BondCreditRatingsController I have 2

ASP.NET core HttpGet single Web API

烂漫一生 提交于 2019-12-02 04:55:43
Good Morning, I’m having difficulty setting up my HTTPGETs and then testing the solution in Postman. I’m trying to return a single result on both occasions however when I input the parameters nothing loads. So I'm clearly missing something which i need some help on please. I have 1 parameter {id} in my CashMovementController and if I navigate to localhost/api/cashmovements/{id} it loads however if pass the {id} parameter in postman it fails. Then in my BondCreditRatingsController I have 2 parameters {ISIN} & {Date} and again I'm not sure how to approach this. Love to hear some advice/help on

How do I separate out query string params from POST data in a java servlet

五迷三道 提交于 2019-12-02 00:03:52
When you get a doGet or doPost call in a servlet you can use getparameterxxx() to get either the query string or the post data in one easy place. If the call was a GET, you get data from the url/query string. If the call was a POST, you get the post data all parsed out for you. Except as it turns out, if you don't put an 'action' attribute in your form call. If you specify a fully qualified or partially qualified url for the action param everything works great, if you don't, the browser will call the same url as it did on the previous page submit, and if there happens to be query string data

Is the HEAD response faster than the GET?

随声附和 提交于 2019-12-01 17:40:53
I'm currently getting the info about the files with GET, will it be faster if I rewrite it using HEAD request? Cause I close the connection after the first response. A HEAD response only includes the HTTP headers but no body - it is generally faster to just use a HEAD if you do not use any information in the body that would have normally transferred in a GET response - if there was no body to begin with it should not make a difference. Also from here : The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response. The metainformation contained in the

Filtering a json array obtained from a web service to only contain certain elements - Angular

二次信任 提交于 2019-12-01 14:27:27
I am creating a project which uses a HTTP get from a web service and returns an array of projects, with ID, name, description etc. There is many projects within this web service but I am only concerned with 9 of them the rest are irrelevant. I have a desired set of 9 projects with unique ID's declared in the project.service.http.ts class that I want to only be showing. I am trying to filter the HTTP get request to only include the 9 specific Ids, which I store in a projectIds array of type string. EDIT2: With logging the response: EDIT SOLVED: I changed the constructor in the project.viewer