Package foo.domaintest.action.HttpErrorException

Examples of foo.domaintest.action.HttpErrorException.BadRequestException


    if (tokenParam == null) {
      token = lazyRandomToken.get();
    } else if (memcache.load(new Key(TOKEN, tokenParam)) != null) {
      token = tokenParam;
    } else {
      throw new BadRequestException("Invalid token");
    }
    // For safety we truncate all string fields so that an attacker can't blow out our memcache.
    Map<String, Object> params = new HashMap<>();
    params.put("status", status);
    params.put("sleepSeconds", sleepSeconds);
View Full Code Here


  @Inject TempUrlFactory tempUrlFactory;

  @Override
  public void run() {
    if (!presentedApiKey.equals(requiredApiKey)) {
      throw new BadRequestException("Invalid API key");
    }
    Iterable<String> subjectWords = Splitter
        .on(CharMatcher.WHITESPACE)
        .omitEmptyStrings()
        .trimResults()
View Full Code Here

  }

  public Response setStatus(Integer status) {
    if (status != null
        && (status < MIN_STATUS_CODE || status > MAX_STATUS_CODE)) {
      throw new BadRequestException("Invalid status code (must be >= 200 and < 500)");
    }
    this.status = status;
    return this;
  }
View Full Code Here

  }

  public Response setSleepSeconds(Integer sleepSeconds) {
    if (sleepSeconds != null
        && (sleepSeconds < 0 || sleepSeconds > MAX_SLEEP_SECONDS)) {
      throw new BadRequestException("Invalid sleep seconds (must be >= 0 and <= 10)");
    }
    this.sleepSeconds = sleepSeconds;
    return this;
  }
View Full Code Here

    try {
      Cookie cookie = new Cookie(name, value);
      cookie.setMaxAge(maxAge);
      servletResponse.addCookie(cookie);
    } catch (IllegalArgumentException e) {
      throw new BadRequestException("Illegal cookie", e);
    }
  }
View Full Code Here

      try {
        servletResponse.setHeader(LOCATION, payload.isEmpty()
            ? "/"
            : new URL(payload).toString());
      } catch (MalformedURLException e) {
        throw new BadRequestException("Invalid redirect url", e);
      }
      servletResponse.setHeader(CONNECTION, "close");
    } else {
      servletResponse.setContentType(mimeType);
      try {
View Full Code Here

TOP

Related Classes of foo.domaintest.action.HttpErrorException.BadRequestException

Copyright © 2018 www.massapicom. 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.