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.samples.clientcontext.impl.ClientContextBuilderImpl.java
private static String getParameterOrAttribute(HttpServletRequest request, String key, String dfault) { String value = null;/*from w ww . ja v a 2s . c o m*/ if (request == null) { return value; } if (StringUtils.isNotBlank(request.getParameter(key))) { value = request.getParameter(key); } else if (StringUtils.isNotBlank((String) request.getAttribute(key))) { value = (String) request.getAttribute(key); } if (StringUtils.isBlank(value)) { value = dfault; } return value; }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void obtenerInscritosConv(HttpServletRequest request, HttpServletResponse response) throws IOException { int numC = CtrlUsuario.obtenerInscritosConv(Integer.parseInt(request.getParameter("1"))); response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONObject obj = new JSONObject(); obj.put("inscritos", numC); out.print(obj);//from w w w . j ava2s. c o m }
From source file:com.google.appengine.tools.mapreduce.MapReduceServletTest.java
private static HttpServletRequest createMockStartRequest(Configuration conf) { HttpServletRequest request = createMockRequest(MapReduceServlet.START_PATH, false, false); expect(request.getParameter(AppEngineJobContext.CONFIGURATION_PARAMETER_NAME)) .andReturn(ConfigurationXmlUtil.convertConfigurationToXml(conf)).anyTimes(); return request; }
From source file:com.ibm.sbt.sample.web.util.SnippetFactory.java
private static String[] getRuntimes(HttpServletRequest request) { Context context = Context.get(); String environment = "defaultEnvironment"; if (request.getParameter("env") != null) { environment = request.getParameter("env"); } else if (context.getProperty("environment") != null) { environment = context.getProperty("environment"); }/*from ww w. j a va2s . co m*/ Object obj = context.getBean(environment); if (obj != null) { SBTEnvironment bean = (SBTEnvironment) obj; return bean.getRuntimesArray(); } else { return null; } }
From source file:dk.statsbiblioteket.doms.surveillance.surveyor.SurveyorServletUtils.java
/** * Handle actions given a servlet request on a surveyor. * Will handle requests to mark a log message as handled, and requests * never to show a given message again./*from w ww . j a v a2s .com*/ * @param request The request containing the parameters. * @param surveyor The surveyor to call the actions on. */ public static void handlePostedParameters(HttpServletRequest request, Surveyor surveyor) { log.trace("Enter handlePostedParameters()"); String applicationName; try { request.setCharacterEncoding("UTF-8"); } catch (UnsupportedEncodingException e) { //UTF-8 must be supported as per spec. throw new Error("UTF-8 unsupported by JVM", e); } applicationName = request.getParameter("applicationname"); if (applicationName != null) { Map<String, String[]> parameters = request.getParameterMap(); for (String key : parameters.keySet()) { if (key.startsWith("handle:") && Arrays.equals(new String[] { "Handled" }, parameters.get(key))) { surveyor.markHandled(applicationName, key.substring("handle:".length())); } } if (request.getParameter("notagain") != null) { surveyor.notAgain(applicationName, request.getParameter("notagain")); } } }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Admin.CUDEventos.java
protected static void consultarUsuariosEnConvocatoriaId(HttpServletRequest request, HttpServletResponse response) throws IOException { ArrayList<UsuarioEntity> usuarios = new ArrayList<>(); usuarios = CtrlAdmin.obtenerUsuariosEnConvocatoria(Integer.parseInt(request.getParameter("3")), //id evento Integer.parseInt(request.getParameter("2")), //tamao tabla Integer.parseInt(request.getParameter("1"))//pagina );//from w ww . j a v a2s. c o m response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONArray list1 = new JSONArray(); for (UsuarioEntity usuario : usuarios) { JSONObject obj = new JSONObject(); obj.put("id", usuario.getIdUsuario()); obj.put("titulo", usuario.getNombres() + " " + usuario.getApellidos()); list1.add(obj); } out.print(list1); }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void obtenerInscritosTaller(HttpServletRequest request, HttpServletResponse response) throws IOException { int numC = CtrlUsuario.obtenerInscritosTaller(Integer.parseInt(request.getParameter("1"))); response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONObject obj = new JSONObject(); obj.put("inscritos", numC); out.print(obj);//from w ww . j a va 2s . c om }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void isInscritoconvocatoria(HttpServletRequest request, HttpServletResponse response) throws IOException { boolean b = CtrlUsuario.isInscritoconvocatoria(Integer.parseInt(request.getParameter("1")), Integer.parseInt(request.getParameter("2"))); response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); JSONObject obj = new JSONObject(); obj.put("is", b); out.print(obj);// ww w . j a v a 2 s . c o m }
From source file:com.avlesh.web.filter.responseheaderfilter.ResponseHeaderFilter.java
/** * As long as a parameter is present in the queryString (of the <code>request</code>), the value for that * query parameter is <code>request.getParameter(queryParam)</code>. If this turns out to be <code>null</code> * the value <code>""</code> (empty string) is assigned to the queryParam. This is done to match the * <code>Regex</code> (.*) in the condition. Unavailable queryParams in the <code>request</code> are treated as * value <code>null</code>/*from w w w. j a v a 2 s .c om*/ * * @param request (The incoming request) * @param queryParamName (Parameter which needs to be looked up) * @return String (The "value" of this parameter in the queryString) * * @see ResponseHeaderFilter * @see ResponseHeaderFilter#doFilter(ServletRequest, ServletResponse, FilterChain) */ private static String getRequestParamValue(HttpServletRequest request, String queryParamName) { String paramValue = null; if (request.getParameterMap().containsKey(queryParamName)) { paramValue = request.getParameter(queryParamName); if (paramValue == null) { paramValue = ""; } } return paramValue; }
From source file:co.edu.UNal.ArquitecturaDeSoftware.Bienestar.Vista.App.Usuario.Read.java
protected static void leerConvocatoria(HttpServletRequest request, HttpServletResponse response) throws IOException { ConvocatoriaEntity e = CtrlUsuario.leerConvocatoria(request.getParameter("1")); // id de la convocatoria response.setContentType("application/json;charset=UTF-8"); PrintWriter out = response.getWriter(); if (e.getNombre().isEmpty()) { JSONObject obj = new JSONObject(); obj.put("isError", true); obj.put("errorDescrip", "La convocatoria ya no existe"); out.print(obj);/*from w ww . ja va 2 s . com*/ } else { JSONObject obj = new JSONObject(); obj.put("id", e.getIdConvocatoria()); obj.put("nombre", e.getNombre()); obj.put("descripcion", e.getDescripcion()); obj.put("cupos", e.getCupos()); obj.put("fechaFin", "" + e.getFechaFinRegistro()); out.print(obj); } }