This repository has been archived by the owner on Mar 25, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from rasanjanap/master
Don't mege GSoC work on progress
- Loading branch information
Showing
34 changed files
with
2,799 additions
and
6 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
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
53 changes: 53 additions & 0 deletions
53
omod/src/main/java/org/openmrs/module/fhir/filter/SwaggerForwardingFilter.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,53 @@ | ||
/* | ||
* The contents of this file are subject to the OpenMRS Public License | ||
* Version 1.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* http://license.openmrs.org | ||
* | ||
* Software distributed under the License is distributed on an "AS IS" | ||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing rights and limitations | ||
* under the License. | ||
* | ||
* Copyright (C) OpenMRS, LLC. All Rights Reserved. | ||
*/ | ||
package org.openmrs.module.fhir.filter; | ||
|
||
import org.openmrs.module.fhir.util.FHIROmodConstants; | ||
|
||
import javax.servlet.Filter; | ||
import javax.servlet.FilterChain; | ||
import javax.servlet.FilterConfig; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.ServletRequest; | ||
import javax.servlet.ServletResponse; | ||
import javax.servlet.http.HttpServletRequest; | ||
import java.io.IOException; | ||
|
||
public class SwaggerForwardingFilter implements Filter { | ||
|
||
private String openmrsPath; | ||
|
||
@Override | ||
public void init(FilterConfig fc) throws ServletException { | ||
openmrsPath = fc.getServletContext().getContextPath(); | ||
} | ||
|
||
@Override | ||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { | ||
HttpServletRequest request = (HttpServletRequest) req; | ||
String requestURI = request.getRequestURI(); | ||
|
||
if (requestURI.startsWith(openmrsPath + FHIROmodConstants.OPENMRS_FHIR_SWAGGER_SHORT_PATH)) { | ||
String newURI = requestURI.replace(FHIROmodConstants.OPENMRS_FHIR_SWAGGER_LONG_PATH, FHIROmodConstants.OPENMRS_FHIR_SWAGGER_ORG_PATH); | ||
req.getRequestDispatcher(newURI).forward(req, res); | ||
} else { | ||
chain.doFilter(req, res); | ||
} | ||
} | ||
|
||
@Override | ||
public void destroy() { | ||
} | ||
|
||
} |
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
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
46 changes: 46 additions & 0 deletions
46
omod/src/main/java/org/openmrs/module/fhir/server/ConformanceProvider.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,46 @@ | ||
/* | ||
* The contents of this file are subject to the OpenMRS Public License | ||
* Version 1.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* http://license.openmrs.org | ||
* | ||
* Software distributed under the License is distributed on an "AS IS" | ||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing rights and limitations | ||
* under the License. | ||
* | ||
* Copyright (C) OpenMRS, LLC. All Rights Reserved. | ||
*/ | ||
package org.openmrs.module.fhir.server; | ||
|
||
import ca.uhn.fhir.model.dstu2.resource.Conformance; | ||
import ca.uhn.fhir.rest.server.RestfulServer; | ||
import ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider; | ||
|
||
public class ConformanceProvider { | ||
|
||
private static Conformance conformance = null; | ||
private static RestfulServer restfulServer; | ||
|
||
public static void setConformance(Conformance conformanceStatement) { | ||
conformance = conformanceStatement; | ||
} | ||
|
||
public static Conformance getConformance() { | ||
if(conformance == null) { | ||
ServerConformanceProvider confProvider = (ServerConformanceProvider) restfulServer.getServerConformanceProvider(); | ||
conformance = confProvider.getServerConformance(null); | ||
return conformance; | ||
} else { | ||
return conformance; | ||
} | ||
} | ||
|
||
public static RestfulServer getRestfulServer() { | ||
return restfulServer; | ||
} | ||
|
||
public void setRestfulServer(RestfulServer restfulServer) { | ||
this.restfulServer = restfulServer; | ||
} | ||
} |
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
Oops, something went wrong.