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


Java ServletRequestUtils.getStringParameter方法代码示例

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


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

示例1: setChart

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
/**
 * Sets the chart.
 *
 * @param request  the request
 * @param response the response
 * @throws Exception the exception
 */
@RequestMapping("/setChart")
public void setChart(HttpServletRequest request, HttpServletResponse response) throws Exception {

    String chartSetJson = ServletRequestUtils.getStringParameter(request, "chartSet");
    Chart[] reqs = gson.fromJson(chartSetJson, Chart[].class);

    long startTime = System.currentTimeMillis();
    StringBuilder stringBuilder = new StringBuilder();
    for (int i = 0; i < reqs.length; i++) {
        Chart chart = reqs[i];
        if (i > 0) {
            stringBuilder.append(",");
        }
        stringBuilder.append("\"ok\"");
        perfDao.setChart(chart);
    }
    stringBuilder.append("]");

    long endTime = System.currentTimeMillis();
    long duration = endTime - startTime;
    logger.debug(request.getRemoteAddr() + " took " + duration + " ms");

    response.getOutputStream().print(stringBuilder.toString());
    response.setStatus(200);
}
 
开发者ID:oneops,项目名称:oneops,代码行数:33,代码来源:PerfController.java

示例2: getPerfData

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
/**
 * Gets the perf data.
 *
 * @param request  the request, contains json array of {@link PerfDataRequest}
 * @param response the response, contains json array of tabled results.
 * @return the perf data
 * @throws Exception the exception
 */
@RequestMapping(value = "/getPerfData", method = {GET, POST})
public void getPerfData(HttpServletRequest request, HttpServletResponse response) throws Exception {

    String reqSet = ServletRequestUtils.getStringParameter(request, "reqSet");
    PerfDataRequest[] reqs = gson.fromJson(reqSet, PerfDataRequest[].class);

    long startTime = System.currentTimeMillis();
    StringBuilder bu = new StringBuilder("[ ");
    for (int i = 0; i < reqs.length; i++) {
        PerfDataRequest req = reqs[i];
        if (i > 0) {
            bu.append(",");
        }
        bu.append(perfDataAccessor.getPerfDataSeries(req));
    }
    bu.append("\n]");

    long endTime = System.currentTimeMillis();
    long duration = endTime - startTime;
    logger.debug(request.getRemoteAddr() + " took " + duration + " ms");

    response.getOutputStream().print(bu.toString());
    response.setStatus(200);
}
 
开发者ID:oneops,项目名称:oneops,代码行数:33,代码来源:PerfController.java

示例3: getChart

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
/**
 * Gets the chart data.
 *
 * @param request  the request
 * @param response the response
 * @return the chart
 * @throws Exception the exception
 */
@RequestMapping("/getChart")
public void getChart(HttpServletRequest request, HttpServletResponse response) throws Exception {

    String chartSetJson = ServletRequestUtils.getStringParameter(request, "chartSet");
    Chart[] reqs = gson.fromJson(chartSetJson, Chart[].class);

    long startTime = System.currentTimeMillis();
    StringBuilder der = new StringBuilder("[");
    for (int i = 0; i < reqs.length; i++) {
        Chart chart = reqs[i];
        if (i > 0) {
            der.append("[");
        }
        chart = perfDao.getChart(chart.getKey());
        der.append(gson.toJson(chart));
    }
    der.append("]");

    long endTime = System.currentTimeMillis();
    long duration = endTime - startTime;
    logger.debug(request.getRemoteAddr() + " took " + duration + " ms");

    response.getOutputStream().print(der.toString());
    response.setStatus(200);
}
 
开发者ID:oneops,项目名称:oneops,代码行数:34,代码来源:PerfController.java

示例4: render

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@Override
public boolean render(RenderHandler handler) throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, IOException {
	ServletRequest request = handler.getRequest();
	
	// request 获取参数
       String ord = ServletRequestUtils.getStringParameter(request, "ord", Consts.order.NEWEST);
       int pn = ServletRequestUtils.getIntParameter(request, "pn", 1);
       
       // 标签中获取参数
       int groupId = handler.getIntParameter(0);
       String alias = handler.getStringParameter(1);
       
       Paging paging = wrapPaing(pn);
	Paging result = postPlanet.paging(paging, groupId, ord);
	
	handler.put(alias, result);
	handler.doRender();
	
	postRender(handler.getContext());
	return true;
}
 
