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