routing

In ASP MVC3, how can execute a controller and action using a uri?

给你一囗甜甜゛ 提交于 2019-11-29 22:45:09
问题 How can I, when executing a controller action, take a Uri (not the one requested) and invoke the action from the controller that would have been executed had that Uri been the one that was called? I can't simply redirect to that action as I need it to happen in the same request context. 回答1: Assuming you have access to the HttpContext (and I suppose you do since you are asking) you could: var routeData = new RouteData(); // controller and action are compulsory routeData.Values["action"] =

Jetty '{servlet}/{parameter}' url routing

喜夏-厌秋 提交于 2019-11-29 22:32:59
问题 I'm using jetty 9.0.3. How to map an URL such as www.myweb.com/{servlet}/{parameter} to the given servlet and parameter? For example, the URL '/client/12312' will route to clientServlet and its doGet method will receive 12312 as a parameter. 回答1: You'll have 2 parts to worry about. The pathSpec in your WEB-INF/web.xml The HttpServletRequest.getPathInfo() in your servlet. The pathSpec In your WEB-INF/web.xml you have to declare your Servlet and your url-patterns (also known as the pathSpec).

Is it possible to change the querystring variable in ASP.NET MVC path before it hits the controller?

感情迁移 提交于 2019-11-29 22:09:59
问题 I have a controller method in ASP.NET MVC that looks like this: public ActionResult GetAlbumPictures(int albumId) { var album = AlbumRepo.GetSingle(albumId); var pictures = album.Pictures; return View(pictures); } The routing for this method looks like this: routes.MapRoute(null, "pictures" new { controller = "Album", action = "GetAlbumPictures" }); The user will use the following URL to get the pictures, filtered by the album ID: GET http://server/pictures?albumid=10 However, I'd like to

angular2 rc.4 layz routing

蹲街弑〆低调 提交于 2019-11-29 21:27:24
问题 Angular2 rc.4 lazy Routing is depreciated. Async Routing example is there any new lazy routing / async routing example for rc.4 回答1: loadChildren is supposed to do that: { path: 'section', loadChildren: 'section-bundle' } I don't know what exactly the string should point to. See also https://github.com/angular/angular/issues/9527#issuecomment-236038503 https://github.com/angular/angular/issues/10577 (with Plunker) { path: 'heroes', loadChildren: 'app/hero/hero.module' } 来源: https:/

Override router and add parameter to specific routes (before path/url used)

浪子不回头ぞ 提交于 2019-11-29 21:27:07
问题 I would use a easy management routing system. For example NOW i have this routes. _welcome ANY ANY ANY / acmedemo_example_index ANY ANY ANY /acme/demos acmedemo_example_edit ANY ANY ANY /acme/edit/{id} acmedemo_example_delete ANY ANY ANY /acme/delete/{id} acmeapi_backup_get GET ANY ANY /api/acme acmeapi_backup_edit POST ANY ANY /api/acme Now I would add the current user id to each route, because if a user send me or another supporter/administrator a link, we would see what the user see. You

Rails: how do you access RESTful helpers?

南楼画角 提交于 2019-11-29 20:37:20
I'm trying to work through this guide to Rails routing , but I got stuck in section 3.3 : Creating a RESTful route will also make available a pile of helpers within your application and then they list some helpers like photos_url , photos_path , etc. My questions: Where can I find the complete list of helpers that is "made available?" Is there a way to call the helpers in the console? I created an app, then opened up the console with script/console . I tried to call one of the helpers on the console like this: >> entries_url But got: NameError: undefined local variable or method `entries_url'

My Routes are Returning a 404, How can I Fix Them?

北城余情 提交于 2019-11-29 20:32:37
I've just started learning the Laravel framework and I'm having an issue with routing. The only route that's working is the default home route that's attached to Laravel out of the box. I'm using WAMP on Windows and it uses PHP 5.4.3, and Apache 2.2.22, and I also have mod_rewrite enabled, and have removed the 'index.php' from the application.php config file to leave an empty string. I've created a new controller called User : class User_Controller extends Base_Controller { public $restful = true; public function get_index() { return View::make('user.index'); } } I've created a view file in

How to remove controller names from rails routes?

此生再无相见时 提交于 2019-11-29 20:17:31
I would like to trim down the routes on my application so that: http://myapplication.com/users/peter/questions/how-do-i-create-urls becomes... http://myapplication.com/peter/how-do-i-create-urls I have a users controller and would like it to be resourceful. Users also have a nested resource called questions. Basic routes file Without any URL trimming, the routes file looks like this: ... resources :users do resources :questions end However the URLs from this take the form of http://myapplication.com/users/peter/questions/how-do-i-create-urls rather than http://myapplication.com/peter/how-do-i

Offline iPhone Map with offline routing [closed]

狂风中的少年 提交于 2019-11-29 20:05:41
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I am developing an iPhone app with : offline map offline routing like : mtrip, offMap ... http://www.offmaps.com/ I research alot

How to router.navigate to same route in Angular 4 and catch the same event?

蓝咒 提交于 2019-11-29 20:02:33
问题 Okay, I have two use cases for my question here: I'm working on an application which has a /en/register route. It all works good when I'm at the root and I click a button that does this.router.navigate([this.routeParams.lang, 'register']); and it's all good, this opens up a modal in the constructor (or ngOnInit, anyways) with ($('#modalRegister') as any).modal('show'); . It all works good, but if I close the modal, the route is still /en/register/ (yeah I can make it go to /en but see the use