← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15980: User controller, using http request from spring mvc instead of struts

 

------------------------------------------------------------
revno: 15980
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2014-07-06 18:22:17 +0200
message:
  User controller, using http request from spring mvc instead of struts
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java	2014-06-17 11:49:57 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java	2014-07-06 16:22:17 +0000
@@ -30,7 +30,6 @@
 
 import com.google.common.base.Optional;
 import com.google.common.collect.Lists;
-import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.common.Pager;
 import org.hisp.dhis.dxf2.metadata.ImportTypeSummary;
 import org.hisp.dhis.hibernate.exception.CreateAccessDeniedException;
@@ -176,7 +175,7 @@
     {
         User user = renderService.fromXml( request.getInputStream(), getEntityClass() );
 
-        inviteUser( user, response );
+        inviteUser( user, request, response );
     }
 
     @RequestMapping( value = INVITE_PATH, method = RequestMethod.POST, consumes = "application/json" )
@@ -184,7 +183,7 @@
     {
         User user = renderService.fromJson( request.getInputStream(), getEntityClass() );
 
-        inviteUser( user, response );
+        inviteUser( user, request, response );
     }
 
     //--------------------------------------------------------------------------
@@ -266,7 +265,7 @@
      * @param response response for created user invitation
      * @throws Exception
      */
-    private void inviteUser( User user, HttpServletResponse response ) throws Exception
+    private void inviteUser( User user, HttpServletRequest request, HttpServletResponse response ) throws Exception
     {
         RestoreOptions restoreOptions = user.getUsername() == null || user.getUsername().isEmpty() ?
             RestoreOptions.INVITE_WITH_USERNAME_CHOICE : RestoreOptions.INVITE_WITH_DEFINED_USERNAME;
@@ -276,7 +275,7 @@
         createUser( user, response );
 
         securityService.sendRestoreMessage( user.getUserCredentials(),
-            ContextUtils.getContextPath( ServletActionContext.getRequest() ), restoreOptions );
+            ContextUtils.getContextPath( request ), restoreOptions );
     }
 
     /**