本文整理汇总了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");
}
};
}