当前位置: 首页>>代码示例>>Java>>正文


Java ContentNegotiationStrategy类代码示例

本文整理汇总了Java中org.springframework.web.accept.ContentNegotiationStrategy的典型用法代码示例。如果您正苦于以下问题:Java ContentNegotiationStrategy类的具体用法?Java ContentNegotiationStrategy怎么用?Java ContentNegotiationStrategy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContentNegotiationStrategy类属于org.springframework.web.accept包,在下文中一共展示了ContentNegotiationStrategy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: commence

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
@Override
  public void commence(HttpServletRequest request, HttpServletResponse response,
      AuthenticationException authException) throws IOException, ServletException {

//    if (LOG.isDebugEnabled()) {
//      LOG.debug("Redirigiendo a pantalla de login: " + LOGIN_FORM_URL);
//    }

    ContentNegotiationStrategy negotiationStrategy = new HeaderContentNegotiationStrategy();
    MediaTypeRequestMatcher matcher =
        new MediaTypeRequestMatcher(negotiationStrategy, MediaType.TEXT_HTML);
    matcher.setUseEquals(false);

    if (matcher.matches(request)) {
      DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
      redirectStrategy.setContextRelative(false);
      redirectStrategy.sendRedirect(request, response, LOGIN_FORM_URL);
    } else {
      response.sendError(HttpServletResponse.SC_FORBIDDEN);
    }
  }
 
开发者ID:DISID,项目名称:springlets,代码行数:22,代码来源:SpringletsSecurityWebAuthenticationEntryPoint.java

示例2: handle

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
@Override
public void handle(HttpServletRequest request, HttpServletResponse response,
    AccessDeniedException accessDeniedException) throws IOException, ServletException {

  ContentNegotiationStrategy negotiationStrategy = new HeaderContentNegotiationStrategy();
  MediaTypeRequestMatcher matcher =
      new MediaTypeRequestMatcher(negotiationStrategy, MediaType.TEXT_HTML);
  matcher.setUseEquals(false);

  if (matcher.matches(request)) {
    DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
    redirectStrategy.setContextRelative(false);
    redirectStrategy.sendRedirect(request, response, "/errores/403");
  } else {
    response.sendError(HttpServletResponse.SC_FORBIDDEN);

  }

}
 
开发者ID:DISID,项目名称:springlets,代码行数:20,代码来源:SpringletsSecurityWebAccessDeniedHandlerImpl.java

示例3: setUp

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    mockContentNegotiationStrategy = mock(ContentNegotiationStrategy.class);
    when(mockContentNegotiationStrategy.resolveMediaTypes(any(NativeWebRequest.class))).thenReturn(Collections.<MediaType>emptyList());

    exceptionResolver = new AjaxHandlerExceptionResolver();
    mockUserContext = mock(UserContext.class);
    mockPatientContext = mock(PatientContext.class);
    mockEnvironment = mock(Environment.class);
    exceptionResolver.setUserContext(mockUserContext);
    exceptionResolver.setPatientContext(mockPatientContext);
    exceptionResolver.setEnvironment(mockEnvironment);
    exceptionResolver.setContentNegotiationStrategy(mockContentNegotiationStrategy);
    request = new MockHttpServletRequest();
    response = new MockHttpServletResponse();
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:17,代码来源:AjaxHandlerExceptionResolverTests.java

