import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
-import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
public class AutoPushController extends RestrictedBaseController {
private static final Logger logger = FlexLogger.getLogger(AutoPushController.class);
- private static final String UTF8 = "UTF-8";
@Autowired
CommonClassDao commonClassDao;
public ModelAndView pushPolicyToPDPGroup(HttpServletRequest request, HttpServletResponse response)
throws IOException {
try {
+ response.setCharacterEncoding(PolicyUtils.CHARACTER_ENCODING);
+ request.setCharacterEncoding(PolicyUtils.CHARACTER_ENCODING);
+ //
+ //
+ //
ArrayList<Object> selectedPdps = new ArrayList<>();
ArrayList<String> selectedPoliciesInUI = new ArrayList<>();
PolicyController controller = getPolicyControllerInstance();
currentPoliciesInGroup.addAll(selectedPolicies);
updatedGroupObject.setPolicies(currentPoliciesInGroup);
this.container.updateGroup(updatedGroupObject, userId);
-
- response.setCharacterEncoding(UTF8);
- response.setContentType("application / json");
- request.setCharacterEncoding(UTF8);
-
- PrintWriter out = response.getWriter();
+ response.setContentType(PolicyUtils.APPLICATION_JSON);
refreshGroups();
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(groups));
- out.write(new JSONObject(msg).toString());
- //
- // Why is this here? This defeats the purpose of the loop??
- // Sonar says to remove it or make it conditional
- //
- return null;
+ response.getWriter().write(new JSONObject(
+ new JsonMessage(mapper.writeValueAsString(groups))).toString());
}
} catch (Exception e) {
- response.setCharacterEncoding(UTF8);
- request.setCharacterEncoding(UTF8);
logger.error(e);
response.getWriter().write(PolicyUtils.CATCH_EXCEPTION);
}
@RequestMapping(value = {"/auto_Push/remove_GroupPolicies.htm"}, method = {RequestMethod.POST})
public ModelAndView removePDPGroup(HttpServletRequest request, HttpServletResponse response) throws IOException {
try {
+ response.setCharacterEncoding(PolicyUtils.CHARACTER_ENCODING);
+ request.setCharacterEncoding(PolicyUtils.CHARACTER_ENCODING);
+ //
+ //
+ //
PolicyController controller = getPolicyControllerInstance();
this.container = new PDPGroupContainer(controller.getPapEngine());
ObjectMapper mapper = new ObjectMapper();
this.container.updateGroup(updatedGroupObject);
}
- response.setCharacterEncoding(UTF8);
- response.setContentType("application / json");
- request.setCharacterEncoding(UTF8);
+ response.setContentType(PolicyUtils.APPLICATION_JSON);
- PrintWriter out = response.getWriter();
refreshGroups();
- out.write(new JSONObject(new JsonMessage(mapper.writeValueAsString(groups))).toString());
- return null;
+ response.getWriter().write(new JSONObject(new JsonMessage(mapper.writeValueAsString(groups))).toString());
} catch (Exception e) {
- response.setCharacterEncoding(UTF8);
- request.setCharacterEncoding(UTF8);
logger.error(e);
response.getWriter().write(PolicyUtils.CATCH_EXCEPTION);
}