url-parameters

Boolean logic in RESTful filtering and queries

本小妞迷上赌 提交于 2019-11-29 04:09:27
This is sort of a follow-up to someone else's question about filtering/querying a list of cars. There the recommendation for a RESTful filtering request was to put filter expressions in the query of the URI, like this: /cars?color=blue&type=sedan&doors=4 That's fine. But what if my filtering query becomes more complicated and I need to use Boolean operators, such as: ((color=blue OR type=sedan) AND doors=4) OR color=red That is, I want to find a four-door blue car or a four-door sedan, but if the car is red I'll take it without caring about any of the other properties. Is there any sort of

What are the URL parameters? (element at position #3 in urlparse result)

僤鯓⒐⒋嵵緔 提交于 2019-11-28 20:06:43
I've taken a look to urlparse.urlparse method documentation and I'm a little bit confused about what is the parameters part (not to be confused with the more familiar query part, that is what goes after the question mark and before the fragment part). Wikipedia entry on URL's structure doesn't say anything about that, so could please anybody elaborate a little bit on this and possibly give some examples? fascinating, this is the first time I've encounter them, found this http://doriantaylor.com/policy/http-url-path-parameter-syntax I also found this http://tools.ietf.org/html/rfc3986#section-3

Spring security authentication based on request parameter

只愿长相守 提交于 2019-11-28 18:51:07
The application I'm working on already has Spring Security to handle form based authentication. Now the requirement is to login a user programmatically via an external service if a token is found in one of the request parameters. In other words, if a particular request parameter, say "token", exists, it needs to call an external service with that token to verify if it's a valid token. If it is then the user will be logged in. I can't figure out how and where to "trigger" or "hook on to" Spring Security to check this parameter and make the verification then authenticate the user when

PHP check if url parameter exists

北城余情 提交于 2019-11-28 18:33:18
I have a URL which i pass parameters into example/success.php?id=link1 I use php to grab it $slide = ($_GET["id"]); then an if statement to display content based on parameter <?php if($slide == 'link1') { ?> //content } ?> Just need to know in PHP how to say, if the url param exists grab it and do the if function, if it doesn't exist do nothing. Thanks Guys 웃웃웃웃웃 Use isset() $matchFound = ( isset($_GET["id"]) && trim($_GET["id"]) == 'link1' ); $slide = $matchFound ? trim ($_GET["id"]) : ''; EDIT : This is added for the completeness sake. $_GET in php is a reserved variable that is an

Send list/array as parameter with jQuery getJson

偶尔善良 提交于 2019-11-28 17:53:57
I have the following where I'm trying to send list/array to MVC controller method: var id = []; var inStock = []; $table.find('tbody>tr').each(function() { id.push($(this).find('.id').text()); inStock.push($(this).find('.stocked').attr('checked')); }); var params = {}; params.ids = id; params.stocked = inStock; $.getJSON('MyApp/UpdateStockList', params, function() { alert('finished'); }); in my contoller: public JsonResult UpdateStockList(int[] ids, bool[] stocked) { } both paramaters are null. Note that if I change the params to single items params.ids = 1; params.stocked = true; public

How to add link parameter to asp tag helpers in ASP.NET Core MVC

天大地大妈咪最大 提交于 2019-11-28 17:41:58
I have a lot of experience with ASP.NET MVC 1-5 . Now I learn ASP.NET Core MVC and have to pass a parameter to link in page. For example I have the following Action [HttpGet] public ActionResult GetProduct(string id) { ViewBag.CaseId = id; return View(); } How can I implement the link for this action using tag helpers? <a asp-controller="Product" asp-action="GetProduct">ProductName</a> Alex You can use the attribute prefix asp-route- to prefix your route variable names. Example: <a asp-controller="Product" asp-action="GetProduct" asp-route-id="10"> ProductName</a> You might want to apply the

Python Dictionary to URL Parameters

坚强是说给别人听的谎言 提交于 2019-11-28 15:42:28
问题 I am trying to convert a Python dictionary to a string for use as URL parameters. I am sure that there is a better, more Pythonic way of doing this. What is it? x = "" for key, val in {'a':'A', 'b':'B'}.items(): x += "%s=%s&" %(key,val) x = x[:-1] 回答1: Use urllib.urlencode(). It takes a dictionary of key-value pairs, and converts it into a form suitable for a URL (e.g., key1=val1&key2=val2 ). If you are using Python3, use urllib.parse.urlencode() If you want to make a URL with repetitive

Suppress empty parameters using param tag

拈花ヽ惹草 提交于 2019-11-28 09:31:57
问题 I have written JSP that I used with many actions. It has a link with parameters The link: <s:a namespace="/some" action="view"> <s:param name="purpose" value="%{purpose}"/> <s:param name="type" value="%{type}"/> <s:property value="%{name}"/> </s:a> The action class: public class ViewAction extends ActionSupport { private Long purpose; private Long type; private String name; public Long getPurpose() { return purpose; } public void setPurpose(Long purpose) { this.purpose = purpose; } public

Using duplicate parameters in a URL

橙三吉。 提交于 2019-11-28 07:08:03
问题 We are building an API in-house and often are passing a parameter with multiple values. They use: mysite.com?id=1&id=2&id=3 Instead of: mysite.com?id=1,2,3 I favor the second approach but I was curious if it was actually incorrect to do the first? 回答1: I'm not an HTTP guru, but from what I understand there's not a definitive standard on the query part of the URL regarding multiple values, it's typically up to the CGI that handles the request to parse the query string. RFC 1738 section 3.3

htaccess, redirect virtual subdomain to URL parameter

时光总嘲笑我的痴心妄想 提交于 2019-11-27 22:50:11
问题 I have a .ne.ro domain (registered in Romania) where visitors can enter with or without 'www': http://mydomain.ne.ro http://www.mydomain.ne.ro I want to redirect http://123.mydomain.ne.ro to http://mydomain.ne.ro?id=123 . If visitor enter with 'www|mail|ftp' must be treated as non parameter (obviously). I tried htaccess subdomain redirct with last url parameter but didn't work. Current code: # edited on 05/April/2011 as suggested: RewriteEngine on RewriteCond %{HTTP_HOST} !^www\.mydomain\.ne\