url-routing

How can I assert that no route matches in a Rails integration test?

依然范特西╮ 提交于 2019-12-04 12:12:19
问题 I have a Rails 3 integration test which tests my routes. It contains tests such as: assert_routing( "/#{@category.url.path}/#{@foo.url.path}", { :controller => 'foo', :action => 'show', :category => @category.to_param, :foo => @foo.to_param } ) I would also like to test a case where no routes should match. Obviously, testing generation has no meaning in this case, so I just need the inverse of assert_recognizes. I'd like to be able to do something like this: assert_not_recognized('

Is there a reusable router / dispatcher for PHP?

给你一囗甜甜゛ 提交于 2019-12-04 12:08:44
问题 I'm using a simple framework that handles requests based on query parameters. http://example.com/index.php?event=listPage http://example.com/index.php?event=itemView&id=1234 I want to put clean urls in front of this so you can access it this way: http://example.com/list http://example.com/items/1234 I know how routes and dispatching works, and I could write it myself. But I would rather take advantage of all the code out there that already solves this problem. Does anyone know of a generic

Multiple Pages on a Static Website AWS S3

北城余情 提交于 2019-12-04 11:58:35
问题 I am hosting a static website using AWS S3 (for convenience, ease-of-use, and because it's so cheap). When I have multiple HTML documents. I can navigate to them using /name_of_file.html . Is there a way to route the HTML file so the URL says /name_of_file instead? I don't like the ugliness of have a .html extension in my URL and I'd rather avoid do a single page website. Thanks 回答1: As long as you upload the files with the Content-type header set to text/html , the pages would work fine if

Passing PHP arguments into NetBeans into a page that features symfony url-routing

我怕爱的太早我们不能终老 提交于 2019-12-04 11:49:35
I am doing the Jobeet tutorial that features url routing. The url routing (I think that's the proper term) makes urls look like this http://localhost:8080/frontend_dev.php/job/extreme-sensio/paris-france/2/web-designer I would like to debug into this page however I cannot properly pass arguments into NetBeans. I set the arguments in NetBeans "Run Configuration" area to this job/extreme-sensio/paris-france/2/web-designer however the url that is executed is this (notice the ? that NetBeans automatically appends to index file) http://localhost:8080/frontend_dev.php?job/extreme-sensio/paris-france

CodeIgniter - unlimited parameters?

南笙酒味 提交于 2019-12-04 11:48:50
I am currently using CodeIgniter. I am trying to write a function that can take an unlimited number of paramaters. So in the controller it will be something like function test($name, $others){ foreach($others){ //do something } } and I could call it like example.com/control/test/some name/param1/param2/param3/param4/param5... How can I set this up? You can get an associated array of URI segments with the uri_to_assoc function in the URI class . So in your controller, you might do something like this: function test($name){ $uri_seg = $this->uri->uri_to_assoc(4); foreach($uri_seg as $para){ //

Server-Side Auth Flow with React Router

爱⌒轻易说出口 提交于 2019-12-04 11:47:58
I was wondering how to exactly implement authentication flow with React Router if my app is rendering server-side? The scenario: When the user first arrives at the app, we invoke an onEnter router method in order to check if any current user is present ( localStorage ), if they are we will redirect them to their dashboard, otherwise we redirect them to the landing page. Therefore when my app hits my protected routes onEnter , here's ideally what should happen: onEnter: () => { if (localStorage.getItem('authToken')) { // Authenticate and redirect user to intended path } else { // Redirect the

How to get at runtime the route name in Symfony2 when using the yaml routes description?

笑着哭i 提交于 2019-12-04 11:09:16
问题 Here you can find my n -th question on Symfony2. I'm working with a pagination bundle that uses the route name provided in the routing.yml file. From my perspective, this approach is not flexible and lead to a dirty code, since if I change the name of the route, then I have to look at all the Twig templates or PHP files to update the route name. This is ok for small Web applications, but will provide such a bug for larger applications and also need an high burden for the developer. So, I was

Yii urlManager language in URL

纵饮孤独 提交于 2019-12-04 10:26:31
I am trying to add a language to the url with following syntax: http://www.example.com/en/site/page/view/about What I have so far works with short urls like: http://www.example.com/en/site/contact but not with long once as in my first example Here is what I have so far: /config/main.php 'urlManager'=>array( 'class'=>'application.components.MyCUrlManager', 'urlFormat'=>'path', 'showScriptName'=>false, 'rules'=>array( '<language:\w+>/<controller:\w+>/<id:\d+>'=>'<controller>/view', '<language:\w+>/<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>', '<language:\w+>/<controller:\w+>/

How to create RouteUrls with databound parameters declaratively?

孤人 提交于 2019-12-04 10:03:40
I'm using the new Routing feature in ASP.NET 4 (Web forms, not MVC). Now I have an asp:ListView which is bound to a datasource. One of the properties is a ClientID which I want to use to link from the ListView items to another page. In global.asax I have defined a route: System.Web.Routing.RouteTable.Routes.MapPageRoute("ClientRoute", "MyClientPage/{ClientID}", "~/Client.aspx"); so that for instance http://server/MyClientPage/2 is a valid URL if ClientID=2 exists. In the ListView items I have an asp:HyperLink so that I can create the link: <asp:HyperLink ID="HyperLinkClient" runat="server"

Optional URL Parameter in Route GAE webapp2

戏子无情 提交于 2019-12-04 10:03:25
I'm really new to Python and GAE. I'm setting up a basic CRUD app for some test data and am trying to get some routing for the admin pages going. I'd like to use the same page for creating and editing an object. So basically I want: /admin/edit/<id> where <id> is optional and /admin/edit will route to the same page. I tried adding <id:\w*> to the route which then allowed me to hit the page without supplying an id, but then when I supplied the id, I received a 404. Then I tried <id:\w+> and got a 404 with and without an id. I'm not having much luck. Can anyone help me with what regex I need for