Changeset 2091 for openmrs-modules/restmodule/web/src/org/openmrs
- Timestamp:
- 07/27/07 15:40:55 (1 year ago)
- Files:
-
- openmrs-modules/restmodule/web/src/org/openmrs/module/restmodule/web/FindPatientResource.java (modified) (1 diff)
- openmrs-modules/restmodule/web/src/org/openmrs/module/restmodule/web/PatientResource.java (modified) (1 diff)
- openmrs-modules/restmodule/web/src/org/openmrs/module/restmodule/web/RestResource.java (modified) (2 diffs)
- openmrs-modules/restmodule/web/src/org/openmrs/module/restmodule/web/RestServlet.java (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs-modules/restmodule/web/src/org/openmrs/module/restmodule/web/FindPatientResource.java
r1411 r2091 25 25 * Handle all requests to this patient search resource 26 26 */ 27 public void handleRequest( intoperation, String restRequest,27 public void handleRequest(Operation operation, String restRequest, 28 28 HttpServletRequest request, HttpServletResponse response) 29 29 throws ServletException, IOException { openmrs-modules/restmodule/web/src/org/openmrs/module/restmodule/web/PatientResource.java
r1411 r2091 25 25 * Handle all requests to this resource 26 26 */ 27 public void handleRequest( intoperation, String restRequest,27 public void handleRequest(Operation operation, String restRequest, 28 28 HttpServletRequest request, HttpServletResponse response) 29 29 throws ServletException, IOException { openmrs-modules/restmodule/web/src/org/openmrs/module/restmodule/web/RestResource.java
r1409 r2091 17 17 18 18 // Rest Operations 19 public static final int GET = 1; 20 public static final int POST = 2; 21 public static final int PUT = 3; 22 public static final int DELETE = 4; 23 19 public enum Operation {GET, POST, PUT, DELETE}; 20 24 21 /** 25 22 * Used to pass request to the given resource … … 36 33 * @throws IOException 37 34 */ 38 public void handleRequest( intoperation, String restRequest,35 public void handleRequest(Operation operation, String restRequest, 39 36 HttpServletRequest request, HttpServletResponse response) 40 37 throws ServletException, IOException; openmrs-modules/restmodule/web/src/org/openmrs/module/restmodule/web/RestServlet.java
r1495 r2091 12 12 import org.openmrs.api.APIAuthenticationException; 13 13 import org.openmrs.module.restmodule.RestUtil; 14 import org.openmrs.module.restmodule.web.RestResource.Operation; 14 15 15 16 /** … … 47 48 protected void doGet(HttpServletRequest request, 48 49 HttpServletResponse response) throws ServletException, IOException { 49 handleRequest( RestResource.GET, request, response);50 handleRequest(Operation.GET, request, response); 50 51 } 51 52 … … 53 54 protected void doPost(HttpServletRequest request, 54 55 HttpServletResponse response) throws ServletException, IOException { 55 handleRequest( RestResource.POST, request, response);56 handleRequest(Operation.POST, request, response); 56 57 } 57 58 … … 59 60 protected void doPut(HttpServletRequest request, 60 61 HttpServletResponse response) throws ServletException, IOException { 61 handleRequest( RestResource.PUT, request, response);62 handleRequest(Operation.PUT, request, response); 62 63 } 63 64 … … 65 66 protected void doDelete(HttpServletRequest request, 66 67 HttpServletResponse response) throws ServletException, IOException { 67 handleRequest( RestResource.DELETE, request, response);68 handleRequest(Operation.DELETE, request, response); 68 69 } 69 70 … … 82 83 * @throws IOException 83 84 */ 84 private void handleRequest( intoperation, HttpServletRequest request,85 private void handleRequest(Operation operation, HttpServletRequest request, 85 86 HttpServletResponse response) throws ServletException, IOException { 86 87 … … 93 94 response.setHeader("WWW-Authenticate", 94 95 "BASIC realm=\"OpenMRS Rest API\""); 95 response.sendError( response.SC_UNAUTHORIZED);96 response.sendError(HttpServletResponse.SC_UNAUTHORIZED); 96 97 return; 97 98 } … … 117 118 restRequest, request, response); 118 119 } catch (APIAuthenticationException e) { 119 response.sendError( response.SC_FORBIDDEN);120 response.sendError(HttpServletResponse.SC_FORBIDDEN); 120 121 } 121 122 return; … … 124 125 125 126 // If no matching resources were found, return an error 126 response.sendError( response.SC_BAD_REQUEST);127 response.sendError(HttpServletResponse.SC_BAD_REQUEST); 127 128 128 129 }