Example usage for javax.servlet.http HttpServletRequest getScheme

List of usage examples for javax.servlet.http HttpServletRequest getScheme

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest getScheme.

Prototype

public String getScheme();

Source Link

Document

Returns the name of the scheme used to make this request, for example, <code>http</code>, <code>https</code>, or <code>ftp</code>.

Usage

From source file:br.com.devopsnapratica.controller.account.LoginController.java

@Override
public String getResetPasswordUrl(HttpServletRequest request) {
    String url = request.getScheme() + "://" + request.getServerName()
            + getResetPasswordPort(request, request.getScheme() + "/");

    if (request.getContextPath() != null && !"".equals(request.getContextPath())) {
        url = url + request.getContextPath() + "/login/resetPassword";
    } else {/*  w ww  .j  a v a 2s .c om*/
        url = url + "/login/resetPassword";
    }
    return url;
}

From source file:org.apache.archiva.web.api.DefaultRuntimeInfoService.java

protected String getBaseUrl(HttpServletRequest req) {
    return req.getScheme() + "://" + req.getServerName()
            + (req.getServerPort() == 80 ? "" : ":" + req.getServerPort()) + req.getContextPath();
}

From source file:com.github.javarch.jsf.context.FacesContextUtils.java

/**
 * Retorna o caminho da aplicao, incluindo protocolo http.
 * //from   ww w .ja  v  a2  s  . c  o  m
 * @return Caminho da aplicao
 */
public String getApplicationPath() {
    HttpServletRequest request = getRequest();
    return request.getScheme() + "://" + request.getServerName()
            + (request.getServerPort() != 80 ? ":" + request.getServerPort() : "") + request.getContextPath();
}

From source file:company.gonapps.loghut.controller.LogoutController.java

@RequestMapping(value = "/logout.do", method = RequestMethod.GET)
public String logout(HttpServletRequest request) throws Exception {
    request.getSession(false).invalidate();
    return "redirect:" + request.getScheme() + "://" + request.getServerName()
            + getSettingDao().getSetting("admin.url") + "/login_form.do";
}

From source file:org.ow2.chameleon.everest.servlet.PathSerializer.java

public PathSerializer(HttpServletRequest request, String servletPath) {
    if (request != null) {
        m_server = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
                + servletPath;/*from w  w  w.j  a va  2 s.c  om*/
    } else {
        // No request, just keep the path as it is.
        m_server = "";
    }
}

From source file:org.stockwatcher.web.rss.BaseRssView.java

protected String getStockLink(HttpServletRequest request, String symbol) {
    StringBuilder link = new StringBuilder(request.getScheme());
    link.append("://");
    link.append(request.getServerName());
    link.append(":");
    link.append(request.getServerPort());
    link.append(request.getContextPath());
    link.append("/main/stocks/");
    link.append(symbol);//from   ww w.j  a v a  2 s .  c om
    return link.toString();
}

From source file:net.eusashead.hateoas.response.impl.PostResponseBuilderImpl.java

public PostResponseBuilderImpl(HttpServletRequest request) {
    super(request);

    // Set the root URL
    this.domain = request.getScheme() + "://" + request.getServerName();
}

From source file:be.fedict.eid.dss.sp.bean.SignatureRequestServiceBean.java

@Override
public String getSPDestination() {

    HttpServletRequest httpServletRequest = getHttpServletRequest();

    return httpServletRequest.getScheme() + "://" + httpServletRequest.getServerName() + ":"
            + httpServletRequest.getServerPort() + httpServletRequest.getContextPath() + "/dss-response";

    // return "../eid-dss-sp/dss-response";
}

From source file:com.atlassian.jira.web.action.setup.SetupSharedVariables.java

public String getBaseUrl() {
    final HttpServletRequest request = servletVariables.getHttpRequest();

    return request.getScheme() + "://localhost:" + request.getLocalPort() + request.getContextPath();
}

From source file:org.jm.spring.controller.EndpointDocumentationController.java

/**
 * Construct base path//from  w  w w  .j a va  2 s. co m
 * 
 * @param httpServletRequest
 * @return
 */
private String getBasePath(HttpServletRequest httpServletRequest) {
    String scheme = httpServletRequest.getScheme(); // http
    String serverName = httpServletRequest.getServerName(); // hostname.com
    int serverPort = httpServletRequest.getServerPort(); // 80

    StringBuffer basePath = new StringBuffer();
    basePath.append(scheme).append("://").append(serverName);
    if (serverPort != 80) {
        basePath.append(":").append(serverPort);
    }
    return basePath.toString();
}