List of usage examples for javax.servlet ServletRequest getParameter
public String getParameter(String name);
String
, or null
if the parameter does not exist. From source file:pt.ist.fenixedu.teacher.servlet.AnnualTeachingCreditsDocumentFilter.java
@Override public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException { ResponseWrapper response = (ResponseWrapper) arg1; ExecutionYear executionYear = FenixFramework.getDomainObject(arg0.getParameter("executionYearOid")); Teacher teacher = FenixFramework.getDomainObject(arg0.getParameter("teacherOid")); if (teacher != null) { ByteArrayOutputStream pdfStreamToReturn = null; try {/*from www. ja v a2 s . c om*/ pdfStreamToReturn = getAnnualTeacherCreditsDocument(arg0, arg1, arg2, teacher, executionYear); } finally { if (!response.isCommitted()) { response.reset(); } } response.getOutputStream().write(pdfStreamToReturn.toByteArray()); response.setContentType("application/pdf"); response.setHeader("Content-disposition", "attachment; filename=" + teacher.getTeacherId() + "_" + executionYear.getName() + ".pdf"); response.getOutputStream().close(); } else { AnnualCreditsState annualCreditsState = AnnualCreditsState.getAnnualCreditsState(executionYear); if (annualCreditsState != null && annualCreditsState.getIsFinalCreditsCalculated() && !annualCreditsState.getIsCreditsClosed()) { Map<AnnualTeachingCredits, ByteArrayOutputStream> documentsWithConfidentionalInformation = new HashMap<AnnualTeachingCredits, ByteArrayOutputStream>(); Map<AnnualTeachingCredits, ByteArrayOutputStream> documentsWithoutConfidentionalInformation = new HashMap<AnnualTeachingCredits, ByteArrayOutputStream>(); for (AnnualTeachingCredits annualTeachingCredits : annualCreditsState .getAnnualTeachingCreditsSet()) { try { ByteArrayOutputStream pdfStreamToReturn; pdfStreamToReturn = getAnnualTeacherCreditsDocument(arg0, arg1, arg2, annualTeachingCredits.getTeacher(), executionYear); documentsWithoutConfidentionalInformation.put(annualTeachingCredits, pdfStreamToReturn); } finally { if (!response.isCommitted()) { response.resetBuffer(); } } try { ByteArrayOutputStream pdfStreamToReturn = getAnnualTeacherCreditsDocument(arg0, arg1, arg2, annualTeachingCredits.getTeacher(), executionYear); documentsWithConfidentionalInformation.put(annualTeachingCredits, pdfStreamToReturn); } finally { if (!response.isCommitted()) { response.resetBuffer(); } } } closeAnnualCreditsState(annualCreditsState, documentsWithConfidentionalInformation, documentsWithoutConfidentionalInformation); } response.sendRedirect(buildRedirectURL((HttpServletRequest) arg0)); response.flushBuffer(); } }
From source file:com.gamewin.weixin.web.account.ApplyThreeAdminController.java
@RequestMapping(value = "update", method = RequestMethod.POST) public String update(@Valid @ModelAttribute("applyThreeAdmin") ApplyThreeAdmin newApplyThreeAdmin, RedirectAttributes redirectAttributes, ServletRequest request) { User user = new User(getCurrentUserId()); newApplyThreeAdmin.setUser(user);// ww w . j a v a2s .c om newApplyThreeAdmin.setIsdelete(0); newApplyThreeAdmin.setStatus("submit"); String upuserId = request.getParameter("upuserId"); if (!StringUtils.isEmpty(upuserId)) { User upuser = accountService.getUser(Long.parseLong(upuserId)); if (upuser != null && "TwoAdmin".equals(upuser.getRoles())) { newApplyThreeAdmin.setUpuser(upuser); applyThreeAdminService.saveApplyThreeAdmin(newApplyThreeAdmin); redirectAttributes.addFlashAttribute("applyThreeAdmin", newApplyThreeAdmin); redirectAttributes.addFlashAttribute("message", "?,"); return "redirect:/ApplyThreeAdmin/applyThreeAdminView"; } else { applyThreeAdminService.saveApplyThreeAdmin(newApplyThreeAdmin); redirectAttributes.addFlashAttribute("applyThreeAdmin", newApplyThreeAdmin); redirectAttributes.addFlashAttribute("message", "?,?"); return "redirect:/ApplyThreeAdmin/applyThreeAdminView"; } } else { applyThreeAdminService.saveApplyThreeAdmin(newApplyThreeAdmin); redirectAttributes.addFlashAttribute("applyThreeAdmin", newApplyThreeAdmin); redirectAttributes.addFlashAttribute("message", "?,?"); return "redirect:/ApplyThreeAdmin/applyThreeAdminView"; } }
From source file:net.sourceforge.fenixedu.presentationTier.servlets.filters.AnnualTeachingCreditsDocumentFilter.java
@Override public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException { ResponseWrapper response = (ResponseWrapper) arg1; ExecutionYear executionYear = FenixFramework.getDomainObject(arg0.getParameter("executionYearOid")); Teacher teacher = FenixFramework.getDomainObject(arg0.getParameter("teacherOid")); if (teacher != null) { ByteArrayOutputStream pdfStreamToReturn = null; try {//from w w w .jav a2 s.co m pdfStreamToReturn = getAnnualTeacherCreditsDocument(arg0, arg1, arg2, teacher, executionYear, null); } finally { if (!response.isCommitted()) { response.reset(); } } response.getOutputStream().write(pdfStreamToReturn.toByteArray()); response.setContentType("application/pdf"); response.setHeader("Content-disposition", "attachment; filename=" + teacher.getTeacherId() + "_" + executionYear.getName() + ".pdf"); response.getOutputStream().close(); } else { AnnualCreditsState annualCreditsState = AnnualCreditsState.getAnnualCreditsState(executionYear); if (annualCreditsState != null && annualCreditsState.getIsFinalCreditsCalculated() && !annualCreditsState.getIsCreditsClosed()) { Map<AnnualTeachingCredits, ByteArrayOutputStream> documentsWithConfidentionalInformation = new HashMap<AnnualTeachingCredits, ByteArrayOutputStream>(); Map<AnnualTeachingCredits, ByteArrayOutputStream> documentsWithoutConfidentionalInformation = new HashMap<AnnualTeachingCredits, ByteArrayOutputStream>(); for (AnnualTeachingCredits annualTeachingCredits : annualCreditsState .getAnnualTeachingCreditsSet()) { try { ByteArrayOutputStream pdfStreamToReturn; pdfStreamToReturn = getAnnualTeacherCreditsDocument(arg0, arg1, arg2, annualTeachingCredits.getTeacher(), executionYear, RoleType.DEPARTMENT_ADMINISTRATIVE_OFFICE); documentsWithoutConfidentionalInformation.put(annualTeachingCredits, pdfStreamToReturn); } finally { if (!response.isCommitted()) { response.resetBuffer(); } } try { ByteArrayOutputStream pdfStreamToReturn = getAnnualTeacherCreditsDocument(arg0, arg1, arg2, annualTeachingCredits.getTeacher(), executionYear, RoleType.SCIENTIFIC_COUNCIL); documentsWithConfidentionalInformation.put(annualTeachingCredits, pdfStreamToReturn); } finally { if (!response.isCommitted()) { response.resetBuffer(); } } } closeAnnualCreditsState(annualCreditsState, documentsWithConfidentionalInformation, documentsWithoutConfidentionalInformation); } response.sendRedirect(buildRedirectURL((HttpServletRequest) arg0)); response.flushBuffer(); } }
From source file:org.egov.ptis.workflow.filter.ActionsBasedOnWorkFlowFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { Action action = null;/*ww w . j av a 2 s . co m*/ boolean authorized = true; // from action, for which actions restricted for properties under work // flow should be applied expecting parameter with name ENTITY_ID and // value is bill no of property if (request.getParameter("ENTITY_ID") != null) { HttpServletRequest httpRequest = (HttpServletRequest) request; List authResList = new ArrayList(); String billNo = httpRequest.getParameter("ENTITY_ID"); action = getAction(httpRequest); authResList = getWorkFlowActionAuth(action.getUrl(), billNo); authorized = Boolean.valueOf(authResList.get(0).toString()); if (!authorized) { // if authorization fails throwing // AuthorizationException request.setAttribute("AuthRuleErrMsgKey", authResList.get(1).toString()); throw new AuthorizationException(authResList.get(1).toString()); } } chain.doFilter(request, response); }
From source file:org.commonfarm.web.ECSideFilter.java
public String getEasyList(ServletRequest servletRequest) { String easyDataAccess = null; if (useEasyDataAccess) { easyDataAccess = servletRequest.getParameter(ECSideConstants.EASY_DATA_LIST_FLAG); }/*from w w w. j a va 2 s . c o m*/ return StringUtils.isNotBlank(easyDataAccess) ? easyDataAccess : null; }
From source file:org.commonfarm.web.ECSideFilter.java
public String getEasyDataExport(ServletRequest servletRequest) { String easyDataAccess = null; if (useEasyDataAccess) { easyDataAccess = servletRequest.getParameter(ECSideConstants.EASY_DATA_EXPORT_FLAG); }/*from w ww . j a v a 2 s. c o m*/ if (StringUtils.isNotBlank(easyDataAccess) && easyDataAccess.indexOf('.') > 0) { easyDataAccess = easyDataAccess.substring(0, easyDataAccess.indexOf('.')); } return StringUtils.isNotBlank(easyDataAccess) ? easyDataAccess : null; }
From source file:org.commonfarm.web.ECSideFilter.java
public String getEasyDataAccess(ServletRequest servletRequest) { String easyDataAccess = null; if (useEasyDataAccess) { easyDataAccess = servletRequest.getParameter(ECSideConstants.EASY_DATA_ACCESS_FLAG); }/*from w w w.ja v a 2s . c o m*/ if (StringUtils.isNotBlank(easyDataAccess) && easyDataAccess.indexOf('.') > 0) { easyDataAccess = easyDataAccess.substring(0, easyDataAccess.indexOf('.')); } return StringUtils.isNotBlank(easyDataAccess) ? easyDataAccess : null; }
From source file:com.ultrapower.eoms.common.plugin.ecside.filter.ECSideFilter.java
public String getEasyDataExport(ServletRequest servletRequest){ String easyDataAccess=null;/*from www .j ava2s. com*/ if (useEasyDataAccess){ easyDataAccess=servletRequest.getParameter(ECSideConstants.EASY_DATA_EXPORT_FLAG); } if (StringUtils.isNotBlank(easyDataAccess) && easyDataAccess.indexOf('.')>0){ easyDataAccess=easyDataAccess.substring(0,easyDataAccess.indexOf('.')); } return StringUtils.isNotBlank(easyDataAccess)?easyDataAccess:null; }
From source file:com.ultrapower.eoms.common.plugin.ecside.filter.ECSideFilter.java
public String getEasyDataAccess(ServletRequest servletRequest){ String easyDataAccess=null;/*w ww .j a v a 2 s .com*/ if (useEasyDataAccess){ easyDataAccess=servletRequest.getParameter(ECSideConstants.EASY_DATA_ACCESS_FLAG); } if (StringUtils.isNotBlank(easyDataAccess) && easyDataAccess.indexOf('.')>0){ easyDataAccess=easyDataAccess.substring(0,easyDataAccess.indexOf('.')); } return StringUtils.isNotBlank(easyDataAccess)?easyDataAccess:null; }
From source file:org.xwoot.xwootApp.web.XWootSite.java
public Properties updateXWikiPropertiesFromRequest(ServletRequest request, String xwikiPropertiesPath) { Properties p = getProperties(xwikiPropertiesPath); p.put(XWootSite.XWIKI_ENDPOINT, request.getParameter(XWootSite.XWIKI_ENDPOINT)); p.put(XWootSite.XWIKI_USERNAME, request.getParameter(XWootSite.XWIKI_USERNAME)); p.put(XWootSite.XWIKI_PASSWORD, request.getParameter(XWootSite.XWIKI_PASSWORD)); return p;//w w w . ja va2 s . c o m }