routes

How do I restrict route extensions in @RequestMapping paths for Spring MVC controllers?

不打扰是莪最后的温柔 提交于 2019-12-01 07:37:56
问题 I have a fairly simple task that I want to accomplish, but can't seem to find information for Spring MVC routing about it. I have a very simple controller that routes a path to a view: @Controller @RequestMapping(value = "/help") public class HelpController { private static final String HELP = "help"; @RequestMapping(method = RequestMethod.GET) public String help(Model model, Locale locale) { model.addAttribute("locale", locale); return HELP; } } I would like to throw a 404 if http://mysite

Can a WCF ServiceRoute Route Prefix contain a path value?

亡梦爱人 提交于 2019-12-01 07:32:05
问题 Currently I use this: RouteTable.Routes.Add(new ServiceRoute("API", new WebServiceHostFactory(),typeof(MySite.Web.MyServiceV1))); To make this url point to the MyServiceV1.SVC MySite.com/API I want to use a Prefix which contains a / in it but it doesn't seem to work. RouteTable.Routes.Add(new ServiceRoute("API/V2", new WebServiceHostFactory(),typeof(MySite.Web.MyServiceV2))); Is there a better way to represent this instead of having to do "APIV2" ? I am using .Net 4.0 回答1: I totally forgot

Express.js sessions activated on a subset of routes

为君一笑 提交于 2019-12-01 07:30:13
问题 I'm working with expressjs and want to authenticate users for a login using sessions. The site/app should on one hand allow the user to browse and investigate different products and information in a stateless webpage allowing caching of these pages, but should on the other hand have the functionality to let the user login and access different content acquired using sessions. Thus for a subset of my routes I want session state activated, while for the complementary subset (the rest of my

How to list available audio output route on iOS

白昼怎懂夜的黑 提交于 2019-12-01 06:34:47
Now i'd like to list available audio output route in my iPhone app, something like this: http://www.blogcdn.com/www.tuaw.com/media/2008/09/cb(iphone-101_-switch-between-audio-outputs-for-your-voicemail)1729387198273.jpg i know that i can use audioRouteChangeListener of audio session to get route change info, but this method only can get the message after my app launch, so if headset and bluetooth both are connected before my app run, how can i get these routes' messages, any tips are appreciated. Thanks. lucianoenrico I got something working using MPVolumeView . This component has a button

Kohana 3.2. - How can I use hyphens in URIs

為{幸葍}努か 提交于 2019-12-01 05:44:40
问题 Recently I've been doing some research into SEO and how URIs that use hyphens or underscores are treated differently, particularly by Google who view hyphens as separators. Anyway, eager to adapt my current project to meet this criteria I found that because Kohana uses function names to define pages I was receiving the unexpected '-' warning. I was wondering whether there was any way to enable the use of URIs in Kohana like: http://www.mysite.com/controller/function-name Obviously I could

In Express or connect with Node.js, is there a way to call another route internally?

笑着哭i 提交于 2019-12-01 04:42:37
So, I have the setup like this (in Express): app.get('/mycall1', function(req,res) { res.send('Good'); }); app.get('/mycall2', function(req,res) { res.send('Good2'); }); What if I want make an aggregate function to call /mycall1 and /mycall2 without rewriting code and reusing code for /mycall1 and /mycall2 ? For example: app.get('/myAggregate', function (req, res) { // call /mycall1 // call /mycall2 }); No, this is not possible without rewriting or refactoring your code. The reason is that res.send actually calls res.end after it is done writing . That ends the response and nothing more can be

Yii2 routes definition in modules

匆匆过客 提交于 2019-12-01 04:31:49
问题 Is there any solution to add routes from module configuration? Example. We have main config where we describe 'components' => [ 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => require(FILE_PATH_CONFIG_ENV . '_routes.php') // return array ], ] in each module we load custom config file with private parameters public function loadConfig($sFileName = 'main', $sFolderName = 'config') { Yii::configure($this, require($this->getBasePath() . DS . $sFolderName . DS .

Rails routes matching query parameters

别来无恙 提交于 2019-12-01 04:05:59
Rails routes are great for matching RESTful style '/' separated bits of a URL, but can I match query parameters in a map.connect config. I want different controllers/actions to be invoked depending on the presence of a parameter after the '?' . I was trying something like this... map.connect "api/my/path?apple=:applecode", :controller => 'apples_controller', :action => 'my_action' map.connect "api/my/path?banana=:bananacode", :controller => 'bananas_controller', :action => 'my_action' For routing purposes I don't care about the value of the parameter, as long as it is available to the

How to list available audio output route on iOS

天大地大妈咪最大 提交于 2019-12-01 03:30:31
问题 Now i'd like to list available audio output route in my iPhone app, something like this: http://www.blogcdn.com/www.tuaw.com/media/2008/09/cb(iphone-101_-switch-between-audio-outputs-for-your-voicemail)1729387198273.jpg i know that i can use audioRouteChangeListener of audio session to get route change info, but this method only can get the message after my app launch, so if headset and bluetooth both are connected before my app run, how can i get these routes' messages, any tips are

Angular 4.3 Interceptors for Lazy Loaded Modules

可紊 提交于 2019-12-01 03:26:47
What is the best practice to use core module service in lazy loaded feature module and feature child modules. As per Angular style guide I have the following app -core - core.module.ts -logger.service.ts -token-interceptor.service.ts -authentication.service.ts -shared -shared.module.ts -base module (my feature base , lazy loaded with router-outlet) -base.module.ts -base.routing.module.ts -base -base.component.ts -admin (lazy loaded , child module of base module) -admin.module.ts -admin.routing.ts -admin-component.ts -report(lazy loaded , child module of base module, sibling of admin) -report