本文整理匯總了Java中org.springframework.web.servlet.config.annotation.ViewControllerRegistry類的典型用法代碼示例。如果您正苦於以下問題:Java ViewControllerRegistry類的具體用法?Java ViewControllerRegistry怎麽用?Java ViewControllerRegistry使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ViewControllerRegistry類屬於org.springframework.web.servlet.config.annotation包,在下文中一共展示了ViewControllerRegistry類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: webMvcConfigurer
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Bean
public WebMvcConfigurer webMvcConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addViewControllers(ViewControllerRegistry viewControllerRegistry) {
// 首頁默認加載web端
viewControllerRegistry.addViewController("/").setViewName("/web/index.html");
viewControllerRegistry.addViewController("/index.html").setViewName("redirect:/");
// web首頁
viewControllerRegistry.addViewController("/web").setViewName("/web/index.html");
// webapp首頁
viewControllerRegistry.addViewController("/webapp").setViewName("/webapp/index.html");
viewControllerRegistry.setOrder(Ordered.HIGHEST_PRECEDENCE);
super.addViewControllers(viewControllerRegistry);
}
};
}
示例2: addViewControllers
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Override
public void addViewControllers(ViewControllerRegistry registry) {
super.addViewControllers(registry);
registry.addRedirectViewController("/", "/ui");
registry.addViewController("/ui/**").setViewName("forward:/index.html");
}
示例3: addViewControllers
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
super.addViewControllers(registry);
registry.addViewController("/login/form")
.setViewName("login");
registry.addViewController("/errors/403")
.setViewName("/errors/403");
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
}
示例4: addViewControllers
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController( "/" ).setViewName("index");
registry.setOrder(Ordered.HIGHEST_PRECEDENCE );
registry.addViewController( "/edit" ).setViewName("edit");
registry.addViewController( "/upload" ).setViewName("upload");
super.addViewControllers(registry);
}
示例5: addViewControllers
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
/**
* 配置默認路徑為文檔
* @param registry
*/
@Override
public void addViewControllers( ViewControllerRegistry registry ) {
registry.addViewController( "" ).setViewName( "redirect:/swagger-ui.html" );
registry.setOrder( Ordered.HIGHEST_PRECEDENCE );
super.addViewControllers( registry );
}
示例6: forwardToIndex
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Bean
public WebMvcConfigurerAdapter forwardToIndex() {
return new WebMvcConfigurerAdapter() {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
// forward requests to /admin and /user to their index.html
registry.addViewController("/**").setViewName(
"forward:/index.html");
}
};
}
示例7: addViewControllers
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/viewUsers").setViewName("viewUsers");
registry.addViewController("/index").setViewName("index");
registry.addViewController("/").setViewName("index");
registry.addViewController("/login").setViewName("login");
}
示例8: addViewControllers
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/index").setViewName("/index");
registry.addViewController("/toUpload").setViewName("/upload");
registry.addViewController("/converter").setViewName("/converter");
registry.addViewController("/sse").setViewName("/sse");
}
示例9: addViewControllers
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/index").setViewName("/index");
registry.addViewController("/toUpload").setViewName("/upload");
registry.addViewController("/converter").setViewName("/converter");
registry.addViewController("/sse").setViewName("/sse");
registry.addViewController("/async").setViewName("/async");
}
示例10: webMvcConfigurerAdapter
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Bean
public WebMvcConfigurerAdapter webMvcConfigurerAdapter() {
return new WebMvcConfigurerAdapter() {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/")
.setStatusCode(HttpStatus.PERMANENT_REDIRECT)
.setViewName("/swagger-ui.html");
}
};
}
示例11: addViewControllers
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("home");
registry.addViewController("/home").setViewName("home");
registry.addViewController("/login").setViewName("login");
registry.addViewController("/oauth/confirm_access").setViewName("authorize");
}
示例12: addViewControllers
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Override
public void addViewControllers(final ViewControllerRegistry registry) {
registry.addViewController("/ui").setViewName("redirect:ui/");
registry.addViewController("/ui/").setViewName("forward:index.html");
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
super.addViewControllers(registry);
}
示例13: forwardToIndex
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; //導入依賴的package包/類
@Bean
public WebMvcConfigurerAdapter forwardToIndex() {
return new WebMvcConfigurerAdapter() {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
// forward requests index.htm (as we might have two spring boot tomcats running in the same JVM they can see each others resources
// so we use different index files to avoid confusion
registry.addViewController("/").setViewName(
"forward:/monitor.html");
}
};
}