Skip to content

Commit

Permalink
Issue #130 refactoring: serving static content
Browse files Browse the repository at this point in the history
  • Loading branch information
jyotsnaraveendran committed Mar 28, 2018
1 parent 4d4dc2e commit 91394b0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 3,024 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ public class GenericConfiguration implements WebMvcConfigurer {
@Autowired
private Environment environment;

@Value("${vocab.fileName}")
private String vocabFileName;

@Value("${connection.timeout}")
private int connectionTimeout;

Expand Down Expand Up @@ -159,19 +156,12 @@ public void addInterceptors(InterceptorRegistry registry) {
}

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
String resourcePath=null;
try {
resourcePath=this.getClass().getClassLoader().getResource(vocabFileName).toURI().toString();
} catch (URISyntaxException e) {
e.printStackTrace();
logger.error("ERROR!", e);
}
registry.addResourceHandler("/resources/**")
.addResourceLocations(resourcePath)
.setCachePeriod(3600)
.resourceChain(true)
.addResolver(new PathResourceResolver());
}
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/resources/**")
.addResourceLocations("classpath:/BOOT-INF/classes/vocabulary/")
.setCachePeriod(3600)
.resourceChain(true)
.addResolver(new PathResourceResolver());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ public class RegistryController {
@Value("${registry.context.base}")
private String registryContext;

@Value("${vocab.fileName}")
private String vocabFileName;


@ResponseBody
@RequestMapping(value = "/create", method = RequestMethod.POST)
public ResponseEntity<Response> addEntity(@RequestAttribute Request requestModel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,3 @@ encryption.uri= ${encryption.decryption.base}encrypt
decryption.uri= ${encryption.decryption.base}decrypt
sunbird.encryption-service.health.check=https://dev.open-sunbird.org/encryption/

##############################################################
# Vocab file Config #
##############################################################
vocab.fileName=teacher.owl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,3 @@ encryption.decryption.base=https://dev.open-sunbird.org/encryption/
encryption.uri= ${encryption.decryption.base}encrypt
decryption.uri= ${encryption.decryption.base}decrypt
sunbird.encryption-service.health.check=https://test-enc-service-health-check.com/encryption/

##############################################################
# Vocab file Config #
##############################################################
vocab.fileName=teacher.owl
Loading

0 comments on commit 91394b0

Please sign in to comment.