Skip to content

Instantly share code, notes, and snippets.

@froop
Created February 18, 2012 01:29
Show Gist options
  • Save froop/1856756 to your computer and use it in GitHub Desktop.
Save froop/1856756 to your computer and use it in GitHub Desktop.
[Java][Servlet] RequestURLのContextPathまで
URL url = new URL(request.getRequestURL().toString());
String baseUrl = new URL(url.getProtocol(), url.getHost(), url.getPort(),
request.getContextPath()).toString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment