Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- URL url = new URL("http://foo.bar");
- URLConnection conn = url.openConnection();
- // use the connection
- }
- catch (Exception e) {
- // any clean up here?
- }
- /**
- * rewriting for static resources
- *
- * @param path the path, with the leading /
- */
- public static String stat(final String path) {
- try {
- final URL resource = ServletActionContext.getServletContext().getResource(path);
- final URLConnection connection = resource.openConnection();
- final long l = connection.getLastModified();
- return STATIC_CONTENT_PREFIX + path + "?" + l;
- } catch (MalformedURLException e) {
- throw new RuntimeException(e);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
Add Comment
Please, Sign In to add comment