Package javax.faces.context

Examples of javax.faces.context.FacesContext.addMessage()


                try {
                    FileInputStream in = new FileInputStream(f);
                    in.read(buf);
                    in.close();
                } catch (IOException e) {
                  context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.csrcert.uploadfailed"), null));
                  log.debug("Rejected uploaded file due to IOException.");
                  return;
        }
                try {
                    // See if it was a PEM
View Full Code Here


                }
                // See if it as a PKCS10
                try {
                    new PKCS10CertificationRequest(buf);
                } catch (Exception e) {
                  context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.csrcert.uploadfailednotpkcs10"), null));
                  log.debug("Rejected uploaded file since it's not a valid PKCS#10 request.");
                  return;
                }
              // Convert it back to a PEM
                String pem = PEM_CSR_BEGIN + "\n" + new String(Base64.encode(buf)) + "\n" + PEM_CSR_END;
View Full Code Here

                  return;
                }
              // Convert it back to a PEM
                String pem = PEM_CSR_BEGIN + "\n" + new String(Base64.encode(buf)) + "\n" + PEM_CSR_END;
                certificateRequest = pem;
              context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_INFO, getMessage("enroll.csrcert.uploadok"), null));
            } else {
              context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.csrcert.uploadfailedtoolarge"), null));
            }
        } else {
          log.debug("File upload failed: " + inputFile.getFileInfo().getException().getMessage());
View Full Code Here

              // Convert it back to a PEM
                String pem = PEM_CSR_BEGIN + "\n" + new String(Base64.encode(buf)) + "\n" + PEM_CSR_END;
                certificateRequest = pem;
              context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_INFO, getMessage("enroll.csrcert.uploadok"), null));
            } else {
              context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.csrcert.uploadfailedtoolarge"), null));
            }
        } else {
          log.debug("File upload failed: " + inputFile.getFileInfo().getException().getMessage());
        context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.csrcert.uploadfailed"), null));
        }
View Full Code Here

            } else {
              context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.csrcert.uploadfailedtoolarge"), null));
            }
        } else {
          log.debug("File upload failed: " + inputFile.getFileInfo().getException().getMessage());
        context.addMessage(null /*actionEvent.getComponent().getClientId(context)*/, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.csrcert.uploadfailed"), null));
        }
  }
 
  /**
   * Action that requests a KeyStore from EJBCA using the given credentials.
View Full Code Here

   */
  public void createKeystore() {
    log.info("Recieved a KeyStore request for username '" + username + "' from " + getRemoteAddress());
    FacesContext context = FacesContext.getCurrentInstance();
    if (username==null || username.length()==0 || password==null || password.length()==0) {
      context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.incompletefields"), null));
      return;
    }
    // Request the KeyStore from the CA
    ResponseData keyStoreResponse = getRequestDispatcher().getKeyStoreResponse(username, password);
    // Check if got a valid result
View Full Code Here

    }
    // Request the KeyStore from the CA
    ResponseData keyStoreResponse = getRequestDispatcher().getKeyStoreResponse(username, password);
    // Check if got a valid result
    if (keyStoreResponse == null) {
      context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.noresponse"), null));
      log.error("KeyStore request for '" + username + "' failed. No response from CA.");
      return;
    } else if (keyStoreResponse.getErrorMessage() != null) {
      context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.keystore.couldnotcreate"), null));
      log.info("KeyStore request for '" + username + "' failed. " + keyStoreResponse.getErrorMessage());
View Full Code Here

    if (keyStoreResponse == null) {
      context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.noresponse"), null));
      log.error("KeyStore request for '" + username + "' failed. No response from CA.");
      return;
    } else if (keyStoreResponse.getErrorMessage() != null) {
      context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.keystore.couldnotcreate"), null));
      log.info("KeyStore request for '" + username + "' failed. " + keyStoreResponse.getErrorMessage());
      return;
    }
    // Handle response
    resource = new ByteArrayResource(keyStoreResponse.getResponseData());
View Full Code Here

    if (log.isDebugEnabled()) {
      log.debug("certificateRequest: " + certificateRequest);
    }
    FacesContext context = FacesContext.getCurrentInstance();
    if (username==null || username.length()==0 || password==null || password.length()==0 || certificateRequest==null || certificateRequest.length()==0) {
      context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.incompletefields"), null));
      return;
    }
    // Verify that we got a valid Certificate Signing Request
    try {
          // Clean it up if windows has messed it up..
View Full Code Here

      if (log.isDebugEnabled()) {
              log.debug("cleaned req: " + certificateRequest);
      }
            new PKCS10CertificationRequest(buf);
    } catch (Exception e) {
      context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, getMessage("enroll.invalidreqdata"), null));
      return;
    }
    // Determine what kind of response the user has requested
    int responseType = CertificateRequestRequest.RESPONSE_TYPE_ENCODED;
    if ("pkcs7".equals(requestedResponseType)) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.