List of usage examples for org.apache.commons.httpclient.util URIUtil encodeAll
public static String encodeAll(String unescaped) throws URIException
From source file:edu.wfu.inotado.helper.EncryptionHelper.java
/** * Returns an URI safe signature. So it can be safely used in URL. * /* w ww.j ava2s.com*/ * @param data * @param key * @return */ public String getUriSafeSignature(String data, String key) { String result = ""; try { result = URIUtil.encodeAll(calculateHMAC(data, key)); } catch (SignatureException e) { log.error("Unable to generate HMAC for data: " + data, e); } catch (URIException e) { log.error("Unable to encode the signature of data: " + data, e); } return result; }
From source file:fi.csc.mobileauth.shibboleth.rest.MobileServiceLoginHandler.java
public static void startAuthentication(final String loginContextKey, String mobileNumber, String noSpamCode) { log.debug("Starting to build authentication client"); try {//from w w w.ja v a 2 s . c om mobileNumber = URIUtil.encodeAll(mobileNumber); } catch (URIException e) { log.warn("Could not encode the given mobile number {}", mobileNumber); log.debug("Stack trace for the encoding error of number {}", mobileNumber, e); return; } String uri = baseUrl + "/authenticate?mobileNumber=" + mobileNumber; if (noSpamCode != null) { log.debug("Included no spam code to the request"); uri = uri + "&noSpamCode=" + noSpamCode; } log.debug("Using URI {}", uri); StatusResponse response = getStatusResponse(uri); if (response == null) { log.error("Could not start the mobile authentication process for {}", mobileNumber); return; } communicationDataStore.putData(loginContextKey, new TimestampedStatusResponse(response)); log.debug("Authentication started for login context {}", loginContextKey); }
From source file:fr.paris.lutece.plugins.plu.web.PluJspBean.java
/** * Generates a message of confirmation for approve a PLU * @param request the Http request/* www. j a v a2 s . co m*/ * @return message * @throws ParseException ParseException */ public String getConfirmApprovePlu(HttpServletRequest request) throws ParseException { if (request.getParameter(PARAMETER_DATE_JURIDIQUE).equals("") || request.getParameter(PARAMETER_PLU_TYPE).equals("") || request.getParameter(PARAMETER_PLU_CAUSE).equals("")) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_REQUIRED_FIELD, AdminMessage.TYPE_STOP); } int nIdPlu = Integer.parseInt(request.getParameter(PARAMETER_PLU_ID)); int nIdType = Integer.parseInt(request.getParameter(PARAMETER_PLU_TYPE)); String strCause = request.getParameter(PARAMETER_PLU_CAUSE); String strReference = request.getParameter(PARAMETER_PLU_REFERENCE); String strDate = request.getParameter(PARAMETER_DATE_JURIDIQUE); try { Date date = new Date(); if (stringToDate(strDate, "dd/MM/yyyy").after(date)) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_DATE_APPROVE, AdminMessage.TYPE_STOP); } } catch (ParseException e) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_DATE_FORMAT, AdminMessage.TYPE_STOP); } UrlItem url = new UrlItem(JSP_DO_APPROVE_PLU); url.addParameter(PARAMETER_PLU_ID, nIdPlu); url.addParameter(PARAMETER_PLU_TYPE, nIdType); try { url.addParameter(PARAMETER_PLU_CAUSE, URIUtil.encodeAll(strCause)); url.addParameter(PARAMETER_PLU_REFERENCE, URIUtil.encodeAll(strReference)); url.addParameter(PARAMETER_DATE_JURIDIQUE, URIUtil.encodeAll(strDate)); } catch (URIException e) { new AppException("An error occured while encoding request parameters"); } Object[] args = { nIdPlu, strCause, strDate }; return AdminMessageService.getMessageUrl(request, MESSAGE_CONFIRM_APPROVE_PLU, args, url.getUrl(), AdminMessage.TYPE_CONFIRMATION); }
From source file:fr.paris.lutece.plugins.plu.web.PluJspBean.java
/** * Generates a message of confirmation for apply a PLU * @param request the Http request// www . ja v a 2 s. c om * @throws ParseException ParseException * @return message */ public String getConfirmApplicablePlu(HttpServletRequest request) throws ParseException { if (request.getParameter(PARAMETER_DATE_APPLICATION).equals("")) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_DATE_APPLICATION, AdminMessage.TYPE_STOP); } int nIdPlu = Integer.parseInt(request.getParameter(PARAMETER_PLU_ID)); String strCause = request.getParameter(PARAMETER_PLU_CAUSE); String strDj = request.getParameter(PARAMETER_DATE_JURIDIQUE); String strDa = request.getParameter(PARAMETER_DATE_APPLICATION); Date dj; Date da; try { dj = stringToDate(request.getParameter(PARAMETER_DATE_JURIDIQUE), "dd/MM/yyyy"); da = stringToDate(request.getParameter(PARAMETER_DATE_APPLICATION), "dd/MM/yyyy"); } catch (ParseException e) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_DATE_FORMAT, AdminMessage.TYPE_STOP); } Object[] argsDate = { strDa, strDj }; if (da.before(dj)) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_DATE_APPLICATION_LOWER, argsDate, AdminMessage.TYPE_STOP); } UrlItem url = new UrlItem(JSP_DO_APPLICABLE_PLU); url.addParameter(PARAMETER_PLU_ID, nIdPlu); try { url.addParameter(PARAMETER_DATE_JURIDIQUE, URIUtil.encodeAll(strDj)); url.addParameter(PARAMETER_DATE_APPLICATION, URIUtil.encodeAll(strDa)); } catch (URIException e) { new AppException("An error occured while encoding request parameters"); } Object[] args = { nIdPlu, strCause, strDa }; return AdminMessageService.getMessageUrl(request, MESSAGE_CONFIRM_APPLICABLE_PLU, args, url.getUrl(), AdminMessage.TYPE_CONFIRMATION); }
From source file:fr.paris.lutece.plugins.plu.web.PluJspBean.java
/** * Generates a message of confirmation for modify a PLU * @param request the Http request// w ww.j a va 2s . c om * @return message * @throws ParseException ParseException */ public String getConfirmModifyPlu(HttpServletRequest request) throws ParseException { int nIdPlu = Integer.parseInt(request.getParameter(PARAMETER_PLU_ID)); int nIdType = Integer.parseInt(request.getParameter(PARAMETER_PLU_TYPE)); String strCause = request.getParameter(PARAMETER_PLU_CAUSE); String strReference = request.getParameter(PARAMETER_PLU_REFERENCE); String strDate = request.getParameter(PARAMETER_DATE_JURIDIQUE); if (StringUtils.isEmpty(request.getParameter(PARAMETER_PLU_CAUSE))) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_REQUIRED_FIELD, AdminMessage.TYPE_STOP); } UrlItem url = new UrlItem(JSP_DO_MODIFY_PLU); url.addParameter(PARAMETER_PLU_ID, nIdPlu); url.addParameter(PARAMETER_PLU_TYPE, nIdType); try { url.addParameter(PARAMETER_PLU_CAUSE, URIUtil.encodeAll(strCause)); url.addParameter(PARAMETER_PLU_REFERENCE, URIUtil.encodeAll(strReference)); url.addParameter(PARAMETER_DATE_JURIDIQUE, URIUtil.encodeAll(strDate)); } catch (URIException e) { new AppException("An error occured while encoding request parameters"); } Date dj; try { dj = stringToDate(strDate, "dd/MM/yyyy"); } catch (ParseException e) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_DATE_FORMAT, AdminMessage.TYPE_STOP); } Date date = new Date(); if (dj.after(date)) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_DATE_APPROVE, AdminMessage.TYPE_STOP); } Object[] args = { nIdPlu, strCause }; return AdminMessageService.getMessageUrl(request, MESSAGE_CONFIRM_MODIFY_PLU, args, url.getUrl(), AdminMessage.TYPE_CONFIRMATION); }
From source file:fr.paris.lutece.plugins.plu.web.PluJspBean.java
/** * Generates a message of confirmation for correct a PLU * @param request the Http request//from w ww . j a va 2s . c o m * @return message */ public String getConfirmCorrectPlu(HttpServletRequest request) { int nIdPlu = Integer.parseInt(request.getParameter(PARAMETER_PLU_ID)); int nIdType = Integer.parseInt(request.getParameter(PARAMETER_PLU_TYPE)); String strCause = request.getParameter(PARAMETER_PLU_CAUSE); String strReference = request.getParameter(PARAMETER_PLU_REFERENCE); String strDescription = request.getParameter(PARAMETER_HISTORY_DESCRIPTION); if (StringUtils.isEmpty(strCause) || StringUtils.isEmpty(strDescription)) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_REQUIRED_FIELD, AdminMessage.TYPE_STOP); } UrlItem url = new UrlItem(JSP_DO_CORRECT_PLU); url.addParameter(PARAMETER_PLU_ID, nIdPlu); url.addParameter(PARAMETER_PLU_TYPE, nIdType); try { url.addParameter(PARAMETER_PLU_CAUSE, URIUtil.encodeAll(strCause)); url.addParameter(PARAMETER_PLU_REFERENCE, URIUtil.encodeAll(strReference)); url.addParameter(PARAMETER_HISTORY_DESCRIPTION, URIUtil.encodeAll(strDescription)); } catch (URIException e) { throw new AppException("An error occured while parsing request parameters"); } Object[] args = { nIdPlu, strCause }; return AdminMessageService.getMessageUrl(request, MESSAGE_CONFIRM_CORRECT_PLU, args, url.getUrl(), AdminMessage.TYPE_CONFIRMATION); }
From source file:fr.paris.lutece.plugins.plu.web.PluJspBean.java
/** * Generates a message of confirmation for create a new folder * @param request the Http request/*from www .j a v a 2 s.c om*/ * @return message */ public String getConfirmCreateFolder(HttpServletRequest request) { if (request.getParameter(PARAMETER_FOLDER_TITLE).equals("")) { return this.getMessageJsp(request, MESSAGE_ERROR_REQUIRED_FIELD, null, "jsp/admin/plugins/plu/folder/CreateFolder.jsp", null); } int nIdPlu = Integer.parseInt(request.getParameter(PARAMETER_PLU_ID)); String folderTitle = request.getParameter(PARAMETER_FOLDER_TITLE); UrlItem url = new UrlItem(JSP_DO_CREATE_FOLDER); url.addParameter(PARAMETER_PLU_ID, nIdPlu); try { url.addParameter(PARAMETER_FOLDER_PARENT_ID, URIUtil.encodeAll(request.getParameter(PARAMETER_FOLDER_PARENT_ID))); url.addParameter(PARAMETER_FOLDER_TITLE, URIUtil.encodeAll(folderTitle)); // url.addParameter( PARAMETER_FOLDER_DESCRIPTION, // URIUtil.encodeAll( request.getParameter( // PARAMETER_FOLDER_DESCRIPTION ) ) ); } catch (URIException e) { throw new AppException("An error occured while parsing request parameters"); } // save description into session because it's too large for url request.getSession().setAttribute(PARAMETER_FOLDER_DESCRIPTION, request.getParameter(PARAMETER_FOLDER_DESCRIPTION)); if (request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK) != null) { String[] check = request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK); for (int j = 0; j < check.length; ++j) { url.addParameter(PARAMETER_FOLDER_HTML_CHECK, check[j]); } } if (request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK_IMPRESSION) != null) { String[] checkImpression = request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK_IMPRESSION); for (int j = 0; j < checkImpression.length; ++j) { url.addParameter(PARAMETER_FOLDER_HTML_CHECK_IMPRESSION, checkImpression[j]); } } Object[] args = { folderTitle }; Folder folder = _folderServices.findForTestTitle(folderTitle); if (folder != null) { return this.getMessageJsp(request, MESSAGE_ERROR_FOLDER_CREATE, args, "jsp/admin/plugins/plu/folder/CreateFolder.jsp", null); } if (request instanceof MultipartHttpServletRequest) { MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; FileItem fileItem = multipartRequest.getFile(PARAMETER_FOLDER_IMAGE); if (fileItem.getSize() > 0) { String name = fileItem.getName(); String type = name.substring(name.lastIndexOf(".")); if (!type.equalsIgnoreCase(".jpg") && !type.equalsIgnoreCase(".png") && !type.equalsIgnoreCase(".gif")) { return this.getMessageJsp(request, MESSAGE_ERROR_FOLDER_IMAGE_TYPE, args, "jsp/admin/plugins/plu/folder/CreateFolder.jsp", null); } PhysicalFile physicalFile = new PhysicalFile(); physicalFile.setValue(fileItem.get()); _folderImage.setImg(physicalFile.getValue()); } } return this.getMessageJsp(request, MESSAGE_CONFIRM_CREATE_FOLDER, args, "jsp/admin/plugins/plu/folder/CreateFolder.jsp", url.getUrl()); }
From source file:fr.paris.lutece.plugins.plu.web.PluJspBean.java
/** * Generates a message of confirmation for modify a folder * @param request the Http request/*from ww w. j a v a2s . com*/ * @parma correct true if the modification is a correction, false if the plu * is in "work" state * @return message */ public String getConfirmModifyFolder(HttpServletRequest request, boolean correct) { if (request.getParameter(PARAMETER_FOLDER_TITLE).equals("") || (correct && request.getParameter(PARAMETER_HISTORY_DESCRIPTION).equals(""))) { if (correct) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_REQUIRED_FIELD, AdminMessage.TYPE_STOP); } else { return this.getMessageJsp(request, MESSAGE_ERROR_REQUIRED_FIELD, null, "jsp/admin/plugins/plu/folder/ModifyFolder.jsp", null); } } int nIdPlu = Integer.parseInt(request.getParameter(PARAMETER_PLU_ID)); String folderTitle = request.getParameter(PARAMETER_FOLDER_TITLE); int nIdFolder = Integer.parseInt(request.getParameter(PARAMETER_FOLDER_ID)); Folder folder = _folderServices.findByPrimaryKey(nIdFolder); UrlItem url = new UrlItem(JSP_DO_MODIFY_FOLDER); url.addParameter(PARAMETER_PLU_ID, nIdPlu); try { url.addParameter(PARAMETER_FOLDER_ID, URIUtil.encodeAll(request.getParameter(PARAMETER_FOLDER_ID))); url.addParameter(PARAMETER_FOLDER_PARENT_ID, URIUtil.encodeAll(request.getParameter(PARAMETER_FOLDER_PARENT_ID))); url.addParameter(PARAMETER_FOLDER_TITLE, URIUtil.encodeAll(folderTitle)); if (correct) { url.addParameter(PARAMETER_HISTORY_DESCRIPTION, URIUtil.encodeAll(request.getParameter(PARAMETER_HISTORY_DESCRIPTION))); } } catch (URIException e) { throw new AppException("An error occured while parsing request parameters"); } // save description into session because it's too large for url request.getSession().setAttribute(PARAMETER_FOLDER_DESCRIPTION, request.getParameter(PARAMETER_FOLDER_DESCRIPTION)); if (request.getParameterValues(PARAMETER_FOLDER_IMAGE_CHECK) != null) { String[] check = request.getParameterValues(PARAMETER_FOLDER_IMAGE_CHECK); for (int j = 0; j < check.length; ++j) { url.addParameter(PARAMETER_FOLDER_IMAGE_CHECK, check[j]); } } if (request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK) != null) { String[] check = request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK); for (int j = 0; j < check.length; ++j) { url.addParameter(PARAMETER_FOLDER_HTML_CHECK, check[j]); } } if (request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK_IMPRESSION) != null) { String[] check = request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK_IMPRESSION); for (int j = 0; j < check.length; ++j) { url.addParameter(PARAMETER_FOLDER_HTML_CHECK_IMPRESSION, check[j]); } } Object[] args = { folderTitle }; if ((folder != null) && !folder.getTitle().equals(request.getParameter(PARAMETER_FOLDER_TITLE_OLD))) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_FOLDER_CREATE, args, AdminMessage.TYPE_STOP); } if (request instanceof MultipartHttpServletRequest) { MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; FileItem fileItem = multipartRequest.getFile(PARAMETER_FOLDER_IMAGE); if (fileItem.getSize() > 0) { String name = fileItem.getName(); String type = name.substring(name.lastIndexOf(".")); if (!type.equalsIgnoreCase(".jpg") && !type.equalsIgnoreCase(".png") && !type.equalsIgnoreCase(".gif")) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_FOLDER_IMAGE_TYPE, args, AdminMessage.TYPE_STOP); } PhysicalFile physicalFile = new PhysicalFile(); physicalFile.setValue(fileItem.get()); _folderImage.setImg(physicalFile.getValue()); _folderImage.setNomImage(fileItem.getName()); } } return AdminMessageService.getMessageUrl(request, correct ? MESSAGE_CONFIRM_CORRECT_FOLDER : MESSAGE_CONFIRM_MODIFY_FOLDER, args, url.getUrl(), AdminMessage.TYPE_CONFIRMATION); }
From source file:fr.paris.lutece.plugins.plu.web.PluJspBean.java
/** * Generates a message of confirmation for correct a folder * @param request the Http request/*ww w . ja va 2 s . c om*/ * @return message */ public String getConfirmCorrectFolder(HttpServletRequest request) { if (request.getParameter(PARAMETER_FOLDER_TITLE).equals("") || request.getParameter(PARAMETER_FOLDER_DESCRIPTION).equals("") || request.getParameter(PARAMETER_HISTORY_DESCRIPTION).equals("")) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_REQUIRED_FIELD, AdminMessage.TYPE_STOP); } int nIdPlu = Integer.parseInt(request.getParameter(PARAMETER_PLU_ID)); String folderTitle = request.getParameter(PARAMETER_FOLDER_TITLE); UrlItem url = new UrlItem(JSP_DO_CORRECT_FOLDER); url.addParameter(PARAMETER_PLU_ID, nIdPlu); try { url.addParameter(PARAMETER_FOLDER_ID, URIUtil.encodeAll(request.getParameter(PARAMETER_FOLDER_ID))); url.addParameter(PARAMETER_FOLDER_PARENT_ID, URIUtil.encodeAll(request.getParameter(PARAMETER_FOLDER_PARENT_ID))); url.addParameter(PARAMETER_FOLDER_TITLE, URIUtil.encodeAll(folderTitle)); // url.addParameter( PARAMETER_FOLDER_DESCRIPTION, // URIUtil.encodeAll( request.getParameter( // PARAMETER_FOLDER_DESCRIPTION ) ) ); url.addParameter(PARAMETER_HISTORY_DESCRIPTION, URIUtil.encodeAll(request.getParameter(PARAMETER_HISTORY_DESCRIPTION))); } catch (URIException e) { throw new AppException("An error occured while parsing request parameters"); } // save description into session because it's too large for url request.getSession().setAttribute(PARAMETER_FOLDER_DESCRIPTION, request.getParameter(PARAMETER_FOLDER_DESCRIPTION)); if (request.getParameterValues(PARAMETER_FOLDER_IMAGE_CHECK) != null) { String[] check = request.getParameterValues(PARAMETER_FOLDER_IMAGE_CHECK); for (int j = 0; j < check.length; ++j) { url.addParameter(PARAMETER_FOLDER_IMAGE_CHECK, check[j]); } } if (request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK) != null) { String[] check = request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK); for (int j = 0; j < check.length; ++j) { url.addParameter(PARAMETER_FOLDER_HTML_CHECK, check[j]); } } if (request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK_IMPRESSION) != null) { String[] check = request.getParameterValues(PARAMETER_FOLDER_HTML_CHECK_IMPRESSION); for (int j = 0; j < check.length; ++j) { url.addParameter(PARAMETER_FOLDER_HTML_CHECK_IMPRESSION, check[j]); } } Object[] args = { folderTitle }; Folder folder = _folderServices.findForTestTitle(folderTitle); if ((folder != null) && !folder.getTitle().equals(request.getParameter(PARAMETER_FOLDER_TITLE_OLD))) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_FOLDER_CREATE, args, AdminMessage.TYPE_STOP); } if (request instanceof MultipartHttpServletRequest) { MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; FileItem fileItem = multipartRequest.getFile(PARAMETER_FOLDER_IMAGE); if (fileItem.getSize() > 0) { String name = fileItem.getName(); String type = name.substring(name.lastIndexOf(".")); if (!type.equalsIgnoreCase(".jpg") && !type.equalsIgnoreCase(".png") && !type.equalsIgnoreCase(".gif")) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_FOLDER_IMAGE_TYPE, args, AdminMessage.TYPE_STOP); } PhysicalFile physicalFile = new PhysicalFile(); physicalFile.setValue(fileItem.get()); _folderImage.setImg(physicalFile.getValue()); _folderImage.setNomImage(fileItem.getName()); } } return AdminMessageService.getMessageUrl(request, MESSAGE_CONFIRM_CORRECT_FOLDER, args, url.getUrl(), AdminMessage.TYPE_CONFIRMATION); }
From source file:fr.paris.lutece.plugins.plu.web.PluJspBean.java
/** * Generates a message of confirmation for create a new atome * @param request the Http request//from w w w .j av a 2s. co m * @return message */ public String getConfirmCreateAtome(HttpServletRequest request) { if (request.getParameter(PARAMETER_FOLDER_ID_ATOME) == null) { return AdminMessageService.getMessageUrl(request, MESSAGE_ERROR_REQUIRED_FIELD, AdminMessage.TYPE_STOP); } if (request.getParameter(PARAMETER_FOLDER_ID_ATOME).equals("") || request.getParameter(PARAMETER_ATOME_NUM).equals("") || request.getParameter(PARAMETER_VERSION_NUM).equals("") || request.getParameter(PARAMETER_ATOME_NAME).equals("") || request.getParameter(PARAMETER_ATOME_TITLE).equals("") || request.getParameter(PARAMETER_ATOME_NAME).matches("[ \']+?") || request.getParameter(PARAMETER_ATOME_TITLE).matches("[ \']+?") || request.getParameterValues(PARAMETER_FILE_CHECK) == null) { return this.getMessageJsp(request, MESSAGE_ERROR_REQUIRED_FIELD, null, JSP_CREATE_ATOME, null); } int nIdAtome = 0; int numVersion = 0; try { nIdAtome = Integer.parseInt(request.getParameter(PARAMETER_ATOME_NUM)); } catch (NumberFormatException e) { return this.getMessageJsp(request, MESSAGE_ERROR_ATOME_ID_NUMBER, null, JSP_CREATE_ATOME, null); } try { numVersion = Integer.parseInt(request.getParameter(PARAMETER_VERSION_NUM)); } catch (NumberFormatException e) { return this.getMessageJsp(request, MESSAGE_ERROR_VERSION_NUMBER, null, JSP_CREATE_ATOME, null); } int nIdPlu = Integer.parseInt(request.getParameter(PARAMETER_PLU_ID)); int nIdFolder = Integer.parseInt(request.getParameter(PARAMETER_FOLDER_ID_ATOME)); String atomeName = request.getParameter(PARAMETER_ATOME_NAME); String atomeTitle = request.getParameter(PARAMETER_ATOME_TITLE); String atomeDescription = request.getParameter(PARAMETER_ATOME_DESCRIPTION); String[] check = request.getParameterValues(PARAMETER_FILE_CHECK); String[] fileTitle = request.getParameterValues(PARAMETER_FILE_TITLE_ATOME); Object[] argsAtome = { atomeName, atomeTitle }; if (check == null) { return this.getMessageJsp(request, MESSAGE_ERROR_ATOME_CREATE_FILE_CHECK, null, JSP_CREATE_ATOME, null); } UrlItem url = new UrlItem(JSP_DO_CREATE_ATOME); url.addParameter(PARAMETER_PLU_ID, nIdPlu); url.addParameter(PARAMETER_FOLDER_ID_ATOME, nIdFolder); url.addParameter(PARAMETER_ATOME_NUM, nIdAtome); url.addParameter(PARAMETER_VERSION_NUM, numVersion); try { url.addParameter(PARAMETER_ATOME_NAME, URIUtil.encodeAll(atomeName)); url.addParameter(PARAMETER_ATOME_TITLE, URIUtil.encodeAll(atomeTitle)); // url.addParameter( PARAMETER_ATOME_DESCRIPTION, URIUtil.encodeAll( // atomeDescription ) ); } catch (URIException e) { throw new AppException("An error occured while parsing request parameters"); } // save description into session because it's too large for url request.getSession().setAttribute(PARAMETER_ATOME_DESCRIPTION, atomeDescription); for (Atome atome : _atomeServices.findAll()) { if (atome.getId() == nIdAtome) { return this.getMessageJsp(request, MESSAGE_ERROR_ATOME_CREATE_ID, argsAtome, JSP_CREATE_ATOME, null); } if (atome.getName().equals(atomeName)) { return this.getMessageJsp(request, MESSAGE_ERROR_ATOME_CREATE_NAME, argsAtome, JSP_CREATE_ATOME, null); } if (atome.getTitle().equals(atomeTitle)) { return this.getMessageJsp(request, MESSAGE_ERROR_ATOME_CREATE_TITLE, argsAtome, JSP_CREATE_ATOME, null); } } for (int j = 0; j < check.length; ++j) { url.addParameter(PARAMETER_FILE_CHECK, check[j]); } for (int j = 0; j < fileTitle.length; ++j) { url.addParameter(PARAMETER_FILE_TITLE_ATOME, fileTitle[j]); } // Check atome's file String confirmFile = ""; confirmFile = getConfirmAtomeFile(request, numVersion, atomeName, atomeTitle, check, fileTitle, JSP_CREATE_ATOME); if (StringUtils.isNotEmpty(confirmFile)) { return confirmFile; } return this.getMessageJsp(request, MESSAGE_CONFIRM_CREATE_ATOME, argsAtome, JSP_CREATE_ATOME, url.getUrl()); }