示例4: initPathStrategy

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
private static PathExtensionContentNegotiationStrategy initPathStrategy(ContentNegotiationManager manager) {
	for (ContentNegotiationStrategy strategy : manager.getStrategies()) {
		if (strategy instanceof PathExtensionContentNegotiationStrategy) {
			return (PathExtensionContentNegotiationStrategy) strategy;
		}
	}
	return new PathExtensionContentNegotiationStrategy();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:AbstractMessageConverterMethodProcessor.java

示例5: StationController

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
@Autowired
public StationController(IStreamingDao inStreamingDao, ICountDao inCountDao, ILogService inLogService,
		@Qualifier("maxResultRows") Integer inMaxResultRows,
		@Qualifier("stationWqx") IXmlMapping inXmlMapping,
		@Qualifier("stationKml") IXmlMapping inKmlMapping,
		@Qualifier("siteUrlBase") String inSiteUrlBase,
		ContentNegotiationStrategy contentStrategy,
		Validator validator) {
	super(inStreamingDao, inCountDao, inLogService, inMaxResultRows, inSiteUrlBase, contentStrategy, validator);
	xmlMapping = inXmlMapping;
	kmlMapping = inKmlMapping;
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:13,代码来源:StationController.java

示例6: ProjectController

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
@Autowired
public ProjectController(IStreamingDao inStreamingDao, ICountDao inCountDao, ILogService inLogService,
		@Qualifier("maxResultRows") Integer inMaxResultRows,
		@Qualifier("projectWqx") IXmlMapping inXmlMapping,
		@Qualifier("siteUrlBase") String inSiteUrlBase,
		ContentNegotiationStrategy inContentStrategy,
		Validator validator) {
	super(inStreamingDao, inCountDao, inLogService, inMaxResultRows, inSiteUrlBase, inContentStrategy, validator);
	xmlMapping = inXmlMapping;
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:11,代码来源:ProjectController.java

示例7: SimpleStationController

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
@Autowired
public SimpleStationController(IStreamingDao inStreamingDao, ICountDao inCountDao, ILogService inLogService,
		@Qualifier("maxResultRows") Integer inMaxResultRows,
		@Qualifier("simpleStationWqxOutbound") IXmlMapping inXmlMapping,
		@Qualifier("siteUrlBase") String inSiteUrlBase,
		ContentNegotiationStrategy contentStrategy,
		Validator validator) {
	super(inStreamingDao, inCountDao, inLogService, inMaxResultRows, inSiteUrlBase, contentStrategy, validator);
	xmlMapping = inXmlMapping;

	LOG.trace(getClass().getName());
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:13,代码来源:SimpleStationController.java

示例8: ActivityMetricController

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
@Autowired
public ActivityMetricController(IStreamingDao inStreamingDao, ICountDao inCountDao, ILogService inLogService,
		@Qualifier("maxResultRows") Integer inMaxResultRows,
		@Qualifier("activityMetricWqx") IXmlMapping inXmlMapping,
		@Qualifier("siteUrlBase") String inSiteUrlBase,
		ContentNegotiationStrategy contentStrategy,
		Validator validator) {
	super(inStreamingDao, inCountDao, inLogService, inMaxResultRows, inSiteUrlBase, contentStrategy, validator);
	xmlMapping = inXmlMapping;
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:11,代码来源:ActivityMetricController.java

示例9: BaseController

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
public BaseController(IStreamingDao inStreamingDao, ICountDao inCountDao, ILogService inLogService,
		Integer inMaxResultRows, String inSiteUrlBase, ContentNegotiationStrategy inContentStrategy,
		Validator inValidator) {
	LOG.trace(getClass().getName());

	streamingDao = inStreamingDao;
	countDao = inCountDao;
	logService = inLogService;
	maxResultRows = inMaxResultRows;
	siteUrlBase = inSiteUrlBase;
	contentStrategy = inContentStrategy;
	validator = inValidator;
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:14,代码来源:BaseController.java

示例10: ResDetectQntLmtController

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
@Autowired
public ResDetectQntLmtController(IStreamingDao inStreamingDao, ICountDao inCountDao, ILogService inLogService,
		@Qualifier("maxResultRows") Integer inMaxResultRows,
		@Qualifier("resDetectQntLmtWqx") IXmlMapping inXmlMapping,
		@Qualifier("siteUrlBase") String inSiteUrlBase,
		ContentNegotiationStrategy contentStrategy,
		Validator validator) {
	super(inStreamingDao, inCountDao, inLogService, inMaxResultRows, inSiteUrlBase, contentStrategy, validator);
	xmlMapping = inXmlMapping;
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:11,代码来源:ResDetectQntLmtController.java

示例11: ActivityController

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
@Autowired
public ActivityController(IStreamingDao inStreamingDao, ICountDao inCountDao, ILogService inLogService,
		@Qualifier("maxResultRows") Integer inMaxResultRows,
		@Qualifier("activityWqx") IXmlMapping inXmlMapping,
		@Qualifier("siteUrlBase") String inSiteUrlBase,
		ContentNegotiationStrategy contentStrategy,
		Validator validator) {
	super(inStreamingDao, inCountDao, inLogService, inMaxResultRows, inSiteUrlBase, contentStrategy, validator);
	xmlMapping = inXmlMapping;
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:11,代码来源:ActivityController.java

示例12: ResultController

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
@Autowired
public ResultController(IStreamingDao inStreamingDao, ICountDao inCountDao, ILogService inLogService,
		@Qualifier("maxResultRows") Integer inMaxResultRows,
		@Qualifier("resultWqx") IXmlMapping inXmlMapping,
		@Qualifier("siteUrlBase") String inSiteUrlBase,
		ContentNegotiationStrategy contentStrategy,
		Validator validator) {
	super(inStreamingDao, inCountDao, inLogService, inMaxResultRows, inSiteUrlBase, contentStrategy, validator);
	xmlMapping = inXmlMapping;
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:11,代码来源:ResultController.java

示例13: TestBaseController

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
public TestBaseController(IStreamingDao inStreamingDao,
		ICountDao inCountDao,
		ILogService inLogService, Integer inMaxRows, String inSiteUrlBase,
		ContentNegotiationStrategy contentStrategy,
		Validator validator) {
	super(inStreamingDao, inCountDao, inLogService, inMaxRows, inSiteUrlBase, contentStrategy, validator);
}
 
开发者ID:NWQMC,项目名称:WQP-WQX-Services,代码行数:8,代码来源:TestBaseController.java

示例14: setContentNegotiationStrategy

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
@Required
public void setContentNegotiationStrategy(ContentNegotiationStrategy contentNegotiationStrategy) {
    this.contentNegotiationStrategy = contentNegotiationStrategy;
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:5,代码来源:AjaxHandlerExceptionResolver.java

示例15: defaultContentTypeStrategy

import org.springframework.web.accept.ContentNegotiationStrategy; //导入依赖的package包/类
/**
 * Set a custom {@link ContentNegotiationStrategy} to use to determine
 * the content type to use when no content type is requested.
 * <p>By default this is not set.
 * @see #defaultContentType
 * @since 4.1.2
 */
public ContentNegotiationConfigurer defaultContentTypeStrategy(ContentNegotiationStrategy defaultStrategy) {
	this.factory.setDefaultContentTypeStrategy(defaultStrategy);
	return this;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:ContentNegotiationConfigurer.java


注:本文中的org.springframework.web.accept.ContentNegotiationStrategy类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。