Example usage for org.apache.wicket.request Url setProtocol

List of usage examples for org.apache.wicket.request Url setProtocol

Introduction

In this page you can find the example usage for org.apache.wicket.request Url setProtocol.

Prototype

public void setProtocol(final String protocol) 

Source Link

Document

Sets the protocol of this url (http/https/etc)

Usage

From source file:com.mastfrog.acteur.wicket.adapters.RequestAdapter.java

License:Open Source License

@Inject
public RequestAdapter(HttpEvent evt, Locale locale, Charset charset, Settings settings) {
    this.evt = evt;
    this.locale = locale;
    this.charset = charset;
    String filterPrefix = settings.getString(PathFactory.BASE_PATH_SETTINGS_KEY, "");
    String uri = evt.getRequest().getUri();
    // Adapted from ServletWebRequest's constructor
    if (filterPrefix.length() > 0 && !filterPrefix.endsWith("/")) {
        filterPrefix += "/";
    }//from   w  w w. j av a 2 s .  c o  m
    StringBuilder sb = new StringBuilder();
    uri = Strings.stripJSessionId(uri);
    String contextPath = "";
    final int start = contextPath.length() + filterPrefix.length() + 1;
    if (uri.length() > start) {
        sb.append(uri.substring(start));
    }

    Url url = Url.parse(sb.toString(), charset, false);
    url.setPort(settings.getInt(ServerModule.PORT));
    String host = evt.getHeader(Headers.HOST);
    if (host != null) {
        url.setHost(host);
    } else {
        url.setHost(settings.getString(PathFactory.HOSTNAME_SETTINGS_KEY, "localhost"));
    }
    url.setProtocol("http");
    this.url = url;
}

From source file:org.artifactory.webapp.wicket.application.ArtifactoryWebRequest.java

License:Apache License

private Url setParameters(Url url) {
    url.setPort(httpServletRequest.getServerPort());
    url.setHost(httpServletRequest.getServerName());
    url.setProtocol(httpServletRequest.getScheme());
    return url;/*  w  ww  .  j  a v  a2  s .co  m*/
}

From source file:org.opensingular.lib.wicket.util.application.HttpsOnlyRequestMapper.java

License:Apache License

private Url toHttps(Url url) {
    if (url != null) {
        url.setProtocol(Scheme.HTTPS.urlName());
    }
    return url;
}