This repository has been archived by the owner on Nov 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jih147
committed
Jun 12, 2023
1 parent
dca546a
commit bcb2668
Showing
6 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
13 changes: 13 additions & 0 deletions
13
...est-scorer/src/main/java/ai/h2o/mojos/deploy/local/rest/Converter/MultipartConverter.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package ai.h2o.mojos.deploy.local.rest.Converter; | ||
|
||
import org.springframework.core.convert.converter.Converter; | ||
import org.springframework.core.io.Resource; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
public class MultipartConverter implements Converter<MultipartFile, Resource> { | ||
|
||
@Override | ||
public Resource convert(MultipartFile source) { | ||
return source.getResource(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...er/src/main/java/ai/h2o/mojos/deploy/local/rest/Converter/ScoreMediaRequestConverter.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package ai.h2o.mojos.deploy.local.rest.Converter; | ||
|
||
import ai.h2o.mojos.deploy.common.rest.v2.model.ScoreMediaRequest; | ||
import com.google.gson.Gson; | ||
import org.springframework.core.convert.converter.Converter; | ||
|
||
public class ScoreMediaRequestConverter implements Converter<String, ScoreMediaRequest> { | ||
|
||
@Override | ||
public ScoreMediaRequest convert(String input) { | ||
return new Gson().fromJson(input, ScoreMediaRequest.class); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
local-rest-scorer/src/main/java/ai/h2o/mojos/deploy/local/rest/config/WebConfig.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package ai.h2o.mojos.deploy.local.rest.config; | ||
|
||
import ai.h2o.mojos.deploy.local.rest.converter.MultipartConverter; | ||
import ai.h2o.mojos.deploy.local.rest.converter.ScoreMediaRequestConverter; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.format.FormatterRegistry; | ||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | ||
|
||
public class WebConfig implements WebMvcConfigurer { | ||
|
||
@Override | ||
public void addFormatters(FormatterRegistry registry) { | ||
registry.addConverter(new MultipartConverter()); | ||
registry.addConverter(new ScoreMediaRequestConverter()); | ||
} | ||
} |
This file contains 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
This file contains 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