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:net.sourceforge.fenixedu.presentationTier.Action.publico.ViewTeacherInquiryPublicResults.java
public static ActionForward getTeacherResultsActionForward(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { Professorship professorship = FenixFramework.getDomainObject(request.getParameter("professorshipOID")); ShiftType shiftType = ShiftType.valueOf(request.getParameter("shiftType")); List<InquiryResult> inquiryResults = professorship.getInquiryResults(shiftType); ExecutionSemester executionPeriod = professorship.getExecutionCourse().getExecutionPeriod(); ResultsInquiryTemplate resultsInquiryTemplate = ResultsInquiryTemplate .getTemplateByExecutionPeriod(executionPeriod); Collection<InquiryBlock> resultBlocks = resultsInquiryTemplate.getInquiryBlocksSet(); GroupResultsSummaryBean teacherGroupResultsSummaryBean = getGeneralResults(inquiryResults, resultBlocks, GroupResultType.TEACHER_RESULTS); request.setAttribute("teacherGroupResultsSummaryBean", teacherGroupResultsSummaryBean); InquiryResult teacherEvaluation = getTeacherEvaluation(inquiryResults); request.setAttribute("teacherEvaluation", teacherEvaluation); StudentTeacherInquiryTemplate teacherInquiryTemplate = StudentTeacherInquiryTemplate .getTemplateByExecutionPeriod(executionPeriod); List<BlockResultsSummaryBean> blockResultsSummaryBeans = new ArrayList<BlockResultsSummaryBean>(); for (InquiryBlock inquiryBlock : teacherInquiryTemplate.getInquiryBlocksSet()) { blockResultsSummaryBeans.add(new BlockResultsSummaryBean(inquiryBlock, inquiryResults, null, null)); }/*from w w w . ja v a2s.c o m*/ Collections.sort(blockResultsSummaryBeans, new BeanComparator("inquiryBlock.blockOrder")); request.setAttribute("executionCourse", professorship.getExecutionCourse()); request.setAttribute("shiftType", shiftType); request.setAttribute("professorship", professorship); request.setAttribute("executionPeriod", executionPeriod); request.setAttribute("blockResultsSummaryBeans", blockResultsSummaryBeans); request.setAttribute("resultsDate", inquiryResults.iterator().next().getResultDate()); setTeacherScaleColorException(executionPeriod, request); request.setAttribute("publicContext", true); return new ActionForward(null, "/inquiries/showTeacherInquiryResult_v3.jsp", false, "/teacher"); }
From source file:com.ai.smart.common.helper.util.RequestUtils.java
public static Integer getQueryParamInt(HttpServletRequest request, String name) { String val = request.getParameter(name); if (StringUtil.isNullorEmpty(val)) return 0; return Integer.valueOf(val); }
From source file:net.sourceforge.fenixedu.util.InquiriesUtil.java
public static Object getFromRequest(final String name, final HttpServletRequest request) { final Object parameter = request.getParameter(name); return (parameter == null) ? request.getAttribute(name) : parameter; }
From source file:org.emr.controller.ApplicationController.java
public static JSONObject getRequestParamMap(HttpServletRequest request) { JSONObject jsonObject = null;/*from www. j ava 2s . c o m*/ try { if (request.getParameter("json") != null) jsonObject = new JSONObject(request.getParameter("json")); else jsonObject = new JSONObject(); if (request.getParameter("elementid") != null) jsonObject.put("elementid", request.getParameter("elementid")); if (request.getParameter("ipType") != null) jsonObject.put("ipType", request.getParameter("ipType")); jsonObject.put("REQID", request.getParameter("requestid")); jsonObject.put("__RequestType", (request.getParameter("json") != null ? "2" : "1")); } catch (Exception e) { System.out.println("ApplicationController : getRequestParamMap : ERROR"); e.printStackTrace(); } return jsonObject; }
From source file:com.swiftcorp.portal.common.util.WebUtils.java
public static Long getComponentId(HttpServletRequest request) { String componentId = request.getParameter("componentId"); theLogger.error("getComponentId(): componentId(str) from requestis = " + componentId); Long id = null;/*www. jav a2 s . co m*/ if (componentId != null) { try { id = Long.parseLong(componentId.trim()); } catch (NumberFormatException e) { theLogger.error("getComponentId(): NumberFormatException occurs", e); } } else { theLogger.error("getComponentId(): componentId is NULL"); } return id; }
From source file:com.ixcode.framework.model.lookup.LookupHandler.java
public static boolean isLookupInvokedRequest(HttpServletRequest request) { return request.getParameter(PARAM_INVOKE_LOOKUP) != null; }
From source file:org.apache.lucene.replicator.http.ReplicationService.java
private static String extractRequestParam(HttpServletRequest req, String paramName) throws ServletException { String param = req.getParameter(paramName); if (param == null) { throw new ServletException("Missing mandatory parameter: " + paramName); }//from w w w. j a va 2 s.c o m return param; }
From source file:org.jasig.cas.authentication.principal.SamlService.java
public static SamlService createServiceFrom(final HttpServletRequest request, final HttpClient httpClient) { final String service = request.getParameter(CONST_PARAM_SERVICE); final String artifactId; final String requestBody = getRequestBody(request); final String requestId; if (!StringUtils.hasText(service) && !StringUtils.hasText(requestBody)) { return null; }//from ww w . ja v a 2 s. c o m final String id = cleanupUrl(service); if (StringUtils.hasText(requestBody)) { final String tagStart; final String tagEnd; if (requestBody.contains(CONST_START_ARTIFACT_XML_TAG)) { tagStart = CONST_START_ARTIFACT_XML_TAG; tagEnd = CONST_END_ARTIFACT_XML_TAG; } else { tagStart = CONST_START_ARTIFACT_XML_TAG_NO_NAMESPACE; tagEnd = CONST_END_ARTIFACT_XML_TAG_NO_NAMESPACE; } final int startTagLocation = requestBody.indexOf(tagStart); final int artifactStartLocation = startTagLocation + tagStart.length(); final int endTagLocation = requestBody.indexOf(tagEnd); artifactId = requestBody.substring(artifactStartLocation, endTagLocation).trim(); // is there a request id? requestId = extractRequestId(requestBody); } else { artifactId = null; requestId = null; } if (log.isDebugEnabled()) { log.debug("Attempted to extract Request from HttpServletRequest. Results:"); log.debug(String.format("Request Body: %s", requestBody)); log.debug(String.format("Extracted ArtifactId: %s", artifactId)); log.debug(String.format("Extracted Request Id: %s", requestId)); } return new SamlService(id, service, artifactId, httpClient, requestId); }
From source file:edu.ucmerced.cas.authentication.principal.CasShibWebApplicationServiceImpl.java
public static CasShibWebApplicationServiceImpl createServiceFrom(final HttpServletRequest request, final HttpClient httpClient) { final String targetService = request.getParameter(CONST_PARAM_TARGET_SERVICE); final String method = request.getParameter(CONST_PARAM_METHOD); final String serviceToUse = StringUtils.hasText(targetService) ? targetService : request.getParameter(CONST_PARAM_SERVICE); if (!StringUtils.hasText(serviceToUse)) { return null; }/*from w w w . j a v a2s .co m*/ final String id = cleanupUrl(serviceToUse); final String artifactId = request.getParameter(CONST_PARAM_TICKET); // Extract the service passcode from url. // URLs should be in the following format: // /<contextPath>/shib/<appNameOrPasscode>/? String appNameOrPasscode = null; if ((request.getContextPath() != null ? request.getRequestURI().startsWith(request.getContextPath() + "/shib") : request.getRequestURI().startsWith("/shib"))) { String[] components = request.getRequestURI() .substring((request.getContextPath() != null ? request.getContextPath().length() : 0)) .split("/"); // 0 is the empty string before the first slash // 1 should be the shibX string // 2 should be the app name or passcode // 3... should be everything after the app name or passcode if (components.length > 3) { appNameOrPasscode = components[2]; log.debug("application name or passcode = " + appNameOrPasscode); } } else { log.debug("no application name or passcode detected in url"); } return new CasShibWebApplicationServiceImpl(id, serviceToUse, artifactId, "POST".equals(method) ? ResponseType.POST : ResponseType.REDIRECT, httpClient, appNameOrPasscode); }
From source file:cn.com.qiqi.order.utils.Servlets.java
/** * ?Pageable//from ww w. ja va2s . c o m * @param request * @return */ public static Pageable buildPageable(HttpServletRequest request) { String pageNo = StringUtils.defaultIfBlank(request.getParameter("page"), "0"); int page = Integer.parseInt(pageNo); String ps = StringUtils.defaultIfBlank(request.getParameter("pageSize"), "50"); int pageSize = Integer.parseInt(ps); Pageable pageable = new PageRequest(page, pageSize); return pageable; }