当前位置: 首页>>代码示例>>Java>>正文


Java ServletRequestUtils.getRequiredIntParameter方法代码示例

本文整理汇总了Java中org.springframework.web.bind.ServletRequestUtils.getRequiredIntParameter方法的典型用法代码示例。如果您正苦于以下问题:Java ServletRequestUtils.getRequiredIntParameter方法的具体用法?Java ServletRequestUtils.getRequiredIntParameter怎么用?Java ServletRequestUtils.getRequiredIntParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.web.bind.ServletRequestUtils的用法示例。


在下文中一共展示了ServletRequestUtils.getRequiredIntParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAlbumInfo

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@RequestMapping(path = "/getAlbumInfo")
public void getAlbumInfo(HttpServletRequest request, HttpServletResponse response) throws Exception {
    request = wrapRequest(request);

    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");

    MediaFile mediaFile = this.mediaFileService.getMediaFile(id);
    if (mediaFile == null) {
        error(request, response, SubsonicRESTController.ErrorCode.NOT_FOUND, "Media file not found.");
        return;
    }
    AlbumNotes albumNotes = this.lastFmService.getAlbumNotes(mediaFile);

    AlbumInfo result = getAlbumInfoInternal(albumNotes);
    Response res = createResponse();
    res.setAlbumInfo(result);
    this.jaxbWriter.writeResponse(request, response, res);
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:19,代码来源:SubsonicRESTController.java

示例2: getAlbumInfo2

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@RequestMapping(path = "/getAlbumInfo2")
public void getAlbumInfo2(HttpServletRequest request, HttpServletResponse response) throws Exception {
    request = wrapRequest(request);

    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");

    Album album = this.albumDao.getAlbum(id);
    if (album == null) {
        error(request, response, SubsonicRESTController.ErrorCode.NOT_FOUND, "Album not found.");
        return;
    }
    AlbumNotes albumNotes = this.lastFmService.getAlbumNotes(album);

    AlbumInfo result = getAlbumInfoInternal(albumNotes);
    Response res = createResponse();
    res.setAlbumInfo(result);
    this.jaxbWriter.writeResponse(request, response, res);
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:19,代码来源:SubsonicRESTController.java

示例3: handleRequestInternal

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Map<String, Object> map = new HashMap<>();

    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
    User user = securityService.getCurrentUser(request);
    String username = user.getUsername();
    UserSettings userSettings = settingsService.getUserSettings(username);
    Player player = playerService.getPlayer(request, response);
    Playlist playlist = playlistService.getPlaylist(id);
    if (playlist == null) {
        return new ModelAndView(new RedirectView("notFound"));
    }

    map.put("playlist", playlist);
    map.put("user", user);
    map.put("player", player);
    map.put("editAllowed", username.equals(playlist.getUsername()) || securityService.isAdmin(username));
    map.put("partyMode", userSettings.isPartyModeEnabled());

    return new ModelAndView("playlist","model",map);
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:23,代码来源:PlaylistController.java

示例4: exportPlaylist

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@RequestMapping(method = { RequestMethod.GET })
public ModelAndView exportPlaylist(HttpServletRequest request, HttpServletResponse response) throws Exception {

    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
    Playlist playlist = playlistService.getPlaylist(id);
    if (!playlistService.isReadAllowed(playlist, securityService.getCurrentUsername(request))) {
        response.sendError(HttpServletResponse.SC_FORBIDDEN);
        return null;

    }
    response.setContentType("application/x-download");
    response.setHeader("Content-Disposition", "attachment; filename=\"" + StringUtil.fileSystemSafe(playlist.getName()) + ".m3u8\"");

    playlistService.exportPlaylist(id, response.getOutputStream());
    return null;
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:17,代码来源:ExportPlayListController.java

示例5: handleRequestInternal

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {

    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
    String artist = request.getParameter("artist");
    String album = request.getParameter("album");
    MediaFile dir = mediaFileService.getMediaFile(id);

    if (StringUtils.isBlank(artist)) {
        artist = dir.getArtist();
    }
    if (StringUtils.isBlank(album)) {
        album = dir.getAlbumName();
    }

    Map<String, Object> map = new HashMap<>();
    map.put("id", id);
    map.put("artist", artist);
    map.put("album", album);


    return new ModelAndView("changeCoverArt","model",map);
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:24,代码来源:ChangeCoverArtController.java

示例6: handleRequestInternal

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {

    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
    MediaFile dir = mediaFileService.getMediaFile(id);
    List<MediaFile> files = mediaFileService.getChildrenOf(dir, true, false, true, false);

    Map<String, Object> map = new HashMap<String, Object>();
    if (!files.isEmpty()) {
        map.put("defaultArtist", files.get(0).getArtist());
        map.put("defaultAlbum", files.get(0).getAlbumName());
        map.put("defaultYear", files.get(0).getYear());
        map.put("defaultGenre", files.get(0).getGenre());
    }
    map.put("allGenres", JaudiotaggerParser.getID3V1Genres());

    List<Song> songs = new ArrayList<Song>();
    for (int i = 0; i < files.size(); i++) {
        songs.add(createSong(files.get(i), i));
    }
    map.put("id", id);
    map.put("songs", songs);

    return new ModelAndView("editTags","model",map);
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:26,代码来源:EditTagsController.java

示例7: handleRequestInternal

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {

    User user = securityService.getCurrentUser(request);
    Map<String, Object> map = new HashMap<String, Object>();
    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
    MediaFile file = mediaFileService.getMediaFile(id);
    mediaFileService.populateStarredDate(file, user.getUsername());

    Integer duration = file.getDurationSeconds();
    String playerId = playerService.getPlayer(request, response).getId();
    String url = NetworkService.getBaseUrl(request);
    String streamUrl = url + "stream?id=" + file.getId() + "&player=" + playerId + "&format=mp4";
    String coverArtUrl = url + "coverArt.view?id=" + file.getId();

    map.put("video", file);
    map.put("streamUrl", streamUrl);
    map.put("remoteStreamUrl", streamUrl);
    map.put("remoteCoverArtUrl", coverArtUrl);
    map.put("duration", duration);
    map.put("bitRates", BIT_RATES);
    map.put("defaultBitRate", DEFAULT_BIT_RATE);
    map.put("user", user);

    return new ModelAndView("videoPlayer", "model", map);
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:27,代码来源:VideoPlayerController.java

示例8: handleRequestInternal

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Map<String, Object> map = new HashMap<String, Object>();

    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
    User user = securityService.getCurrentUser(request);
    String username = user.getUsername();
    UserSettings userSettings = settingsService.getUserSettings(username);
    Player player = playerService.getPlayer(request, response);
    Playlist playlist = playlistService.getPlaylist(id);
    if (playlist == null) {
        return new ModelAndView(new RedirectView("notFound.view"));
    }

    map.put("playlist", playlist);
    map.put("user", user);
    map.put("player", player);
    map.put("editAllowed", username.equals(playlist.getUsername()) || securityService.isAdmin(username));
    map.put("partyMode", userSettings.isPartyModeEnabled());

    ModelAndView result = super.handleRequestInternal(request, response);
    result.addObject("model", map);
    return result;
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:25,代码来源:PlaylistController.java

示例9: handleRequestInternal

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {

    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
    String artist = request.getParameter("artist");
    String album = request.getParameter("album");
    MediaFile dir = mediaFileService.getMediaFile(id);

    if (artist == null) {
        artist = dir.getArtist();
    }
    if (album == null) {
        album = dir.getAlbumName();
    }

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("id", id);
    map.put("artist", artist);
    map.put("album", album);

    ModelAndView result = super.handleRequestInternal(request, response);
    result.addObject("model", map);

    return result;
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:26,代码来源:ChangeCoverArtController.java

示例10: handleRequestInternal

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {

        int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
        MediaFile dir = mediaFileService.getMediaFile(id);
        List<MediaFile> files = mediaFileService.getChildrenOf(dir, true, false, true, false);

        Map<String, Object> map = new HashMap<String, Object>();
        if (!files.isEmpty()) {
            map.put("defaultArtist", files.get(0).getArtist());
            map.put("defaultAlbum", files.get(0).getAlbumName());
            map.put("defaultYear", files.get(0).getYear());
            map.put("defaultGenre", files.get(0).getGenre());
        }
        map.put("allGenres", JaudiotaggerParser.getID3V1Genres());

        List<Song> songs = new ArrayList<Song>();
        for (int i = 0; i < files.size(); i++) {
            songs.add(createSong(files.get(i), i));
        }
        map.put("id", id);
        map.put("songs", songs);

        ModelAndView result = super.handleRequestInternal(request, response);
        result.addObject("model", map);
        return result;
    }
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:27,代码来源:EditTagsController.java

示例11: loadPlaylistConfirm

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
public ModelAndView loadPlaylistConfirm(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Player player = playerService.getPlayer(request, response);
    PlayQueue playQueue = player.getPlayQueue();

    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
    
    playQueue.addFiles(false, playlistService.getFilesInPlaylist(id));

    for (MediaFile mediaFile : playlistService.getFilesInPlaylist(id)) {
    	if (mediaFile.getPath() != null) {
    		return reload(mediaFile.getPath());
    	}
    }

    return reload(null);
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:17,代码来源:LoadPlaylistController.java

示例12: appendPlaylistConfirm

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
public ModelAndView appendPlaylistConfirm(HttpServletRequest request, HttpServletResponse response) throws Exception {

        // Load the existing playlist.
        int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
        List<MediaFile> songs = playlistService.getFilesInPlaylist(id);

        // Update the existing playlist with new entries.
        for (MediaFile song : getFilesToAppend(request, response)) {
            songs.add(song);
        }

        // Save it.
        playlistService.setFilesInPlaylist(id, songs);

        String dir = StringUtils.trimToNull(request.getParameter("dir"));
        return reload(dir);
    }
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:18,代码来源:LoadPlaylistController.java

示例13: handleRequestInternal

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Map<String, Object> map = new HashMap<String, Object>();

    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
    User user = securityService.getCurrentUser(request);
    String username = user.getUsername();
    UserSettings userSettings = settingsService.getUserSettings(username);
    
    Playlist playlist = playlistService.getPlaylist(id);
    if (playlist == null) {
        return new ModelAndView(new RedirectView("notFound.view"));
    }
    
    map.put("playlist", playlist);
    map.put("user", user);
    map.put("editAllowed", username.equals(playlist.getUsername()) || securityService.isAdmin(username));
    map.put("partyMode", userSettings.isPartyModeEnabled());

    ModelAndView result = super.handleRequestInternal(request, response);
    result.addObject("model", map);
    return result;
}
 
开发者ID:MadMarty,项目名称:madsonic-server-5.0,代码行数:24,代码来源:PlaylistController.java

示例14: getMusicFolders

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
private List<MusicFolder> getMusicFolders(HttpServletRequest request) throws ServletRequestBindingException {
    String username = securityService.getCurrentUsername(request);
    Integer selectedMusicFolderId = ServletRequestUtils.getRequiredIntParameter(request, "musicFolderId");
    if (selectedMusicFolderId == -1) {
        selectedMusicFolderId = null;
    }
    return settingsService.getMusicFoldersForUser(username, selectedMusicFolderId);
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:9,代码来源:RandomPlayQueueController.java

示例15: handleRequestInternal

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@RequestMapping(method = RequestMethod.POST)
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
    int id = ServletRequestUtils.getRequiredIntParameter(request, "id");
    String action = request.getParameter("action");

    MediaFile mediaFile = mediaFileService.getMediaFile(id);

    if ("comment".equals(action)) {
        mediaFile.setComment(StringUtil.toHtml(request.getParameter("comment")));
        mediaFileService.updateMediaFile(mediaFile);
    }

    String url = "main.view?id=" + id;
    return new ModelAndView(new RedirectView(url));
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:16,代码来源:SetMusicFileInfoController.java


注:本文中的org.springframework.web.bind.ServletRequestUtils.getRequiredIntParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。