you wont get the User object, which is a javax.servlet.http class, at the clientside. But:
- You can call the Servlet after login in the browser to see the data returned. Make sure the Servlet can handle HTTP GET as well, eg:
Code:
@Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); }
- You can then build structures on the client that parse the data (which is just String data, not related to your User class). So make sure to write all needed data with the Servlet.
- My User.setData looks like:
Code:
public static void setData(String data) { JSONValue jv = JSONParser.parseStrict(data); JSONObject jo = jv.isObject(); userLoginName = jo.get(UserPropertiesEnum.LOGINNAME.getValue()).isString().stringValue(); userId = Long.parseLong(jo.get(UserPropertiesEnum.ID.getValue()).isNumber().toString()); userTenantId = Long.parseLong(jo.get(UserPropertiesEnum.TENANTID.getValue()).isNumber().toString()); userRolesAsString = jo.get(UserPropertiesEnum.ROLESASSTRING.getValue()).isString() != null ? jo .get(UserPropertiesEnum.ROLESASSTRING.getValue()).isString().stringValue() : ""; .....
Best regards
Blama
Leave a comment: