private String getBaseUrl() { return HttpUtil.getCompleteUrl(requestProvider.get()); }
/** * Return the request uri with out the context path. * * * @param request - the http client request * * @return the request uri with out the context path */ public static String getStrippedURI(HttpServletRequest request) { return getStrippedURI(request, request.getRequestURI()); }
/** * Method description * * * @return */ @Override public String getEncryptUrl() { return HttpUtil.append(baseUrl, PATH_ENCRYPT); }
/** * Send an unauthorized header back to the client * * * @param response - the http response * * @throws IOException */ public static void sendUnauthorized(HttpServletResponse response) throws IOException { sendUnauthorized(null, response, AUTHENTICATION_REALM); }
if (isForwarded(request)) baseUrl = createForwardedBaseUrl(request); baseUrl = createBaseUrl(request); baseUrl = append(baseUrl, ps);
/** * Method description * * * @param request * * @return */ public static boolean isSvnClient(HttpServletRequest request) { return HttpUtil.userAgentStartsWith(request, USERAGENT_SVN); }
/** * Constructs ... * * * @param baseUrl * @param component */ public WUIModelUrlProvider(String baseUrl, String component) { this.url = HttpUtil.appendHash(baseUrl, component); }
/** * Send an unauthorized header back to the client * * * @param request http request * @param response http response * * @throws IOException */ public static void sendUnauthorized(HttpServletRequest request, HttpServletResponse response) throws IOException { sendUnauthorized(request, response, AUTHENTICATION_REALM); }
if (isForwarded(request)) baseUrl = createForwardedBaseUrl(request); baseUrl = createBaseUrl(request); baseUrl = append(baseUrl, ps);
/** * Returns true if the request comes from a mercurial client. * * * @param request servlet request * * @return true if the client is mercurial */ public static boolean isHgClient(HttpServletRequest request) { return HttpUtil.userAgentStartsWith(request, USERAGENT_HG); } }
/** * Method description * * * @return */ @Override public String getConfigUrl() { return HttpUtil.appendHash(baseUrl, COMPONENT_CONFIG); }
/** * Build the complete URI, under which the File Transfer API for this repository will be will be reachable. * * @param repository The repository to build the File Transfer URI for. * @param request The request to construct the complete URI from. */ @VisibleForTesting static String buildBaseUri(Repository repository, HttpServletRequest request) { return String.format("%s/git/%s.git/info/lfs/objects/", HttpUtil.getCompleteUrl(request), repository.getName()); }
/** * Method description * * * @return */ @Override public String getGenerateKeyUrl() { return HttpUtil.append(baseUrl, PATH_KEY); }
/** * Send an unauthorized header back to the client * * * @param response - the http response * * @throws IOException */ public static void sendUnauthorized(HttpServletResponse response) throws IOException { sendUnauthorized(null, response, AUTHENTICATION_REALM); }
/** * Return the request uri with out the context path. * * * @param request - the http client request * * @return the request uri with out the context path */ public static String getStrippedURI(HttpServletRequest request) { return getStrippedURI(request, request.getRequestURI()); }
/** * Method description * * * @return */ @Override public String getConfigUrl() { return HttpUtil.appendHash(baseUrl, COMPONENT_CONFIG); }
/** * Returns the repository root help url. * * * @param request current http request * * @return repository root help url */ private String getRepositoryRootHelpUrl(HttpServletRequest request) { String type = extractType(request); String helpUrl = HttpUtil.getCompleteUrl(request, "/api/rest/help/repository-root/"); helpUrl = helpUrl.concat(type).concat(".html"); return helpUrl; }
/** * Constructs ... * * * @param baseUrl */ public WUIUrlProvider(String baseUrl) { this.baseUrl = HttpUtil.append(baseUrl, PART_INDEX); }
/** * Send an unauthorized header back to the client * * * @param request http request * @param response http response * * @throws IOException */ public static void sendUnauthorized(HttpServletRequest request, HttpServletResponse response) throws IOException { sendUnauthorized(request, response, AUTHENTICATION_REALM); }
private boolean isRegularGitAPIRequest(HttpServletRequest request) { return REGEX_GITHTTPBACKEND.matcher(HttpUtil.getStrippedURI(request)).matches(); }