This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (invocation != null) { | |
| val annotation: Cacheable? = | |
| invocation.method().getAnnotation(Cacheable::class.java) | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var request = chain.request() | |
| val invocation: Invocation? = request.tag(Invocation::class.java) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class NetworkInterceptor: Interceptor { | |
| override fun intercept(chain: Interceptor.Chain): Response { | |
| Timber.d("network interceptor: called.") | |
| val response = chain.proceed(chain.request()) | |
| val cacheControl = CacheControl.Builder() | |
| .maxAge(5, TimeUnit.SECONDS) | |
| .build() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @MustBeDocumented | |
| @Target(AnnotationTarget.FUNCTION) | |
| @Retention(AnnotationRetention.RUNTIME) | |
| annotation class Cacheable {} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mvn update ~= ./gradlew build --refresh-dependencies | |
| mvn clean install ~= ./gradlew clean build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create user 'sa'@'localhost' identified by 'sa1234'; -- Create the user | |
| grant all on exercise1.* to 'sa'@'localhost'; -- Gives all privileges to that user on new db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public ResponseEntity<Object> downloadFile(String fileName, HttpServletRequest request) throws Exception { | |
| Storage storage = storageOptions.getService(); | |
| Blob blob = storage.get(BlobId.of(bucketName, fileName)); | |
| ReadChannel reader = blob.reader(); | |
| InputStream inputStream = Channels.newInputStream(reader); | |
| byte[] content = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public String[] uploadFile(MultipartFile multipartFile) throws IOException { | |
| File file = convertMultiPartToFile(multipartFile); | |
| Path filePath = file.toPath(); | |
| String objectName = generateFileName(multipartFile); | |
| Storage storage = storageOptions.getService(); | |
| BlobId blobId = BlobId.of(bucketName, objectName); | |
| BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public String[] uploadFile(MultipartFile multipartFile) throws IOException { | |
| System.out.println("bucket name====" + bucketName); | |
| File file = convertMultiPartToFile(multipartFile); | |
| Path filePath = file.toPath(); | |
| String objectName = generateFileName(multipartFile); | |
| Storage storage = storageOptions.getService(); | |
| BlobId blobId = BlobId.of(bucketName, objectName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Service | |
| public class FirebaseStorageStrategy implements StorageStrategy { | |
| private final Logger log = LoggerFactory.getLogger(FirebaseStorageStrategy.class); | |
| private final Environment environment; | |
| private StorageOptions storageOptions; | |
| private String bucketName; | |
| private String projectId; | |
| public FirebaseStorageStrategy(Environment environment) { |