开发者ID:ThomasYangZi,项目名称:mblog,代码行数:22,代码来源:ContentsDirective.java

示例5: send

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
public void send(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String broadcast = ServletRequestUtils.getStringParameter(request,
				"broadcast", "Y");
		String username = ServletRequestUtils.getStringParameter(request,
				"username");
		String title = ServletRequestUtils.getStringParameter(request, "title");
		String message = ServletRequestUtils.getStringParameter(request,
				"message");
		String uri = ServletRequestUtils.getStringParameter(request, "uri");

		String apiKey = Config.getString("apiKey", "");
		logger.debug("apiKey=" + apiKey);

//		if (broadcast.equalsIgnoreCase("Y")) {
//			notificationManager.sendBroadcast(apiKey, title, message, uri);
//		} else {
//			notificationManager.sendNotifcationToUser(apiKey, username, title,
//					message, uri, true);
//		}
		
		response.getWriter().print("{\"result\":\"0\",\"description\":\"success\"}");
//		ModelAndView mav = new ModelAndView();
//		mav.setViewName("redirect:notification.do");
//		return mav;
	}
 
开发者ID:lijian17,项目名称:androidpn-server,代码行数:27,代码来源:NotificationApiController.java

示例6: getBaseUrl

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
public String getBaseUrl(HttpServletRequest request) {
    int port = settingsService.getPort();
    String contextPath = settingsService.getUrlRedirectContextPath();

    // Note that the server IP can be overridden by the "ip" parameter. Used when Subsonic and Sonos are
    // on different networks.
    String ip = settingsService.getLocalIpAddress();
    if (request != null) {
        ip = ServletRequestUtils.getStringParameter(request, "ip", ip);
    }

    // Note: Serving media and cover art with http (as opposed to https) works when using jetty and SubsonicDeployer.
    StringBuilder url = new StringBuilder("http://")
            .append(ip)
            .append(":")
            .append(port)
            .append("/");

    if (StringUtils.isNotEmpty(contextPath)) {
        url.append(contextPath).append("/");
    }
    return url.toString();
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:24,代码来源:SonosHelper.java

示例7: formBackingObject

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
/**
 * This is called prior to displaying a form for the first time. It tells Spring the
 * form/command object to load into the request
 *
 * @see org.springframework.web.servlet.mvc.AbstractFormController#formBackingObject(javax.servlet.http.HttpServletRequest)
 */
protected Object formBackingObject(HttpServletRequest request) throws ServletException {
	
	ConceptProposal cp = new ConceptProposal();
	
	if (Context.isAuthenticated()) {
		ConceptService cs = Context.getConceptService();
		EncounterService es = Context.getEncounterService();
		String id = ServletRequestUtils.getStringParameter(request, "encounterId");
		if (id != null) {
			cp.setEncounter(es.getEncounter(Integer.valueOf(id)));
		}
		
		id = ServletRequestUtils.getStringParameter(request, "obsConceptId");
		if (id != null) {
			cp.setObsConcept(cs.getConcept(Integer.valueOf(id)));
		}
		
	}
	
	return cp;
}
 
开发者ID:openmrs,项目名称:openmrs-module-legacyui,代码行数:28,代码来源:ProposeConceptFormController.java

示例8: populate

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@Override
public void populate(DefaultTableXYDataset dataset, StatsCollection statsCollection,
    HttpServletRequest request) {

  String seriesParam = ServletRequestUtils.getStringParameter(request, "sp", null);
  for (int i = 0; i < statNames.size(); i++) {
    String statName = statNames.get(i);
    if (seriesParam != null) {
      statName = MessageFormat.format(statName, seriesParam);
    }
    List<XYDataItem> stats = statsCollection.getStats(statName);
    if (stats != null) {
      String series =
          ServletRequestUtils.getStringParameter(request, "s" + (i + 1) + "l", "series" + i);
      dataset.addSeries(toSeries(series, stats));
    }
  }
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:19,代码来源:StandardSeriesProvider.java

示例9: populate

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
@Override
public void populate(DefaultTableXYDataset dataset, StatsCollection statsCollection,
    HttpServletRequest request) {

  // get Connector name from the request
  String connectorName = ServletRequestUtils.getStringParameter(request, "cn", null);

  // type of statistic to be displayed
  String statType = ServletRequestUtils.getStringParameter(request, "st", null);

  // Series legend
  String series1Legend = ServletRequestUtils.getStringParameter(request, "sl", "");

  if (connectorName != null && statType != null) {
    List<XYDataItem> stats =
        statsCollection.getStats("stat.connector." + connectorName + "." + statType);
    if (stats != null) {
      dataset.addSeries(toSeries(series1Legend, stats));
    }
  }
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:22,代码来源:ConnectorSeriesProvider.java

示例10: list

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
/**
 * 分页查询
 * 
 * @return
 * @throws Exception
 */
@SuppressWarnings("rawtypes")
@RequestMapping("list")
public Map<Object, Object> list(SysLogCriteria sysLogCriteria) throws Exception {
	String sort = ServletRequestUtils.getStringParameter(request, "sort", "");
	String order = ServletRequestUtils.getStringParameter(request, "order", "");

	if (!isNotNullAndEmpty(sort) || sort.equals("logTime")) {
		sort = "log_Time";
	}
	if (!isNotNullAndEmpty(order)) {
		order = "desc";
	}

	PageBean pb = super.getPageBean(); // 获得分页对象
	pb.setSort(sort);
	pb.setSortOrder(order);

	sysLogService.findByPage(pb, sysLogCriteria);

	return super.setJsonPaginationMap(pb);
}
 
开发者ID:ushelp,项目名称:EasyEE,代码行数:28,代码来源:SysLogController.java

示例11: handleContext

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

  String jspName = ServletRequestUtils.getStringParameter(request, "source", null);

  if (jspName != null) {
    String servletName =
        getContainerWrapper().getTomcatContainer().getServletFileNameForJsp(context, jspName);
    if (servletName != null) {
      File servletFile = new File(servletName);
      if (servletFile.exists()) {
        Utils.sendFile(request, response, servletFile);
      }
    }
  }
  return null;
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:19,代码来源:DownloadServletController.java

示例12: handleContext

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

  String jspName = ServletRequestUtils.getStringParameter(request, "source", null);
  ServletContext sctx = context.getServletContext();
  ServletConfig scfg = (ServletConfig) context.findChild("jsp");
  Options opt = new EmbeddedServletOptions(scfg, sctx);
  String encoding = opt.getJavaEncoding();
  String content = null;

  if (jspName != null) {
    String servletName =
        getContainerWrapper().getTomcatContainer().getServletFileNameForJsp(context, jspName);

    if (servletName != null) {
      File servletFile = new File(servletName);
      if (servletFile.exists()) {
        try (FileInputStream fis = new FileInputStream(servletFile)) {
          content = Utils.highlightStream(jspName, fis, "java", encoding);
        }
      }
    }
  }
  return new ModelAndView(getViewName(), "content", content);
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:27,代码来源:ViewServletSourceController.java

示例13: 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

示例14: handleRequestInternal

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

  String cookieName = ServletRequestUtils.getStringParameter(request, "cn");
  String state = ServletRequestUtils.getStringParameter(request, "state");
  if (cookieName != null && state != null) {
    cookieName = Functions.safeCookieName(cookieName);
    // expire the cookies at the current date + 10years (roughly, nevermind leap years)
    response.addHeader("Set-Cookie",
        cookieName + "=" + state + "; Expires="
            + sdf.format(new Date(System.currentTimeMillis() + 315360000000L))
            + "; Secure=true; HttpOnly=true");
  }
  return null;
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:17,代码来源:RememberVisibilityController.java

示例15: handleRequestInternal

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

  String threadName = ServletRequestUtils.getStringParameter(request, "thread", null);

  Thread thread = null;
  if (threadName != null) {
    thread = Utils.getThreadByName(threadName);
  }

  if (thread != null) {
    thread.stop();
  }

  String referer = request.getHeader("Referer");
  String redirectUrl;
  if (referer != null) {
    redirectUrl = referer.replaceAll(replacePattern, "");
  } else {
    redirectUrl = request.getContextPath() + getViewName();
  }
  return new ModelAndView(new RedirectView(redirectUrl));
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:25,代码来源:KillThreadController.java


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