relative-url

Is Java's URI.resolve incompatible with RFC 3986 when the relative URI contains an empty path?

余生颓废 提交于 2019-11-30 17:39:33
I believe the definition and implementation of Java's URI.resolve method is incompatible with RFC 3986 section 5.2.2 . I understand that the Java API defines how that method works, and if it were changed now it would break existing apps, but my question is this: Can anyone confirm my understanding that this method is incompatible with RFC 3986? I'm using the example from this question: java.net.URI resolve against only query string , which I will copy here: I'm trying to build URI's using the JDK java.net.URI. I want to append to an absolute URI object, a query (in String). In example: URI

relative link for directory above

妖精的绣舞 提交于 2019-11-30 17:07:34
问题 I've got a file structure like so Root -index.html -adirectory ->fileinthedirectory.html I'd like to create a relative link from fileinthedirectory.html to index.html since /index.html links to /adirectory/index.html which doesn't exist. 回答1: To go up one directory you can use: ../index.html or you can start the URL with a slash to start from the root /index.html 来源: https://stackoverflow.com/questions/4648438/relative-link-for-directory-above

Loading external HTML page with relative paths into a DIV using jQuery

落爺英雄遲暮 提交于 2019-11-30 10:51:07
I am relatively new to jQuery and pardon if this question is too simple, but I've searched numerous threads for hours and cannot find a definite solution. I have the following folder structure: /index.html /html/pages/page1.html /html/pages/images/ /html/pages/css/ /html/pages/js/ /html/pages/includes/ I am trying to load page1.html into a DIV in index.html in the following basic way: $('#content').load('html/pages/page1.html', function () { console.log('loaded'); }); page1.html loads fine, however, it consists of multiple includes and all the content in it (images, CSS, JS, etc.) is relative

Is Java's URI.resolve incompatible with RFC 3986 when the relative URI contains an empty path?

感情迁移 提交于 2019-11-30 01:33:01
问题 I believe the definition and implementation of Java's URI.resolve method is incompatible with RFC 3986 section 5.2.2. I understand that the Java API defines how that method works, and if it were changed now it would break existing apps, but my question is this: Can anyone confirm my understanding that this method is incompatible with RFC 3986? I'm using the example from this question: java.net.URI resolve against only query string, which I will copy here: I'm trying to build URI's using the

Loading external HTML page with relative paths into a DIV using jQuery

大城市里の小女人 提交于 2019-11-29 15:17:55
问题 I am relatively new to jQuery and pardon if this question is too simple, but I've searched numerous threads for hours and cannot find a definite solution. I have the following folder structure: /index.html /html/pages/page1.html /html/pages/images/ /html/pages/css/ /html/pages/js/ /html/pages/includes/ I am trying to load page1.html into a DIV in index.html in the following basic way: $('#content').load('html/pages/page1.html', function () { console.log('loaded'); }); page1.html loads fine,

Building an absolute URL from a relative URL in Java

佐手、 提交于 2019-11-27 14:41:10
I'm having trouble building an absolute URL from a relative URL without resorting to String hackery... Given http://localhost:8080/myWebApp/someServlet Inside the method: public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } What's the most "correct" way of building : http://localhost:8080/myWebApp/someImage.jpg (Note, must be absolute, not relative) Currently, I'm doing it through building the string, but there MUST be a better way. I've looked at various combinations of new URI / URL, and I end up with http://localhost

How to get “raw” href contents in JavaScript

本小妞迷上赌 提交于 2019-11-26 22:36:57
I am trying to write a GreaseMonkey script in which I want to find all of the links that are relative links. It seemed to me that the way to do that would be to match the contents of href against /^https?:/// . But I find that when I access the anchor's href attribute, it's always normalized or cooked into a form that contains "http". That is, if the HTML contains: <a id="rel" href="/relative/link">inner</a> accessing document.getElementById("rel").href returns http://example.com/relative/link How can I access the raw data in the href attribute? Alternately, is there a better way to find

Building an absolute URL from a relative URL in Java

天涯浪子 提交于 2019-11-26 22:24:20
问题 I'm having trouble building an absolute URL from a relative URL without resorting to String hackery... Given http://localhost:8080/myWebApp/someServlet Inside the method: public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } What's the most "correct" way of building : http://localhost:8080/myWebApp/someImage.jpg (Note, must be absolute, not relative) Currently, I'm doing it through building the string, but there MUST be a

Why use protocol-relative URLs at all?

可紊 提交于 2019-11-26 18:55:45
It's been an oft-discussed question on StackOverflow what this means: <script src="//cdn.example.com/somewhere/something.js"></script> This gives the advantage that if you're accessing it over HTTPS, you get HTTPS automatically, instead of that scary "Insecure elements on this page" warning. But why use protocol-relative URLs at all? Why not simply use HTTPS always in CDN URLs? After all, an HTTP page has no reason to complain if you decide to load some parts of it over HTTPS. (This is more specifically for CDNs; almost all CDNs have HTTPS capability. Whereas, your own server may not

Two forward slashes in a url/src/href attribute [duplicate]

大憨熊 提交于 2019-11-26 10:16:37
Possible Duplicate: URI starting with two slashes … how do they behave? Absolute URLs omitting the protocol (scheme) in order to preserve the one of the current page shorthand as // for script and link tags? anyone see / use this before? I was looking through the source of HTML5 Reset when I noticed the following line : <script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> Why does the URL start with two forward slashes? Is this a shorthand for http:// ? The "two forward slashes" are a common shorthand for "whatever protocol is being used right now". Best known as