All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.yammer.dropwizard.util.Servlets Maven / Gradle / Ivy

There is a newer version: 0.6.2
Show newest version
package com.yammer.dropwizard.util;

import javax.servlet.http.HttpServletRequest;

/**
 * Utility functions for dealing with servlets.
 */
public class Servlets {
    private Servlets() { /* singleton */ }

    /**
     * Returns the full URL of the given request.
     *
     * @param request    an HTTP servlet request
     * @return the full URL, including the query string
     */
    public static String getFullUrl(HttpServletRequest request) {
        final StringBuilder url = new StringBuilder(100).append(request.getRequestURI());
        if (request.getQueryString() != null) {
            url.append('?').append(request.getQueryString());
        }
        return url.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy