List of usage examples for javax.servlet.http HttpServletRequest getParameter
public String getParameter(String name);
String
, or null
if the parameter does not exist. From source file:com.painiu.webapp.util.PhotoUtils.java
public static License getLicense(HttpServletRequest request) { String license = request.getParameter("license"); if (license == null || "".equals(license)) { return License.ATTRIBUTION_NONCOMMERCIAL_SHAREALIKE; }//ww w. j a va 2s . co m return License.valueOf(Integer.valueOf(license).intValue()); }
From source file:com.netsteadfast.greenstep.sys.SysQueryParamInspectUtils.java
private static String getFieldValue(String fieldName, HttpServletRequest request) throws Exception { String value = null;//from w w w . j ava 2s.c o m value = request.getParameter(fieldName); if (StringUtils.defaultString(value).length() > MAX_VALUE_LENGTH) { value = value.substring(0, MAX_VALUE_LENGTH); } return value; }
From source file:com.amalto.core.servlet.ExportServlet.java
private static String getParameter(HttpServletRequest request, String parameter, boolean isMandatory, String defaultValue) {/* w w w. ja v a 2s . c om*/ String value = request.getParameter(parameter); if (value == null && isMandatory) { throw new IllegalArgumentException("Parameter '" + parameter + "' is mandatory and not set."); } return value == null ? defaultValue : value; }
From source file:com.painiu.webapp.util.PhotoUtils.java
public static Privacy getPrivacy(HttpServletRequest request, String prefix) { String isPublic = request.getParameter(prefix == null ? "is_public" : prefix + "_is_public"); String isContact = request.getParameter(prefix == null ? "is_contact" : prefix + "_is_contact"); String isFriend = request.getParameter(prefix == null ? "is_friend" : prefix + "_is_friend"); String isFamily = request.getParameter(prefix == null ? "is_family" : prefix + "_is_family"); return getPrivacyValue(isPublic, isContact, isFriend, isFamily); }
From source file:org.ow2.chameleon.fuchsia.push.base.hub.dto.SubscriptionRequest.java
public static SubscriptionRequest from(HttpServletRequest request) throws InvalidContentNotification { validateRequest(request);/* w w w . j ava 2 s. c o m*/ return new SubscriptionRequest(request.getParameter(HUB_CALLBACK), request.getParameter(HUB_MODE), request.getParameter(HUB_TOPIC), request.getParameter(HUB_VERIFY)); }
From source file:com.npower.wall.TagUtil.java
/** * Get the UA from request if any otherwise use the parameter passed *//*from ww w. j a v a 2s . c om*/ public static String getUA(HttpServletRequest request) { String UA = ""; if (request.getParameter("UA") != null) { UA = request.getParameter("UA"); } else { UA = request.getHeader("User-Agent"); } if (StringUtils.isEmpty(UA)) { // Default UA UA = "Nokia6681"; } return UA; }
From source file:com.npower.wall.TagUtil.java
/** * Figure out if the request is coming in through an UP.Link (AKA MAG) WAP * Gateway from Openwave (this info is necessary to undestand if certain WML * extensions (useful for usability) can be utilized. *//*from w ww. jav a 2 s.c o m*/ public static boolean isUplink(HttpServletRequest request) { String UA = ""; if (request.getParameter("UA") != null) { UA = "" + request.getParameter("UA"); } else { UA = "" + request.getHeader("User-Agent"); } if (UA.indexOf("UP.Link") != -1) { return true; } else { return false; } }
From source file:com.controlj.addon.weather.servlets.PrimDeclaration.java
private static String getLocation(HttpServletRequest request) { String locString = request.getParameter("title"); String result = null;/*from w w w.ja v a 2 s.co m*/ if (locString != null) { // example: Administrator@161.145.175.61[lvl5] - #weather [Graphics:None:Test Fields:View] Pattern pattern = Pattern.compile(".+ - ([^ ]+) \\[.+\\]"); Matcher matcher = pattern.matcher(locString); if (matcher.matches()) { try { result = matcher.group(1); } catch (Exception e) { } // ignore matching exceptions } } return result; }
From source file:com.github.rnewson.couchdb.lucene.util.ServletUtils.java
public static int getIntParameter(final HttpServletRequest req, final String parameterName, final int defaultValue) { final String result = req.getParameter(parameterName); return result != null ? Integer.parseInt(result) : defaultValue; }
From source file:com.github.rnewson.couchdb.lucene.util.ServletUtils.java
public static long getLongParameter(final HttpServletRequest req, final String parameterName, final long defaultValue) { final String result = req.getParameter(parameterName); return result != null ? Long.parseLong(result) : defaultValue; }