routing

Fat-Free-Framework global variables and functions

余生颓废 提交于 2019-11-29 07:04:30
I'm new to fat free framework and i'm a little bit confused about the global variables. $f3->route('GET /@page','display'); function display($f3) { echo 'I cannot object to an object' . $f3->get('PARAMS.page'); }; $f3->run(); Here i'm using GET /@page as a token for the url route. In the function i then use $f3->get('PARAMS.page') to get the value of that variable. Since $f3->get is the method to get a global variable, why do i have to pass the $f3 class to the function. The below code doesn't work ($f3 class not passed to the function). $f3->route('GET /@page','display'); function display() {

ASP.NET - Building your own routing system

你。 提交于 2019-11-29 05:19:35
In a recent project, I built my own MVC framework in PHP. One of the things I implemented was a routing system. I used Apache's mod_rewrite to send all requests to index.php, and then parsed the URI to extract information and route the request. I'm dabbling in ASP.NET now, and I'm wondering if/how I might perform something similar. Is there a way to route all requests (similar to the way WordPress does it) to one page where central route processing is performed? I'm aware of the MVC framework for ASP.NET, but I'd like to take a stab at this myself as I'm tinkering around and learning. EDIT:

How to correct set root route in Rails 4 for AngularJS?

ぐ巨炮叔叔 提交于 2019-11-29 04:59:15
I have a troubles with integrating Rails routing with AngularJS. When I go to "localhost:3000" in browser input, it redirect me to the "localhost:3000/#/auth/sign_in" but 'sign_in' template not render. Then, secondary if I go to the "localhost:3000/#/", it redirect me to the "localhost:3000/#/auth/sign_in" and render 'sign_in' template right. How to fix it, when I go to "localhost:3000" then render 'sign_in' ? Router code here: http://pastie.org/8917505 Thanks! Sasha B. I have found the solution. You need to enable HTML5 mode for AngularJS: angular.module('app').config(['$routeProvider', '

Using URL Routing for Web Forms and StopRoutingHandler for Favicon

北城以北 提交于 2019-11-29 04:06:13
I have a website where I need to add a Favicon.ico. The site is written using ASP.NET 3.5 Web Forms with Routing. The issue is that the Favicon link always returns a page not found error. This is because the Routing does not know where the link for Favicon.ico should go to so it returns the Not Found page. I have tried to add a StopRoutingHandler for the the favicon but none of them seem to work. Below are the ones I have tried so far: routes.Add(new Route("MasterPages/{favicon}.ico", new StopRoutingHandler())); routes.Add(new Route("{favicon}.ico", new StopRoutingHandler())); routes.Add(new

Apache Camel conditional routing

♀尐吖头ヾ 提交于 2019-11-29 03:59:56
I have a service which has two operations. RegisterUser UpdateUser I have a camel rout: <camel:route id="myRoute"> <camel:from uri="cxf:bean:myListenerEndpoint?dataFormat=POJO&synchronous=true" /> <camel:bean ref="processor" method="processMessage"/> <camel:to uri="xslt:file:resources/service/2.0.0/UserRegistration.xsl"/> <camel:to uri="cxf:bean:myTargetEndpoint"/> </camel:route> In my processor bean, when I specify: RegisterUser registerUser = exchange.getIn().getBody(RegisterUser.class); I get the register user object. Everything works fine. The problem is that I want camel to route my

ASP.NET Routing - Ignore routes for files with specific extension, regardless of directory

本小妞迷上赌 提交于 2019-11-29 03:48:15
Say I want to remove any mapped routes for files with a certain file extension. RouteTable.Routes.Ignore("{root}.hello"); Works for any file that has the extension .hello in the root directory, however as soon as i go into any subfolders the 'ignore' rule isn't applied. Ive tried lots of different combinations, but can't seem to get one that doesn't throw a compiler exception, or not work? Check out Phil's blog regarding this. Basically, you would do something like this: Example 1: Do not perform routing for any request for all .aspx files: routes.IgnoreRoute("{*allaspx}", new {allaspx=@".*\

Symfony2 how to allow slug with dashes in routes regex?

别来无恙 提交于 2019-11-29 03:24:43
My route (slug contains dashes!): region: pattern: /regione/{slug}-{id} defaults: { _controller: SWAItaliaInCifreBundle:Default:region } In Twig template: {% for r in regions %} <a href='{{ path('region', { 'slug':r.slug, 'id':r.id }) }}'>{{ r.name }}</a> {% endfor %} I'm getting an error about regular expression matching. Question : why Symfony2 does not permit dashes in url? How can i specify that my route contains dashes (and it's perfectly fine)? An exception has been thrown during the rendering of a template ("Parameter "slug" for route "region" must match "[^/-]+?" ("valle-d-aosta-vallee

MVC routing when a file actually exists at the specified location

情到浓时终转凉″ 提交于 2019-11-29 03:03:27
问题 So I have a route like this in my MVC 3 application running under IIS 7: routes.MapRoute( "VirtualTourConfig", "virtualtour/config.xml", new { controller = "VirtualTour", action = "Config" } ); The trick is that a file actually exists at /virtualtour/config.xml. It seems like the request is just returning the xml file at that location instead of hitting the route, which processes the XML, makes some changes and returns a custom XmlResult. Any suggestions on how I can tell my application to

Rails 3 - Whitelisting list of IPs via routes

*爱你&永不变心* 提交于 2019-11-29 02:49:49
问题 This is a two part question. I'm needing to restrict a rails site that I'm throwing on development server to only a few IP addresses, so the public can't access it. (Basic HTTP auth doesn't 'entirely' work as the auth breaks a Flash uploader in the project.) Based on what I've Googled, this is what I've come up with in my routes file... class WhitelistConstraint def initialize @ips = '127.0.0.1' end def matches?(request) @ips.include?(request.remote_ip) end end MyProject::Application.routes

Using Routing without MVC: authentication form

心不动则不痛 提交于 2019-11-29 02:39:29
Now I'm trying to work with System.Web.Routing. All is just fine, but I can't understand how to make form authentication work with url routing (return url, redirection, etc). Google says nothing. Help! :) UPD: I forgot - I don't use MVC . That's the problem. How to use rounig and form authentication without MVC UPD2: more about my problem What I want to get: urls such “ mysite.com/content/123 ”, “ mysite.com/login/ ”, etc using Routes. It’s important to make login page works like “regular” ASP.NET login form (redirects to login from secure area when not login on, and redirect back to secure