使用子资源重写Angular 2 App的URL

时间:2016-07-29 21:34:47

标签: angular jetty

我的angular 2 RC4应用程序有以下路线。我正在使用Jetty并且我配置了URL重写,它适用于/ meetings和/ about但是当我尝试/ meetings / 1234时它给出了404.我看到重写URL为/index.html/1234。此时我不确定我的重写规则是否不正确或者路由配置中是否有关闭。任何指针都会有所帮助。

路线 -

{ path: 'home', component: HomeComponent },
{ path: '', component: ConferencesComponent },
{ path: 'conferences', component: ConferencesComponent },
{ path: 'about', component: AboutComponent},
{ path: 'conferences/:id', component: ConferenceEditComponent}

重写码头规则 -

RewritePatternRule oldToNew2 = new RewritePatternRule();
oldToNew2.setPattern("/publicationhubdashboard/conferences");
oldToNew2.setReplacement("/publicationhubdashboard/index.html");
rewrite.addRule(oldToNew2);

RewritePatternRule oldToNew = new RewritePatternRule();
oldToNew.setPattern("/publicationhubdashboard/conferences/*");
oldToNew.setReplacement("/publicationhubdashboard/index.html");
rewrite.addRule(oldToNew);

RewritePatternRule oldToNew1 = new RewritePatternRule();
oldToNew1.setPattern("/publicationhubdashboard/about");
oldToNew1.setReplacement("/publicationhubdashboard/index.html");
rewrite.addRule(oldToNew1);

0 个答案:

没有答案