本文整理匯總了Java中org.springframework.web.servlet.view.UrlBasedViewResolver類的典型用法代碼示例。如果您正苦於以下問題:Java UrlBasedViewResolver類的具體用法?Java UrlBasedViewResolver怎麽用?Java UrlBasedViewResolver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
UrlBasedViewResolver類屬於org.springframework.web.servlet.view包,在下文中一共展示了UrlBasedViewResolver類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: contentNegotiatingViewResolver
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Bean
public ViewResolver contentNegotiatingViewResolver() {
logger.debug("Configuring the ContentNegotiatingViewResolver");
ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver();
List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>();
UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
urlBasedViewResolver.setViewClass(JstlView.class);
urlBasedViewResolver.setSuffix(".html");
viewResolvers.add(urlBasedViewResolver);
viewResolver.setViewResolvers(viewResolvers);
List<View> defaultViews = new ArrayList<View>();
defaultViews.add(new MappingJackson2JsonView());
viewResolver.setDefaultViews(defaultViews);
return viewResolver;
}
示例2: contentNegotiatingViewResolver
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Bean
public ViewResolver contentNegotiatingViewResolver() {
LOGGER.debug("Configuring the ContentNegotiatingViewResolver");
ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver();
List<ViewResolver> viewResolvers = new ArrayList<>();
UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
urlBasedViewResolver.setViewClass(JstlView.class);
urlBasedViewResolver.setPrefix("/WEB-INF/pages/");
urlBasedViewResolver.setSuffix(".jsp");
viewResolvers.add(urlBasedViewResolver);
viewResolver.setViewResolvers(viewResolvers);
List<View> defaultViews = new ArrayList<>();
defaultViews.add(new MappingJackson2JsonView());
viewResolver.setDefaultViews(defaultViews);
return viewResolver;
}
示例3: contentNegotiatingViewResolver
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Bean
public ViewResolver contentNegotiatingViewResolver(
ContentNegotiationManager manager) {
List< ViewResolver > resolvers = new ArrayList<ViewResolver>();
UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
viewResolver.setViewClass(TilesView.class);
resolvers.add(viewResolver);
JsonViewResolver r2 = new JsonViewResolver();
resolvers.add(r2);
ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
resolver.setViewResolvers(resolvers);
resolver.setContentNegotiationManager(manager);
return resolver;
}
示例4: urlBasedViewResolver
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Bean
public UrlBasedViewResolver urlBasedViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
}
示例5: setupViewResolver
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Bean
public UrlBasedViewResolver setupViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/WEB-INF/jsp/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
}
示例6: postHandle
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
// we want to add usual model in modelAndView only when needed, ie with
// direct html view :
// not for download response (for example) because we don't need it
// not for redirect view because we don't need it and we don't want that
// they appears in the url
if (modelAndView != null && modelAndView.hasView()) {
boolean isViewObject = modelAndView.getView() == null;
boolean isRedirectView = !isViewObject && modelAndView.getView() instanceof RedirectView;
boolean viewNameStartsWithRedirect = isViewObject && modelAndView.getViewName().startsWith(UrlBasedViewResolver.REDIRECT_URL_PREFIX);
if (!isRedirectView && !viewNameStartsWithRedirect) {
String esupNfcTagDroidApkUrl = esupNfcTagService.getWebUrl() + "/nfc-index/download-apk";
modelAndView.addObject("esupNfcTagDroidApkUrl", esupNfcTagDroidApkUrl);
String esupNfcTagDesktopJarUrl = esupNfcTagService.getWebUrl() + "/nfc-index/download-jar";
modelAndView.addObject("esupNfcTagDesktopJarUrl", esupNfcTagDesktopJarUrl);
// modelAndView.addObject("versionEsuSgc", AppliVersion.getCacheVersion());
}
if(request.getParameter("size")!=null) {
Integer size = Integer.valueOf(request.getParameter("size"));
request.getSession().setAttribute("size_in_session", size);
} else if(request.getSession(false)!=null && request.getSession().getAttribute("size_in_session") == null) {
request.getSession().setAttribute("size_in_session", new Integer(10));
}
}
}
示例7: setupViewResolver
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
/**
* @return ViewResolver
*/
@Bean
public UrlBasedViewResolver setupViewResolver() {
final UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/");
resolver.setSuffix(".html");
resolver.setViewClass(JstlView.class);
return resolver;
}
示例8: postHandle
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
boolean isRedirectView = modelAndView!=null && modelAndView.getView() instanceof RedirectView;
// boolean isViewObject = modelAndView.getView() == null;
// if the view name is null then set a default value of true
boolean viewNameStartsWithRedirect = (modelAndView!=null && modelAndView.getViewName() == null ? true
: modelAndView!=null && modelAndView.getViewName().startsWith(UrlBasedViewResolver.REDIRECT_URL_PREFIX));
if (modelAndView!=null && modelAndView.hasView() && !isRedirectView && !viewNameStartsWithRedirect) {
addCommonModelData(modelAndView);
}
}
示例9: postHandle
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
ModelAndView modelAndView) throws Exception {
// 如果不存在 ModelAndView 或者 ModelAndView 裏沒有指定 View,則直接返回
if (modelAndView == null || !modelAndView.hasView()) {
if (logger.isDebugEnabled()) {
logger.debug("Request {} has no modelAndView.", request.getRequestURI());
}
return;
}
String viewName = modelAndView.getViewName();
boolean isRedirectView = (modelAndView.getView() instanceof RedirectView)
|| (viewName != null && viewName.startsWith(UrlBasedViewResolver.REDIRECT_URL_PREFIX));
if (logger.isDebugEnabled()) {
logger.debug("Request {} {} a redirect uri.", request.getRequestURI(), isRedirectView ? "is" : "is not");
}
// 如果 ModelAndView 是 Redirect 方式,則直接返回
if (isRedirectView) {
return;
}
// 添加公共屬性到 Model 中
addCommonModelData(request, modelAndView);
if (logger.isDebugEnabled()) {
logger.debug("Added common model data for {}.", request.getRequestURI());
}
}
示例10: setupViewResolver
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Bean
public UrlBasedViewResolver setupViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
}
示例11: setUpJSPViewResolver
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Bean
public UrlBasedViewResolver setUpJSPViewResolver() {
UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
urlBasedViewResolver.setSuffix(".jsp");
urlBasedViewResolver.setPrefix("/");
urlBasedViewResolver.setViewClass(JstlView.class);
return urlBasedViewResolver;
}
示例12: springfieldWebmvcRenderTilesView
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Bean
public UrlBasedViewResolver springfieldWebmvcRenderTilesView()throws Exception{
UrlBasedViewResolver bean = new UrlBasedViewResolver();
bean.setViewClass(TilesView.class);
bean.setOrder(Ordered.LOWEST_PRECEDENCE);
return bean;
}
示例13: springfieldTilesView
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Bean
public UrlBasedViewResolver springfieldTilesView()throws Exception{
UrlBasedViewResolver bean = new UrlBasedViewResolver();
bean.setViewClass(TilesView.class);
bean.setOrder(Ordered.LOWEST_PRECEDENCE);
return bean;
}
示例14: tilesViewResolver
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Bean
public UrlBasedViewResolver tilesViewResolver()
{
UrlBasedViewResolver bean = new UrlBasedViewResolver();
bean.setViewClass(org.springframework.web.servlet.view.tiles3.TilesView.class);
return bean;
}
示例15: faceletsViewResolver
import org.springframework.web.servlet.view.UrlBasedViewResolver; //導入依賴的package包/類
@Bean
public UrlBasedViewResolver faceletsViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setViewClass(JsfView.class);
resolver.setPrefix("/WEB-INF/views/");
resolver.setSuffix(".xhtml");
return resolver;
}