Skip to content
Closed

Polish #42095

Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -121,26 +121,20 @@ public void setApplicationContext(ApplicationContext applicationContext) throws

@Override
public BeanFactoryInitializationAotContribution processAheadOfTime(ConfigurableListableBeanFactory beanFactory) {
return new BeanFactoryInitializationAotContribution() {

@Override
public void applyTo(GenerationContext generationContext,
BeanFactoryInitializationCode beanFactoryInitializationCode) {
for (String beanName : beanFactory.getBeanDefinitionNames()) {
BeanDefinition definition = beanFactory.getBeanDefinition(beanName);
if (Objects.equals(definition.getBeanClassName(),
WebListenerHandler.ServletComponentWebListenerRegistrar.class.getName())) {
String listenerClassName = (String) definition.getConstructorArgumentValues()
.getArgumentValue(0, String.class)
.getValue();
generationContext.getRuntimeHints()
.reflection()
.registerType(TypeReference.of(listenerClassName),
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
}
return (generationContext, beanFactoryInitializationCode) -> {
for (String beanName : beanFactory.getBeanDefinitionNames()) {
BeanDefinition definition = beanFactory.getBeanDefinition(beanName);
if (Objects.equals(definition.getBeanClassName(),
WebListenerHandler.ServletComponentWebListenerRegistrar.class.getName())) {
String listenerClassName = (String) definition.getConstructorArgumentValues()
.getArgumentValue(0, String.class)
.getValue();
generationContext.getRuntimeHints()
.reflection()
.registerType(TypeReference.of(listenerClassName),
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS);
}
}

};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,12 @@ private static class ErrorWrapperResponse extends HttpServletResponseWrapper {
}

@Override
public void sendError(int status) throws IOException {
public void sendError(int status) {
sendError(status, null);
}

@Override
public void sendError(int status, String message) throws IOException {
public void sendError(int status, String message) {
this.status = status;
this.message = message;
this.hasErrorToSend = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void setCharset(String charset) {
}

@Override
public boolean checkResource(Locale locale) throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change as the method is public API. Please revert.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review. I’ve updated the code to address the points you mentioned. Please have another look when you have a chance.

public boolean checkResource(Locale locale) {
Resource resource = getApplicationContext().getResource(getUrl());
return (resource != null && resource.exists());
}
Expand Down