Пример #1
0
  @Override
  public Url mapHandler(final IRequestHandler requestHandler) {
    final Url url = wrappedMapper.mapHandler(requestHandler);

    if (url == null) {
      return null;
    }

    return encryptUrl(url);
  }
Пример #2
0
  /**
   * Creates a url for the handler. Modifies it with the correct {@link Scheme} if necessary.
   *
   * @param handler
   * @param request
   * @return url
   */
  final Url mapHandler(IRequestHandler handler, Request request) {
    Url url = delegate.mapHandler(handler);

    Scheme desired = getDesiredSchemeFor(handler);
    Scheme current = getSchemeOf(request);
    if (!desired.isCompatibleWith(current)) {
      // the generated url does not have the correct scheme, set it (which in turn will cause
      // the url to be rendered in its full representation)
      url.setProtocol(desired.urlName());
      if (url.getPort() != null || !desired.usesStandardPort(config)) {
        url.setPort(desired.getPort(config));
      }
    }
    return url;
  }
Пример #3
0
 /**
  * Returns URL for the request handler or <code>null</code> if the handler couldn't have been
  * encoded.
  *
  * @param handler
  * @return Url instance or <code>null</code>
  */
 public Url mapUrlFor(IRequestHandler handler) {
   final Url url = requestMapper.mapHandler(handler);
   listeners.onUrlMapped(this, handler, url);
   return url;
 }