VaadinConnectController.java (vaadin-flow-4.0.7) | : | VaadinConnectController.java (vaadin-flow-4.0.8) | ||
---|---|---|---|---|
skipping to change at line 70 | skipping to change at line 70 | |||
import org.springframework.http.MediaType; | import org.springframework.http.MediaType; | |||
import org.springframework.http.ResponseEntity; | import org.springframework.http.ResponseEntity; | |||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; | import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; | |||
import org.springframework.util.ClassUtils; | import org.springframework.util.ClassUtils; | |||
import org.springframework.web.bind.annotation.PathVariable; | import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.PostMapping; | import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | |||
import com.vaadin.flow.function.DeploymentConfiguration; | import com.vaadin.flow.function.DeploymentConfiguration; | |||
import com.vaadin.flow.internal.CurrentInstance; | ||||
import com.vaadin.flow.server.VaadinRequest; | ||||
import com.vaadin.flow.server.VaadinService; | import com.vaadin.flow.server.VaadinService; | |||
import com.vaadin.flow.server.VaadinServletRequest; | import com.vaadin.flow.server.VaadinServletRequest; | |||
import com.vaadin.flow.server.VaadinServletService; | import com.vaadin.flow.server.VaadinServletService; | |||
import com.vaadin.flow.server.connect.auth.VaadinConnectAccessChecker; | import com.vaadin.flow.server.connect.auth.VaadinConnectAccessChecker; | |||
import com.vaadin.flow.server.connect.exception.EndpointException; | import com.vaadin.flow.server.connect.exception.EndpointException; | |||
import com.vaadin.flow.server.connect.exception.EndpointValidationException; | import com.vaadin.flow.server.connect.exception.EndpointValidationException; | |||
import com.vaadin.flow.server.connect.exception.EndpointValidationException.Vali dationErrorData; | import com.vaadin.flow.server.connect.exception.EndpointValidationException.Vali dationErrorData; | |||
import com.vaadin.flow.server.startup.ServletDeployer.StubServletConfig; | import com.vaadin.flow.server.startup.ServletDeployer.StubServletConfig; | |||
/** | /** | |||
skipping to change at line 279 | skipping to change at line 281 | |||
getLogger().debug("Method '{}' not found in endpoint '{}'", | getLogger().debug("Method '{}' not found in endpoint '{}'", | |||
methodName, endpointName); | methodName, endpointName); | |||
return ResponseEntity.notFound().build(); | return ResponseEntity.notFound().build(); | |||
} | } | |||
try { | try { | |||
// Put a VaadinRequest in the instances object so as the request is | // Put a VaadinRequest in the instances object so as the request is | |||
// available in the end-point method | // available in the end-point method | |||
VaadinServletService service = (VaadinServletService)VaadinService.g etCurrent(); | VaadinServletService service = (VaadinServletService)VaadinService.g etCurrent(); | |||
if (service != null) { | CurrentInstance.set(VaadinRequest.class, new VaadinServletRequest(re | |||
service.setCurrentInstances(new VaadinServletRequest(request, se | quest, service)); | |||
rvice), null); | ||||
} | ||||
return invokeVaadinEndpointMethod(endpointName, methodName, | return invokeVaadinEndpointMethod(endpointName, methodName, | |||
methodToInvoke, body, vaadinEndpointData, request); | methodToInvoke, body, vaadinEndpointData, request); | |||
} catch (JsonProcessingException e) { | } catch (JsonProcessingException e) { | |||
String errorMessage = String.format( | String errorMessage = String.format( | |||
"Failed to serialize endpoint '%s' method '%s' response. " | "Failed to serialize endpoint '%s' method '%s' response. " | |||
+ "Double check method's return type or specify a cu stom mapper bean with qualifier '%s'", | + "Double check method's return type or specify a cu stom mapper bean with qualifier '%s'", | |||
endpointName, methodName, | endpointName, methodName, | |||
VAADIN_ENDPOINT_MAPPER_BEAN_QUALIFIER); | VAADIN_ENDPOINT_MAPPER_BEAN_QUALIFIER); | |||
getLogger().error(errorMessage, e); | getLogger().error(errorMessage, e); | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added |