Examples of SafeText


Examples of hirondelle.web4j.security.SafeText

  // PRIVATE //

  private void testCtorSuccess(String aId, String aName, Boolean aIsActive, String aDisposition) {
    Id id = (aId != null ? Id.from(aId) : null);
    SafeText name = (aName != null ? new SafeText(aName) : null);
    Id disposition = (aDisposition != null ? Id.from(aDisposition) : null);
    try {
      Member member = new Member(id, name, aIsActive, disposition);
    }
    catch (ModelCtorException ex) {
View Full Code Here

Examples of hirondelle.web4j.security.SafeText

    }
  }

  private void testCtorFailure(String aId, String aName, Boolean aIsActive, String aDisposition) {
    Id id = (aId != null ? Id.from(aId) : null);
    SafeText name = (aName != null ? new SafeText(aName) : null);
    Id disposition = (aDisposition != null ? Id.from(aDisposition) : null);
    try {
      Member member = new Member(id, name, aIsActive, disposition);
      fail("Unexpectedly succeeded in constructing Member.");
    }
View Full Code Here

Examples of hirondelle.web4j.security.SafeText

  
   <P>Also validates that the user is still logged in (just in case).
  */
  protected void validateUserInput() {
    //this method is unusual since more than one Model Object is constructed.
    SafeText userName = getLoggedInUserName();
    if( ! Util.textHasContent(userName.getRawString()) ){
      addError("Please log in.");
    }
    else {
      try {
        fOldUser = getUserFor(userName, OLD_PASSWORD);
View Full Code Here

Examples of hirondelle.web4j.security.SafeText

 
  private static final ResponsePage FORWARD = TemplatedPage.get("Change Password", "ChangePassword.jsp", ChangePasswordAction.class);
  private static final ResponsePage REDIRECT = new ResponsePage("ChangePasswordAction.show");

  private User getUserFor(SafeText aUserName, RequestParameter aPassword) throws ModelCtorException {
    SafeText password = getParam(aPassword);
    return User.forPasswordChange(aUserName, password);
  }
View Full Code Here

Examples of hirondelle.web4j.security.SafeText

  private static final ResponsePage REDIRECT =  new ResponsePage("ImageUploadAction.show");
  private static final Logger fLogger = Util.getLogger(ImageUploadAction.class);
 
  private void extractFileUploadFields(){
    HttpServletRequest request = getRequestParser().getRequest();
    SafeText description = getParam(DESCRIPTION);
   
    //note a cast is needed here to get the file-related data
    FileUploadWrapper wrappedRequest = (FileUploadWrapper)request;
    fFileItem = wrappedRequest.getFileItem(IMAGE_FILE.getName());
    fLogger.fine("Extracted Description: " + description);
View Full Code Here

Examples of hirondelle.web4j.security.SafeText

    return new Object[]{fDescription, fFileName, fFileContentType, fFileSize};
  }

  private static final class ValidateContentType implements Validator {
    public boolean isValid(Object aItem) {
      SafeText item = (SafeText)aItem;
      return CONTENT_TYPES.contains(item.getRawString());
    }
View Full Code Here

Examples of hirondelle.web4j.security.SafeText

    }
  }

  private static final class ValidateExtension implements Validator {
    public boolean isValid(Object aItem) {
      SafeText item = (SafeText)aItem;
      int lastPeriod = item.getRawString().lastIndexOf(".");
      String fileExtension = item.getRawString().substring(lastPeriod + 1);
      return EXTENSIONS.contains(fileExtension);
    }
View Full Code Here

Examples of hirondelle.web4j.security.SafeText

 
  //PRIVATE//
 
  private void testForSuccess(MemberDAO aMemberDAO) throws DAOException, ModelCtorException {
    //add
    Member memberOne = new Member(null, new SafeText("Bob Smithers"), Boolean.TRUE, Id.from("4") );
    Id idOne = aMemberDAO.add(memberOne);
   
    //fetch
    Member memberOneFetched = aMemberDAO.fetch(idOne);
    assertNotNull(memberOneFetched);
    assertTrue(memberOneFetched.equals(memberOne));
    //log("memberOneFetched: " + memberOneFetched);
   
    //change
    Member memberTwo = new Member(idOne, new SafeText("Bob Smitherspoon"), Boolean.TRUE, Id.from("4") );
    aMemberDAO.change(memberTwo);
    Member memberTwoFetched = aMemberDAO.fetch(idOne);
    assertNotNull(memberTwoFetched);
    assertTrue(! memberTwoFetched.equals(memberOne));
    assertTrue(memberTwoFetched.equals(memberTwo));
View Full Code Here

Examples of hirondelle.web4j.security.SafeText

    assertNull(memberTwoFetched);
  }
 
  private void testFakeForFailures(MemberDAO aMemberDAO) throws ModelCtorException, DAOException {
    //add
    Member memberOne = new Member(null, new SafeText("Bob Smithers"), Boolean.TRUE, Id.from("4") );
    try {
      Id id = aMemberDAO.add(memberOne);
      fail("Should have failed.");
    }
    catch(DuplicateException ex){
      //should happen - do nothing
    }
   
    //change
    Member memberTwo = new Member(Id.from("13"), new SafeText("Bob Smitherspoon"), Boolean.TRUE, Id.from("4") );
    try {
      aMemberDAO.change(memberTwo);
      fail("Should have failed.");
    }
    catch(DuplicateException ex){
View Full Code Here

Examples of hirondelle.web4j.security.SafeText

  // FIXTURE //

  protected void setUp() {
    try {
      VISIT_A = new Visit(Id.from("100"), Id.from("1"), new Date(107, 0, 1), new SafeText(
      "This is the day."));
      VISIT_B = new GentlemanCaller(Id.from("200"), Id.from("1"), new Date(107, 0, 1), new SafeText(
      "This is the day."));
    }
    catch (ModelCtorException ex) {
      // nothing...
    }
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.