Permalink
Browse files

DB commit and rollbacks in ModifyUser

  • Loading branch information...
1 parent e54816c commit 429a5d5c9381bd11d5b05a368ca462803467088e andrew committed Jul 24, 2012
View
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-7-oracle">
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
@@ -13,5 +13,13 @@
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="lib" path="C:/Users/ajtempadmin/FIDUGM/UGM_Client/WebContent/WEB-INF/lib/commons-codec-1.6.jar"/>
+ <classpathentry kind="lib" path="C:/Users/ajtempadmin/FIDUGM/UGM_Client/WebContent/WEB-INF/lib/commons-logging-1.1.1.jar"/>
+ <classpathentry kind="lib" path="C:/Users/ajtempadmin/FIDUGM/UGM_Client/WebContent/WEB-INF/lib/fluent-hc-4.2.1.jar"/>
+ <classpathentry kind="lib" path="C:/Users/ajtempadmin/FIDUGM/UGM_Client/WebContent/WEB-INF/lib/gson-2.2.2.jar"/>
+ <classpathentry kind="lib" path="C:/Users/ajtempadmin/FIDUGM/UGM_Client/WebContent/WEB-INF/lib/httpclient-4.2.1.jar"/>
+ <classpathentry kind="lib" path="C:/Users/ajtempadmin/FIDUGM/UGM_Client/WebContent/WEB-INF/lib/httpclient-cache-4.2.1.jar"/>
+ <classpathentry kind="lib" path="C:/Users/ajtempadmin/FIDUGM/UGM_Client/WebContent/WEB-INF/lib/httpcore-4.2.1.jar"/>
+ <classpathentry kind="lib" path="C:/Users/ajtempadmin/FIDUGM/UGM_Client/WebContent/WEB-INF/lib/httpmime-4.2.1.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
@@ -1,3 +1,3 @@
-Manifest-Version: 1.0
-Class-Path:
-
+Manifest-Version: 1.0
+Class-Path:
+
@@ -18,8 +18,8 @@
}
%>
- <%@ include file="jsp/userDetailsForm.jsp"%>
-
+ <%@ include file="jsp/userDetailsForm.jsp"%>
+
<script type="text/javascript">
$(document).ready(function() {
$('#email').attr("disabled","disabled");
@@ -31,10 +31,10 @@
var password = $('#password').val();
var privilege = $('#Privilege').val();
var groups = $('#Groups').val();
-
+
$.post("ModifyUser", {firstname:fname,lastname:lname,password:password,email:email,group:groups,privilege:privilege},
function(data) {
- alert(data.messagePayload.message);
+ alert(data.messagePayload.message);
});
});
</script>
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -62,6 +62,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
//Get the final json string.
String jsonStringUserLogin = new Gson().toJson(json_message);
+ System.out.println(jsonStringUserLogin);
//Call the FID Service to authenticate the credentials.
DefaultHttpClient client = new DefaultHttpClient();
@@ -6,6 +6,7 @@
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
import server.connection.ServerConnectionHandler;
@@ -59,7 +60,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
//Create a JSON message.
json_message = new JSONMessage();
- json_message.setMessageType("updateUserMessage");
+ json_message.setMessageType("updateUserRequest");
jclass = new JSONClass();
FHuserClass user = new FHuserClass();
user.setFirst_name(first_name);
@@ -75,16 +76,15 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)
//JSON String to be sent.
String jsonStringUser = new Gson().toJson(json_message);
-
- System.out.println(jsonStringUser);
-
+
//Get the Response JSON from FID server.
- String InsertUserResponse = new ServerConnectionHandler().getServerResponse(ResourceName, jsonStringUser);
-
+ String UpdateUserResponse = new ServerConnectionHandler().getServerResponse(ResourceName, jsonStringUser);
+
// Write response data as JSON back to the JQuery.
response.setContentType("application/json");
response.setCharacterEncoding("UTF-8");
- response.getWriter().write(InsertUserResponse);
+ response.getWriter().write(UpdateUserResponse);
+
}
}
@@ -1,57 +0,0 @@
-package client.application.servlets;
-
-import java.io.IOException;
-import java.lang.reflect.Type;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import com.google.gson.Gson;
-import com.google.gson.reflect.TypeToken;
-
-import fh.resources.json.JSONClass;
-import fh.resources.json.JSONMessage;
-
-/**
- * Servlet implementation class for Servlet: InsertUserFinal
- * @author rohit
- */
- public class ModifyUserFinal extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
- static final long serialVersionUID = 1L;
-
- /* (non-Java-doc)
- * @see javax.servlet.http.HttpServlet#HttpServlet()
- */
- public ModifyUserFinal() {
- super();
- }
-
- /* (non-Java-doc)
- * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
- */
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // TODO Auto-generated method stub
- this.doGet(request, response);
- }
-
- /* (non-Java-doc)
- * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
- */
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // TODO Auto-generated method stub
- String modGroupResponse = (String)request.getAttribute("fidModUserResponse");
- Type type = new TypeToken<JSONMessage>() {
- }.getType();
- JSONMessage result = new Gson().fromJson(modGroupResponse, type);
- JSONClass jO = result.getMessagePayload();
-
- if(jO.isSuccess()) {
- getServletContext().getRequestDispatcher("/DisplayUsers?action=display").forward(request, response);
- }
- else {
- request.getRequestDispatcher("Error.jsp").forward(request,
- response);
- }
- }
-}
@@ -59,7 +59,7 @@ public String getServerResponse(String ResourceName, String RequestJSON) throws
//Create a HttpClient.
DefaultHttpClient client = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(ResourceUrl);
-
+ System.out.println("CLIENT: " + ResourceUrl);
//Add the POST parameters.
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("json_request_message", RequestJSON));

0 comments on commit 429a5d5

Please sign in to comment.