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.activecq.api.utils.HttpRequestUtil.java
/** * <p>/*from w w w . j a v a2s . c o m*/ * Gets the Attribute or Parameter value from the Request. * </p><p> * Attribute takes precedence * </p><p> * If neither an Attribute or Parameter value exists @ key, return the dfault * </p> * * @param request * @param key * @param dfault * @return */ public static String getAttributeOrParameter(HttpServletRequest request, String key, String dfault) { String value = null; if (request == null) { return value; } if (hasAttribute(request, key)) { value = (String) request.getAttribute(key); } else if (hasParameter(request, key)) { value = request.getParameter(key); } if (StringUtils.isBlank(value)) { value = dfault; } return value; }
From source file:com.stratelia.silverpeas.pdcPeas.servlets.PdcSearchRequestRouterHelper.java
private static Date getDateFromRequest(String name, String language, HttpServletRequest request) { String str = request.getParameter(name); if (!StringUtil.isDefined(str)) { return null; }//from w w w.ja v a2 s.c om try { return DateUtil.stringToDate(str, language); } catch (ParseException e) { SilverTrace.warn("pdcPeas", "PdcPeasRequestRouterHelper.getDateFromRequest()", "ERR_CANT_PARSE_DATE", e); } return null; }
From source file:com.ofbizcn.securityext.login.LoginEvents.java
/** * The user forgot his/her password. This will call showPasswordHint, emailPassword or simply returns "success" in case * no operation has been specified./*from w w w.ja va 2 s .c o m*/ * * @param request The HTTPRequest object for the current request * @param response The HTTPResponse object for the current request * @return String specifying the exit status of this event */ public static String forgotPassword(HttpServletRequest request, HttpServletResponse response) { if ((UtilValidate.isNotEmpty(request.getParameter("GET_PASSWORD_HINT"))) || (UtilValidate.isNotEmpty(request.getParameter("GET_PASSWORD_HINT.x")))) { return showPasswordHint(request, response); } else if ((UtilValidate.isNotEmpty(request.getParameter("EMAIL_PASSWORD"))) || (UtilValidate.isNotEmpty(request.getParameter("EMAIL_PASSWORD.x")))) { return emailPassword(request, response); } else { return "success"; } }
From source file:com.stratelia.silverpeas.pdcPeas.servlets.PdcSearchRequestRouterHelper.java
public static void processItemsPagination(String function, PdcSearchSessionController pdcSC, HttpServletRequest request) { String index = request.getParameter("Index"); if (StringUtil.isDefined(index)) { pdcSC.setIndexOfFirstItemToDisplay(index); }//ww w. j av a 2 s . com request.setAttribute("NbItemsPerPage", Integer.valueOf(pdcSC.getNbItemsPerPage())); request.setAttribute("FirstItemIndex", Integer.valueOf(pdcSC.getIndexOfFirstItemToDisplay())); Value value = pdcSC.getCurrentValue(); request.setAttribute("SelectedValue", value); }
From source file:com.stratelia.silverpeas.pdcPeas.servlets.PdcSearchRequestRouterHelper.java
/** * Checks the list of result and marks a result as read * * @param pdcSC PdcSearchSessionController object * @param request HttpRequest object/*from w ww . j a va2 s . co m*/ */ public static void markResultAsRead(PdcSearchSessionController pdcSC, HttpServletRequest request) { String sId = request.getParameter("id"); if (StringUtils.isNotEmpty(sId)) { try { int resultId = Integer.parseInt(sId); List<GlobalSilverResult> results = pdcSC.getGlobalSR(); for (GlobalSilverResult result : results) { if (result.getResultId() == resultId) { result.setHasRead(true); } } } catch (Exception e) { SilverTrace.error("pdcPeas", "PdcSearchRequestRouterHelper.markResultAsRead", "pdcPeas.ERROR_WHEN_MARKING_RESULT", "resultId = " + sId); } } }
From source file:fr.mby.saml2.sp.impl.helper.SamlHelper.java
/** * Retrieve relay state from http request. * /* w w w . j a va2 s. c o m*/ * @param request * the http request * @return the relay state. */ public static String getRelayState(final HttpServletRequest request) { String relayState = null; if (request != null) { relayState = request.getParameter(SamlHelper.RELAY_STATE_PARAM_KEY); } return relayState; }
From source file:com.gtwm.pb.servlets.ServletUtilMethods.java
public static TableInfo getTableForRequest(SessionDataInfo sessionData, HttpServletRequest request, DatabaseInfo databaseDefn, boolean defaultToSessionTable) throws MissingParametersException, ObjectNotFoundException, DisallowedException { TableInfo table = null;//from w w w . ja v a 2 s.c o m String internalTableName = request.getParameter("internaltablename"); if ((internalTableName == null) && (defaultToSessionTable)) { table = sessionData.getTable(); if (table == null) { throw new ObjectNotFoundException( "There is no table in the session - perhaps the session has timed out"); } } else if (internalTableName == null) { throw new MissingParametersException("'internaltablename' parameter needed in request"); } else { // locate the table by internalTableName // throws ObjectNotFoundException if table doesn't exist // throws DisallowedException is the user doesn't have permission to // view the table table = databaseDefn.getTable(request, internalTableName); } return table; }
From source file:com.mindquarry.user.webapp.AuthenticationFilter.java
private static boolean isAJAXRequest(HttpServletRequest request) { return request.getParameter("cocoon-ajax") != null && request.getParameter("cocoon-ajax").equalsIgnoreCase("true"); }
From source file:HttpTransactionUtils.java
/** * Set up a simple Map of HTTP request parameters (assumes no duplicate names) * //from w w w.jav a2s .c o m * @param request * HttpServletRequest object * @return Map of name=value pairs */ public static Map getAttributesAsMap(HttpServletRequest request) { Enumeration enumeration = request.getParameterNames(); HashMap map = new HashMap(); while (enumeration.hasMoreElements()) { String name = (String) enumeration.nextElement(); map.put(name, request.getParameter(name)); } return map; }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void leerMultiplesTalleres(HttpServletRequest request, HttpServletResponse response) throws IOException { ArrayList<TallerEntity> talleres = new ArrayList<>(); talleres = CtrlUsuario.leerMultiplesTalleres(Integer.parseInt(request.getParameter("1")), Integer.parseInt(request.getParameter("2"))); // posicin y tamao response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); System.out.println("Talleres: " + talleres.size()); JSONArray list1 = new JSONArray(); for (TallerEntity taller : talleres) { JSONObject obj = new JSONObject(); obj.put("id", taller.getIdTaller()); obj.put("titulo", taller.getNombre()); list1.add(obj);//from w w w . jav a 2s .c om } out.print(list1); }