이 블로그 검색

2012년 1월 13일 금요일

Tokenizer

 @Prefix("edit")
  public static class Tokenizer implements PlaceTokenizer<TaskPlace> {

    private static final String NO_ID = "create";

    public TaskPlace getPlace(String token) {
      try {
        // Parse the task ID from the URL.
        Long taskId = Long.parseLong(token);
        return new TaskPlace(taskId, null);
      } catch (NumberFormatException e) {
        // If the ID cannot be parsed, assume we are creating a task.
        return TaskPlace.getTaskCreatePlace();
      }
    }

    public String getToken(TaskPlace place) {
      Long taskId = place.getTaskId();
      return (taskId == null) ? NO_ID : taskId.toString();
    }
  }




http://gwt-cloudtasks.appspot.com/#edit:create

prefix는 #뒤에 나오는 edit
getToken은 :뒤에 나오는 create

댓글 없음:

댓글 쓰기