Spring Framework ParameterizableViewController - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ParameterizableViewController class.

This code example shows how to use the following methods:getStatusCode, getViewName, isStatusOnly
 
	@Test 
	public void addViewController() { 
		this.registry.addViewController("/path").setViewName("viewName"); 
		ParameterizableViewController controller = getController("/path"); 
		assertEquals("viewName", controller.getViewName()); 
		assertNull(controller.getStatusCode()); 
		assertFalse(controller.isStatusOnly()); 
	} 
 
	@Test 
	public void addViewControllerWithDefaultViewName() { 
		this.registry.addViewController("/path"); 
		ParameterizableViewController controller = getController("/path"); 
		assertNull(controller.getViewName()); 
		assertNull(controller.getStatusCode()); 
		assertFalse(controller.isStatusOnly()); 
	} 
 
	@Test 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setView
 
	private final String urlPath;
 
	private final RedirectView redirectView;
 
	private final ParameterizableViewController controller = new ParameterizableViewController();
 
 
	public RedirectViewControllerRegistration(String urlPath, String redirectUrl) {
		Assert.notNull(urlPath, "'urlPath' is required.");
		Assert.notNull(redirectUrl, "'redirectUrl' is required.");
		this.urlPath = urlPath;
		this.redirectView = new RedirectView(redirectUrl);
		this.redirectView.setContextRelative(true);
		this.controller.setView(this.redirectView);
	} 
 
 
	/** 
	 * Set the specific redirect 3xx status code to use. 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 */ 
public class ViewControllerRegistration {
 
	private final String urlPath;
 
	private final ParameterizableViewController controller = new ParameterizableViewController();
 
 
	public ViewControllerRegistration(String urlPath) {
		Assert.notNull(urlPath, "'urlPath' is required.");
		this.urlPath = urlPath;
	} 
 
 
	/** 
	 * Set the status code to set on the response. Optional. 
	 * 
	 * <p>If not set the response status will be 200 (OK). 
	 */ 
	public ViewControllerRegistration setStatusCode(HttpStatus statusCode) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	private MockHttpServletResponse response; 
 
 
	@Before 
	public void setUp() throws Exception { 
		this.controller = new ParameterizableViewController(); 
		this.request = new MockHttpServletRequest("GET", "/"); 
		this.response = new MockHttpServletResponse(); 
	} 
 
 
	@Test 
	public void defaultViewName() throws Exception { 
		ModelAndView modelAndView = this.controller.handleRequest(this.request, this.response); 
		assertNull(modelAndView.getViewName()); 
	} 
 
	@Test 
	public void viewName() throws Exception { 
		this.controller.setViewName("view"); 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:handleRequestInternal, toInt, trimToNull
     
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { 
 
    	Map<String, Object> map = new HashMap<String, Object>(); 
 
    	String genre = trimToNull(request.getParameter("genre")); 
    	String group = trimToNull(request.getParameter("group")); 
    	int page = toInt(request.getParameter("page"), 0); 
 
        if (!libraryBrowserService.hasArtists()) { 
            return new ModelAndView("musicCabinetUnavailable"); 
        } 
         
        if (genre == null && group == null) { 
    		map.put("topTagsOccurrences", tagService.getTopTagsOccurrence()); 
    		map.put("lastFmGroups", lastFmService.getLastFmGroups()); 
        } else { 
        	setArtists(request, genre, group, page, map); 
        	if (genre != null) { 
        		String genreDescription = tagInfoService.getTagInfo(genre); 

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
/** 
 * Controller for the lyrics popup. 
 * 
 * @author Sindre Mehus 
 */ 
public class LyricsController extends ParameterizableViewController { 
 
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { 
        Map<String, Object> map = new HashMap<String, Object>(); 
 
        map.put("artist", request.getParameter("artist")); 
        map.put("song", request.getParameter("song")); 
 
        ModelAndView result = super.handleRequestInternal(request, response); 
        result.addObject("model", map); 
        return result; 
    } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
/** 
 * Controller for the right frame. 
 * 
 * @author Sindre Mehus 
 */ 
public class RightController extends ParameterizableViewController { 
 
    private SettingsService settingsService; 
    private SecurityService securityService; 
 
    @Override 
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { 
        Map<String, Object> map = new HashMap<String, Object>(); 
        ModelAndView result = super.handleRequestInternal(request, response); 
 
        UserSettings userSettings = settingsService.getUserSettings(securityService.getCurrentUsername(request)); 
        map.put("showNowPlaying", userSettings.isShowNowPlayingEnabled()); 
        map.put("showChat", userSettings.isShowChatEnabled()); 
        map.put("user", securityService.getCurrentUser(request)); 
 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
/** 
 * Controller for the DB admin page. 
 * 
 * @author Sindre Mehus 
 */ 
public class DBController extends ParameterizableViewController { 
 
    private DaoHelper daoHelper; 
 
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { 
        Map<String, Object> map = new HashMap<String, Object>(); 
 
        String query = request.getParameter("query"); 
        if (query != null) { 
            map.put("query", query); 
 
            try { 
                List<?> result = daoHelper.getJdbcTemplate().query(query, new ColumnMapRowMapper()); 
                map.put("result", result); 
            } catch (DataAccessException x) { 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
/** 
 * Controller for changing cover art. 
 * 
 * @author Sindre Mehus 
 */ 
public class ChangeCoverArtController extends ParameterizableViewController { 
 
    private MediaFileService mediaFileService; 
 
    @Override 
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { 
 
        String path = request.getParameter("path"); 
        String artist = request.getParameter("artist"); 
        String album = request.getParameter("album"); 
        MediaFile dir = mediaFileService.getMediaFile(path); 
 
        if (artist == null) { 
            artist = dir.getArtist(); 
        } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:defaultString, handleRequestInternal
 
    @Override 
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { 
 
        Map<String, Object> map = new HashMap<String, Object>(); 
        ModelAndView result = super.handleRequestInternal(request, response); 
 
        map.put("searchQuery", defaultString(request.getParameter("searchQuery"))); 
        map.put("fileTypes", nameSearchService.getFileTypes()); 
        map.put("trackGenres", tagService.getFileTags()); 
        map.put("topTags", tagService.getTopTags()); 
        map.put("mediaFolders", mediaFolderService.getIndexedMediaFolders()); 
 
        result.addObject("model", map); 
        return result; 
    } 
     
    // Spring setter(s) 
 
	public void setNameSearchService(NameSearchService nameSearchService) { 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Spring Framework ParameterizableViewController Methods: