本文整理汇总了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());
}
示例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);
}
示例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);
}
示例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));
}
示例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());
}
示例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);
}
示例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());
}
示例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());
}
示例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));
}
示例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;
}
示例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));
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}