cleaned up getting the return type for the resource method
This commit is contained in:
parent
7e979449b2
commit
f2d530112e
|
@ -36,8 +36,8 @@ public class ResourceMethod {
|
||||||
this.resourceType = resourceType;
|
this.resourceType = resourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IResource getResourceType() throws IllegalAccessException, InstantiationException {
|
public Class getResourceType() throws IllegalAccessException, InstantiationException {
|
||||||
return (IResource)resourceType.newInstance();
|
return resourceType.getClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestType getRequestType() {
|
public RequestType getRequestType() {
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class Service extends HttpServlet {
|
||||||
ResourceMethod resourceMethod = resource.getMethod(params.keySet());
|
ResourceMethod resourceMethod = resource.getMethod(params.keySet());
|
||||||
if (null == resourceMethod) throw new MethodNotFoundException("No resource method available for the supplied parameters " + params);
|
if (null == resourceMethod) throw new MethodNotFoundException("No resource method available for the supplied parameters " + params);
|
||||||
|
|
||||||
FhirContext ctx = new FhirContext(resourceMethod.getResourceType().getClass());
|
FhirContext ctx = new FhirContext(resourceMethod.getResourceType());
|
||||||
XmlParser p = new XmlParser(ctx);
|
XmlParser p = new XmlParser(ctx);
|
||||||
response.getWriter().write(p.encodeResourceToString(resourceMethod.invoke(params)));
|
response.getWriter().write(p.encodeResourceToString(resourceMethod.invoke(params)));
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
|
Loading…
Reference in New Issue