Image error solve update
This commit is contained in:
@ -14,6 +14,7 @@ import net.shyshkin.study.fullstack.supportportal.backend.exception.domain.Profe
|
||||
import net.shyshkin.study.fullstack.supportportal.backend.mapper.ProfessorMapper;
|
||||
import net.shyshkin.study.fullstack.supportportal.backend.repository.ProfessorRepository;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@ -22,7 +23,6 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@ -55,6 +55,9 @@ public class ProfessorServiceImpl implements ProfessorService {
|
||||
private final ProfileImageService profileImageService;
|
||||
private final RestTemplateBuilder restTemplateBuilder;
|
||||
|
||||
@Value("${app.base-url}")
|
||||
private String baseUrl;
|
||||
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@PostConstruct
|
||||
@ -79,16 +82,11 @@ public class ProfessorServiceImpl implements ProfessorService {
|
||||
}
|
||||
|
||||
private String generateDefaultProfileImageUrl(UUID professorId) {
|
||||
return ServletUriComponentsBuilder.fromCurrentContextPath()
|
||||
.path(String.format(DEFAULT_USER_IMAGE_URI_PATTERN, professorId))
|
||||
.toUriString();
|
||||
return baseUrl + String.format(DEFAULT_USER_IMAGE_URI_PATTERN, professorId);
|
||||
}
|
||||
|
||||
private String generateProfileImageUrl(UUID professorId) {
|
||||
return ServletUriComponentsBuilder.fromCurrentContextPath()
|
||||
.path(String.format(DEFAULT_USER_IMAGE_URI_PATTERN, professorId))
|
||||
.pathSegment(USER_IMAGE_FILENAME)
|
||||
.toUriString();
|
||||
return baseUrl + String.format(DEFAULT_USER_IMAGE_URI_PATTERN, professorId) + "/" + USER_IMAGE_FILENAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user