org.wso2.carbon.ui.CarbonUIMessage Java Examples
The following examples show how to use
org.wso2.carbon.ui.CarbonUIMessage.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JrxmlFileUploadExecutor.java From carbon-commons with Apache License 2.0 | 5 votes |
private void buildUIError(HttpServletRequest request, HttpServletResponse response, String webContext, String errorRedirect, String msg) throws IOException { CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, request); if (errorRedirect == null) { response.sendRedirect( "../" + webContext + "/admin/error.jsp"); } else { response.sendRedirect( "../" + webContext + "/" + errorRedirect + (errorRedirect.indexOf("?") == -1 ? "?" : "&") + "msg=" + URLEncoder.encode(msg, "UTF-8")); } }
Example #2
Source File: AbstractFileUploadExecutor.java From attic-stratos with Apache License 2.0 | 5 votes |
private void sendErrorRedirect(HttpServletRequest request, HttpServletResponse response, Exception e) throws IOException { String errorRedirectionPage = getErrorRedirectionPage(); if (errorRedirectionPage != null) { CarbonUIMessage.sendCarbonUIMessage(e.getMessage(), CarbonUIMessage.ERROR, request, response, errorRedirectionPage); //TODO: error msg i18n } else { throw new IOException("Could not send error. " + "Please define the errorRedirectionPage in your UI page. " + e.getMessage()); } }
Example #3
Source File: CarbonAppUploadExecutor.java From carbon-commons with Apache License 2.0 | 4 votes |
protected boolean uploadArtifacts(HttpServletRequest request, HttpServletResponse response, String uploadDirName, String[] extensions, String utilityString) throws IOException { response.setContentType("text/html; charset=utf-8"); String webContext = (String) request.getAttribute(CarbonConstants.WEB_CONTEXT); String serverURL = (String) request.getAttribute(CarbonConstants.SERVER_URL); String cookie = (String) request.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE); String msg; Map<String, ArrayList<FileItemData>> fileItemsMap = getFileItemsMap(); if (fileItemsMap == null || fileItemsMap.isEmpty()) { msg = "File uploading failed. No files are specified"; log.error(msg); CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, request, response, getContextRoot(request) + "/" + webContext + "/carbonapps/app_upload.jsp"); } //Creating the stub to call the back-end service CarbonAppUploaderClient uploaderClient = new CarbonAppUploaderClient( configurationContext, serverURL + "CarbonAppUploader", cookie); try { for (Object o : fileItemsMap.keySet()) { String fieldName = (String) o; FileItemData fileItemData = fileItemsMap.get(fieldName).get(0); String fileName = getFileName(fileItemData.getFileItem().getName()); uploaderClient.addUploadedFileItem(fileItemData.getDataHandler(), fileName, "jar"); } //Uploading files to back end service uploaderClient.uploadFileItems(); msg = "Your Application has been uploaded successfully. Please refresh this page in a" + " while to see the status of the new Application."; CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.INFO, request, response, getContextRoot(request) + "/" + webContext + "/carbonapps/index.jsp" ); return true; } catch (Exception e) { msg = "File upload failed."; log.error(msg, e); CarbonUIMessage.sendCarbonUIMessage(msg, CarbonUIMessage.ERROR, request, response, getContextRoot(request) + "/" + webContext + "/carbonapps/app_upload.jsp"); } return false; }