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


Java ServletRequestUtils.getRequiredStringParameter方法代码示例

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


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

示例1: handleRequest

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

    HttpClient client = new DefaultHttpClient();
    HttpConnectionParams.setConnectionTimeout(client.getParams(), 15000);
    HttpConnectionParams.setSoTimeout(client.getParams(), 15000);
    HttpGet method = new HttpGet(url);

    InputStream in = null;
    try {
        HttpResponse resp = client.execute(method);
        int statusCode = resp.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            response.sendError(statusCode);
        } else {
            in = resp.getEntity().getContent();
            IOUtils.copy(in, response.getOutputStream());
        }
    } finally {
        IOUtils.closeQuietly(in);
        client.getConnectionManager().shutdown();
    }
    return null;
}
 
开发者ID:sindremehus,项目名称:subsonic,代码行数:25,代码来源:ProxyController.java

示例2: handleRequestInternal

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

  String connectorName = ServletRequestUtils.getRequiredStringParameter(request, "cn");
  collectorBean.reset(connectorName);
  return new ModelAndView(new RedirectView(request.getContextPath() + getViewName()));
}
 
开发者ID:psi-probe,项目名称:psi-probe,代码行数:9,代码来源:ResetConnectorStatsController.java

示例3: handleRequestInternal

import org.springframework.web.bind.ServletRequestUtils; //导入方法依赖的package包/类
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
    String connectorName = ServletRequestUtils.getRequiredStringParameter(request, "cn");
    collectorBean.reset(connectorName);
    return new ModelAndView(new RedirectView(request.getContextPath() + getViewName()));
}
 
开发者ID:andresol,项目名称:psi-probe-plus,代码行数:6,代码来源:ResetConnectorStatsController.java


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