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


Java ServletRequestUtils.getBooleanParameter方法代码示例

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


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

示例1: getAvatar

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
private Avatar getAvatar(HttpServletRequest request) {
    String id = request.getParameter("id");
    boolean forceCustom = ServletRequestUtils.getBooleanParameter(request, "forceCustom", false);

    if (id != null) {
        return settingsService.getSystemAvatar(Integer.parseInt(id));
    }

    String username = request.getParameter("username");
    if (username == null) {
        return null;
    }

    UserSettings userSettings = settingsService.getUserSettings(username);
    if (userSettings.getAvatarScheme() == AvatarScheme.CUSTOM || forceCustom) {
        return settingsService.getCustomAvatar(username);
    }
    if(userSettings.getAvatarScheme() == AvatarScheme.NONE) {
        return null;
    }
    return settingsService.getSystemAvatar(userSettings.getSystemAvatarId());
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:23,代码来源:AvatarController.java

示例2: handleParameters

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
private void handleParameters(HttpServletRequest request) {
    boolean dlnaEnabled = ServletRequestUtils.getBooleanParameter(request, "dlnaEnabled", false);
    String dlnaServerName = StringUtils.trimToNull(request.getParameter("dlnaServerName"));
    String dlnaBaseLANURL = StringUtils.trimToNull(request.getParameter("dlnaBaseLANURL"));
    if (dlnaServerName == null) {
        dlnaServerName = "Airsonic";
    }

    upnpService.setMediaServerEnabled(false);
    settingsService.setDlnaEnabled(dlnaEnabled);
    settingsService.setDlnaServerName(dlnaServerName);
    settingsService.setDlnaBaseLANURL(dlnaBaseLANURL);
    settingsService.save();
    upnpService.setMediaServerEnabled(dlnaEnabled);
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:16,代码来源:DLNASettingsController.java

示例3: createVideoTranscodingSettings

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
private VideoTranscodingSettings createVideoTranscodingSettings(MediaFile file, HttpServletRequest request) throws ServletRequestBindingException {
    Integer existingWidth = file.getWidth();
    Integer existingHeight = file.getHeight();
    Integer maxBitRate = ServletRequestUtils.getIntParameter(request, "maxBitRate");
    int timeOffset = ServletRequestUtils.getIntParameter(request, "timeOffset", 0);
    int defaultDuration = file.getDurationSeconds() == null ? Integer.MAX_VALUE : file.getDurationSeconds() - timeOffset;
    int duration = ServletRequestUtils.getIntParameter(request, "duration", defaultDuration);
    boolean hls = ServletRequestUtils.getBooleanParameter(request, "hls", false);

    Dimension dim = getRequestedVideoSize(request.getParameter("size"));
    if (dim == null) {
        dim = getSuitableVideoSize(existingWidth, existingHeight, maxBitRate);
    }

    return new VideoTranscodingSettings(dim.width, dim.height, timeOffset, duration, hls);
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:17,代码来源:StreamController.java

示例4: handleParameters

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
private void handleParameters(HttpServletRequest request) {
    boolean sonosEnabled = ServletRequestUtils.getBooleanParameter(request, "sonosEnabled", false);
    String sonosServiceName = StringUtils.trimToNull(request.getParameter("sonosServiceName"));
    if (sonosServiceName == null) {
        sonosServiceName = "Airsonic";
    }

    settingsService.setSonosEnabled(sonosEnabled);
    settingsService.setSonosServiceName(sonosServiceName);
    settingsService.save();

    sonosService.setMusicServiceEnabled(false, NetworkService.getBaseUrl(request));
    sonosService.setMusicServiceEnabled(sonosEnabled, NetworkService.getBaseUrl(request));
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:15,代码来源:SonosSettingsController.java

示例5: getAvatar

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
private Avatar getAvatar(HttpServletRequest request) {
    String id = request.getParameter("id");
    boolean forceCustom = ServletRequestUtils.getBooleanParameter(request, "forceCustom", false);

    if (id != null) {
        return settingsService.getSystemAvatar(Integer.parseInt(id));
    }

    String username = request.getParameter("username");
    if (username == null) {
        return null;
    }

    UserSettings userSettings = settingsService.getUserSettings(username);
    if (userSettings.getAvatarScheme() == AvatarScheme.CUSTOM || forceCustom) {
        return settingsService.getCustomAvatar(username);
    }
    return settingsService.getSystemAvatar(userSettings.getSystemAvatarId());
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:20,代码来源:AvatarController.java

示例6: handleContext

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@Override
protected ModelAndView handleContext(String contextName, Context context,
    HttpServletRequest request, HttpServletResponse response) throws Exception {
  boolean compile = ServletRequestUtils.getBooleanParameter(request, "compile", false);

  HttpSession session = request.getSession(false);
  Summary summary = (Summary) session.getAttribute(SUMMARY_ATTRIBUTE);
  if (summary == null || !contextName.equals(summary.getName())) {
    summary = new Summary();
    summary.setName(contextName);
  }
  getContainerWrapper().getTomcatContainer().listContextJsps(context, summary, compile);

  request.getSession(false).setAttribute(SUMMARY_ATTRIBUTE, summary);

  if (compile) {
    return new ModelAndView(new RedirectView(
        request.getRequestURI() + "?webapp=" + (contextName.length() == 0 ? "/" : contextName)));
  }
  return new ModelAndView(getViewName(), "summary", summary);
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:22,代码来源:DisplayJspController.java

示例7: handleContext

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

  boolean privileged = SecurityUtils.hasAttributeValueRole(getServletContext(), request);
  boolean calcSize =
      ServletRequestUtils.getBooleanParameter(request, "size", false) && privileged;
  String sid = ServletRequestUtils.getStringParameter(request, "sid");

  ApplicationSession appSession = ApplicationUtils
      .getApplicationSession(context.getManager().findSession(sid), calcSize, true);

  if (appSession != null) {
    appSession.setAllowedToViewValues(privileged);
    return new ModelAndView(getViewName(), "session", appSession);
  }
  return new ModelAndView(getViewName());
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:19,代码来源:ListSessionAttributesController.java

示例8: handleContext

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

  boolean calcSize = ServletRequestUtils.getBooleanParameter(request, "size", false)
      && SecurityUtils.hasAttributeValueRole(getServletContext(), request);

  ResourceResolver resourceResolver = getContainerWrapper().getResourceResolver();
  Application app = ApplicationUtils.getApplication(context,
      isExtendedInfo() ? resourceResolver : null, calcSize, getContainerWrapper());

  if (isExtendedInfo() && getStatsCollection() != null) {
    String avgStatisticName = "app.avg_proc_time." + app.getName();
    app.setAvgTime(getStatsCollection().getLastValueForStat(avgStatisticName));
  }

  return new ModelAndView(getViewName()).addObject("app", app)
      .addObject("no_resources", !resourceResolver.supportsPrivateResources())
      .addObject("collectionPeriod", getCollectionPeriod());
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:21,代码来源:BaseGetApplicationController.java

示例9: handleRequestInternal

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

  boolean finalization = ServletRequestUtils.getBooleanParameter(request, "fin", false);

  String referer = request.getHeader("Referer");
  String redirectUrl;
  if (referer != null) {
    redirectUrl = referer.replaceAll(replacePattern, "");
  } else {
    redirectUrl = request.getContextPath() + getViewName();
  }
  if (finalization) {
    Runtime.getRuntime().runFinalization();
    logger.debug("Advised finalization");
  } else {
    Runtime.getRuntime().gc();
    logger.debug("Advised Garbage Collection");
  }
  logger.debug("Redirected to {}", redirectUrl);
  return new ModelAndView(new RedirectView(redirectUrl));
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:24,代码来源:AdviseGarbageCollectionController.java

示例10: 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>();

    User user = securityService.getCurrentUser(request);
    String username = securityService.getCurrentUsername(request);
    
    map.put("user", user);
    map.put("player", playerService.getPlayer(request, response));
    map.put("playlists", playlistService.getReadablePlaylistsForUser(username));
    
    boolean reload = ServletRequestUtils.getBooleanParameter(request, "reload", false);
    map.put("reload", reload );
    
    ModelAndView result = super.handleRequestInternal(request, response);
    result.addObject("model", map);
    return result;
}
 
开发者ID:FutureSonic,项目名称:FutureSonic-Server,代码行数:20,代码来源:PlaylistEditorController.java

示例11: handleRequestInternal

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

    String referer = request.getHeader("Referer");
    String redirectURL;
    if (referer != null) {
        redirectURL = referer.replaceAll(replacePattern, "");
    } else {
        redirectURL = request.getContextPath() + getViewName();
    }
    if (finalization) {
        Runtime.getRuntime().runFinalization();
        logger.debug("Advised finalization");
    } else {
        Runtime.getRuntime().gc();
        logger.debug("Advised Garbage Collection");
    }
    logger.debug("Redirected to "+redirectURL);
    return new ModelAndView(new RedirectView(redirectURL));
}
 
开发者ID:andresol,项目名称:psi-probe-plus,代码行数:21,代码来源:AdviseGCController.java

示例12: doStartTag

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
public int doStartTag() throws JspException {
    boolean getSize = ServletRequestUtils.getBooleanParameter(pageContext.getRequest(), param, false);
    StringBuffer query = new StringBuffer();
    query.append(param).append("=").append(!getSize);
    for (Enumeration en = pageContext.getRequest().getParameterNames(); en.hasMoreElements(); ){
        String name = (String) en.nextElement();
        if (!param.equals(name)) {
            query.append("&").append(name).append("=").append(ServletRequestUtils.getStringParameter(pageContext.getRequest(), name, ""));
        }
    }
    try {
        pageContext.getOut().print(query);
    } catch (IOException e) {
        logger.debug("Exception printing query string to JspWriter", e);
        throw new JspException(e);
    }
    return EVAL_BODY_INCLUDE;
}
 
开发者ID:andresol,项目名称:psi-probe-plus,代码行数:19,代码来源:ParamToggleTag.java

示例13: handleContext

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
protected ModelAndView handleContext(String contextName, Context context,
                                     HttpServletRequest request, HttpServletResponse response) throws Exception {
    boolean compile = ServletRequestUtils.getBooleanParameter(request, "compile", false);

    HttpSession session = request.getSession(true);
    Summary summary = (Summary) session.getAttribute(SUMMARY_ATTRIBUTE);
    if (summary == null || ! contextName.equals(summary.getName())) {
        summary = new Summary();
        summary.setName(contextName);
    }
    getContainerWrapper().getTomcatContainer().listContextJsps(context, summary, compile);

    session.setAttribute(SUMMARY_ATTRIBUTE, summary);

    if (compile) {
        return new ModelAndView(new RedirectView(request.getRequestURI()+"?webapp="+(contextName.length() == 0 ? "/" : contextName)));
    } else {
        return new ModelAndView(getViewName(), "summary", summary);
    }
}
 
开发者ID:andresol,项目名称:psi-probe-plus,代码行数:21,代码来源:DisplayJspController.java

示例14: getArtistInfo

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

    int id = getRequiredIntParameter(request, "id");
    int count = getIntParameter(request, "count", 20);
    boolean includeNotPresent = ServletRequestUtils.getBooleanParameter(request, "includeNotPresent", false);

    ArtistInfo result = new ArtistInfo();

    MediaFile mediaFile = mediaFileService.getMediaFile(id);
    if (mediaFile == null) {
        error(request, response, ErrorCode.NOT_FOUND, "Media file not found.");
        return;
    }
    List<org.airsonic.player.domain.MusicFolder> musicFolders = settingsService.getMusicFoldersForUser(username);
    List<MediaFile> similarArtists = lastFmService.getSimilarArtists(mediaFile, count, includeNotPresent, musicFolders);
    for (MediaFile similarArtist : similarArtists) {
        result.getSimilarArtist().add(createJaxbArtist(similarArtist, username));
    }
    ArtistBio artistBio = lastFmService.getArtistBio(mediaFile, getUserLocale(request));
    if (artistBio != null) {
        result.setBiography(artistBio.getBiography());
        result.setMusicBrainzId(artistBio.getMusicBrainzId());
        result.setLastFmUrl(artistBio.getLastFmUrl());
        result.setSmallImageUrl(artistBio.getSmallImageUrl());
        result.setMediumImageUrl(artistBio.getMediumImageUrl());
        result.setLargeImageUrl(artistBio.getLargeImageUrl());
    }

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

示例15: getArtistInfo2

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

    int id = getRequiredIntParameter(request, "id");
    int count = getIntParameter(request, "count", 20);
    boolean includeNotPresent = ServletRequestUtils.getBooleanParameter(request, "includeNotPresent", false);

    ArtistInfo2 result = new ArtistInfo2();

    org.airsonic.player.domain.Artist artist = artistDao.getArtist(id);
    if (artist == null) {
        error(request, response, ErrorCode.NOT_FOUND, "Artist not found.");
        return;
    }

    List<org.airsonic.player.domain.MusicFolder> musicFolders = settingsService.getMusicFoldersForUser(username);
    List<org.airsonic.player.domain.Artist> similarArtists = lastFmService.getSimilarArtists(artist, count, includeNotPresent, musicFolders);
    for (org.airsonic.player.domain.Artist similarArtist : similarArtists) {
        result.getSimilarArtist().add(createJaxbArtist(new ArtistID3(), similarArtist, username));
    }
    ArtistBio artistBio = lastFmService.getArtistBio(artist, getUserLocale(request));
    if (artistBio != null) {
        result.setBiography(artistBio.getBiography());
        result.setMusicBrainzId(artistBio.getMusicBrainzId());
        result.setLastFmUrl(artistBio.getLastFmUrl());
        result.setSmallImageUrl(artistBio.getSmallImageUrl());
        result.setMediumImageUrl(artistBio.getMediumImageUrl());
        result.setLargeImageUrl(artistBio.getLargeImageUrl());
    }

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


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