Package com.gwtplatform.mvp.shared.proxy

Examples of com.gwtplatform.mvp.shared.proxy.TokenFormatException


  private PlaceRequest unescapedToPlaceRequest(String unescapedPlaceToken) throws TokenFormatException {
    PlaceRequest req = null;

    int split = unescapedPlaceToken.indexOf(paramSeparator);
    if (split == 0) {
      throw new TokenFormatException("Place history token is missing.");
    } else if (split == -1) {
      req = new PlaceRequest(unescapedPlaceToken);
    } else if (split >= 0) {
      req = new PlaceRequest(unescapedPlaceToken.substring(0, split));
      String paramsChunk = unescapedPlaceToken.substring(split + 1);
      String[] paramTokens = paramsChunk.split(paramSeparator);
      for (String paramToken : paramTokens) {
        if (paramToken.isEmpty()) {
          throw new TokenFormatException("Bad parameter: Successive parameters require a single '" + paramSeparator + "' between them.");
        }
        String[] param = splitParamToken(paramToken);
        String key = paramValueUnescape(param[0]);
        String value = paramValueUnescape(param[1]);
        req = req.with(key, value);
View Full Code Here


  public List<PlaceRequest> toPlaceRequestHierarchy(String historyToken) throws TokenFormatException {
    historyToken = URL.decodeQueryString(historyToken);

    int split = historyToken.indexOf(hierarchySeparator);
    if (split == 0) {
      throw new TokenFormatException("Place history token is missing.");
    } else {
      List<PlaceRequest> result = new ArrayList<PlaceRequest>();
      if (split == -1) {
        result.add(unescapedToPlaceRequest(historyToken)); // History token consists of a single place token
      } else {
        String[] placeTokens = historyToken.split(hierarchySeparator);
        for (String placeToken : placeTokens) {
          if (placeToken.isEmpty()) {
            throw new TokenFormatException("Bad parameter: Successive place tokens require a single '" + hierarchySeparator + "' between them.");
          }
          result.add(unescapedToPlaceRequest(placeToken));
        }
      }
      return result;
View Full Code Here

  private String[] splitParamToken(String paramToken) {
    String[] param = paramToken.split(valueSeparator, 2);
    if (param.length == 1 // pattern didn't match
        || param[0].contains(valueSeparator) // un-escaped separator encountered in the key
        || param[1].contains(valueSeparator)) { // un-escaped separator encountered in the value
      throw new TokenFormatException("Bad parameter: Parameters require a single '" + valueSeparator + "' between the key and value.");
    }
    return param;
  }
View Full Code Here

TOP

Related Classes of com.gwtplatform.mvp.shared.proxy.TokenFormatException

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.