<commit_before>package org.slc.sli.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import org.slc.sli.entity.util.StudentProgramUtil;
import org.slc.sli.manager.PortalWSManager;
import org.slc.sli.util.Constants;
import org.slc.sli.util.SecurityUtil;


/**
 * Layout controller for all types of requests. 
 * NOTE: This controller was introduced after the student list and app selector controllers. 
 * 
 * @author dwu
 */
@Controller
@RequestMapping(value = "/service/layout/")
public class LayoutController extends GenericLayoutController {
    private static final String TABBED_ONE_COL = "tabbed_one_col";

    
    @Autowired
    PortalWSManager portalWSManager;

    public void setPortalWSManager(PortalWSManager portalWSManager) {
        this.portalWSManager = portalWSManager;
    }

    
    /**
     * Controller for student profile
     * 
     * @param panelIds
     * @return
     */
    @RequestMapping(value = "/student", method = RequestMethod.GET)
    public ModelAndView handleStudentProfile(@RequestParam String id, HttpServletRequest request) {
        ModelMap model = getPopulatedModel("studentProfile", id, request);
        // TODO: get rid of StudentProgramUtil - instead enrich student entity with relevant programs 
        model.addAttribute("programUtil", new StudentProgramUtil());
        model.addAttribute(Constants.ATTR_HEADER_STRING, portalWSManager.getHeader(SecurityUtil.getToken()));

        //Currently portal returns overlapping div names
        //TODO: Remove hack to override div_main
        model.addAttribute(Constants.ATTR_FOOTER_STRING, portalWSManager.getFooter(SecurityUtil.getToken()).replaceFirst("div_main", "div_footer"));
        return getModelView(TABBED_ONE_COL, model);
    }
    
    /**
     * Generic layout handler
     * @param id
     * @param request
     * @return
     */
    @RequestMapping(value = "{componentId}", method = RequestMethod.GET)
    public ModelAndView handleListOfStudents(@PathVariable String componentId, @RequestParam(required = false) String id, HttpServletRequest request) {
        return getModelView(TABBED_ONE_COL, getPopulatedModel(componentId, id, request));
    }
}<commit_msg>US1306 fix exception error<commit_after>package org.slc.sli.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import org.slc.sli.entity.util.StudentProgramUtil;
import org.slc.sli.manager.PortalWSManager;
import org.slc.sli.util.Constants;
import org.slc.sli.util.SecurityUtil;

/**
 * Layout controller for all types of requests.
 * NOTE: This controller was introduced after the student list and app selector controllers.
 * 
 * @author dwu
 */
@Controller
@RequestMapping(value = "/service/layout/")
public class LayoutController extends GenericLayoutController {
    private static final String TABBED_ONE_COL = "tabbed_one_col";
    
    @Autowired
    PortalWSManager portalWSManager;
    
    public void setPortalWSManager(PortalWSManager portalWSManager) {
        this.portalWSManager = portalWSManager;
    }
    
    /**
     * Controller for student profile
     * 
     * @param panelIds
     * @return
     */
    @RequestMapping(value = "/student", method = RequestMethod.GET)
    public ModelAndView handleStudentProfile(@RequestParam String id, HttpServletRequest request) {
        ModelMap model = getPopulatedModel("studentProfile", id, request);
        // TODO: get rid of StudentProgramUtil - instead enrich student entity with relevant
        // programs
        model.addAttribute("programUtil", new StudentProgramUtil());
        model.addAttribute(Constants.ATTR_HEADER_STRING, portalWSManager.getHeader(SecurityUtil.getToken()));
        
        // Currently portal returns overlapping div names
        // TODO: Remove hack to override div_main
        model.addAttribute(Constants.ATTR_FOOTER_STRING, portalWSManager.getFooter(SecurityUtil.getToken())
                .replaceFirst("div_main", "div_footer"));
        return getModelView(TABBED_ONE_COL, model);
    }
    
    /**
     * Generic layout handler
     * 
     * @param id
     * @param request
     * @return
     */
    @RequestMapping(value = "{componentId}", method = RequestMethod.GET)
    public ModelAndView handleListOfStudents(@PathVariable String componentId,
            @RequestParam(required = false) String id, HttpServletRequest request) {
        ModelMap model = getPopulatedModel(componentId, id, request);
        model.addAttribute(Constants.ATTR_HEADER_STRING, portalWSManager.getHeader(SecurityUtil.getToken()));
        model.addAttribute(Constants.ATTR_FOOTER_STRING, portalWSManager.getFooter(SecurityUtil.getToken())
                .replaceFirst("div_main", "div_footer"));
        return getModelView(TABBED_ONE_COL, model);
    }
}
{'fraction_non_alphanumeric': 0.09270704573547589, 'fraction_numerical': 0.0007063393960798164, 'mean_word_length': 4.057142857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6542840', 'n_tokens_mistral': 1524, 'n_tokens_neox': 1500, 'n_words': 331}