use of org.springframework.lang.NonNull in project joinfaces by joinfaces.
the class ViewScope method getViewRoot.
@NonNull
private UIViewRoot getViewRoot() {
FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext == null) {
throw new IllegalStateException("No FacesContext found.");
}
UIViewRoot viewRoot = facesContext.getViewRoot();
if (viewRoot == null) {
throw new IllegalStateException("No ViewRoot found");
}
return viewRoot;
}
use of org.springframework.lang.NonNull in project spring-security by spring-projects.
the class OAuth2AuthorizedClientArgumentResolver method resolveArgument.
@NonNull
@Override
public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) {
String clientRegistrationId = this.resolveClientRegistrationId(parameter);
if (StringUtils.isEmpty(clientRegistrationId)) {
throw new IllegalArgumentException("Unable to resolve the Client Registration Identifier. " + "It must be provided via @RegisteredOAuth2AuthorizedClient(\"client1\") or " + "@RegisteredOAuth2AuthorizedClient(registrationId = \"client1\").");
}
Authentication principal = SecurityContextHolder.getContext().getAuthentication();
if (principal == null) {
principal = ANONYMOUS_AUTHENTICATION;
}
HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class);
HttpServletResponse servletResponse = webRequest.getNativeResponse(HttpServletResponse.class);
// @formatter:off
OAuth2AuthorizeRequest authorizeRequest = OAuth2AuthorizeRequest.withClientRegistrationId(clientRegistrationId).principal(principal).attribute(HttpServletRequest.class.getName(), servletRequest).attribute(HttpServletResponse.class.getName(), servletResponse).build();
// @formatter:on
return this.authorizedClientManager.authorize(authorizeRequest);
}
use of org.springframework.lang.NonNull in project spring-framework by spring-projects.
the class ClientHttpConnectorTests method randomBody.
@NonNull
private Buffer randomBody(int size) {
Buffer responseBody = new Buffer();
Random rnd = new Random();
for (int i = 0; i < size; i++) {
byte[] bytes = new byte[BUF_SIZE];
rnd.nextBytes(bytes);
responseBody.write(bytes);
}
return responseBody;
}
use of org.springframework.lang.NonNull in project gwt-test-utils by gwt-test-utils.
the class GwtTestContextLoader method createBeanDefinitionReader.
@NonNull
@Override
protected BeanDefinitionReader createBeanDefinitionReader(GenericApplicationContext context) {
XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(context);
beanDefinitionReader.setResourceLoader(new DefaultResourceLoader(GwtFactory.get().getClassLoader()));
return beanDefinitionReader;
}
use of org.springframework.lang.NonNull in project spring-framework by spring-projects.
the class SqlScriptsTestExecutionListener method createDatabasePopulator.
@NonNull
private ResourceDatabasePopulator createDatabasePopulator(MergedSqlConfig mergedSqlConfig) {
ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
populator.setSqlScriptEncoding(mergedSqlConfig.getEncoding());
populator.setSeparator(mergedSqlConfig.getSeparator());
populator.setCommentPrefixes(mergedSqlConfig.getCommentPrefixes());
populator.setBlockCommentStartDelimiter(mergedSqlConfig.getBlockCommentStartDelimiter());
populator.setBlockCommentEndDelimiter(mergedSqlConfig.getBlockCommentEndDelimiter());
populator.setContinueOnError(mergedSqlConfig.getErrorMode() == ErrorMode.CONTINUE_ON_ERROR);
populator.setIgnoreFailedDrops(mergedSqlConfig.getErrorMode() == ErrorMode.IGNORE_FAILED_DROPS);
return populator;
}
Aggregations