URL matrix parameters vs. query parameters

I’m wondering whether to use matrix or query parameters in my URLs. I found an older discussion to that topic not satisfying. Examples URL with query params: http://some.where/thing?paramA=1&paramB=6542 URL with matrix params: http://some.where/thing;paramA=1;paramB=6542 At first sight matrix params seem to have only advantages: more readable no encoding and decoding of “&” in XML documents is … Read more

How to use a servlet filter in Java to change an incoming servlet request url?

How can I use a servlet filter to change an incoming servlet request url from http://nm-java.appspot.com/Check_License/Dir_My_App/Dir_ABC/My_Obj_123 to http://nm-java.appspot.com/Check_License?Contact_Id=My_Obj_123 ? Update: according to BalusC’s steps below, I came up with the following code: public class UrlRewriteFilter implements Filter { @Override public void init(FilterConfig config) throws ServletException { // } @Override public void doFilter(ServletRequest req, ServletResponse res, … Read more

What are the safe characters for making URLs?

I am making a website with articles, and I need the articles to have “friendly” URLs, based on the title. For example, if the title of my article is “Article Test”, I would like the URL to be http://www.example.com/articles/article_test. However, article titles (as any string) can contain multiple special characters that would not be possible … Read more

Detect URLs in text with JavaScript

Does anyone have suggestions for detecting URLs in a set of strings? arrayOfStrings.forEach(function(string){ // detect URLs in strings and do something swell, // like creating elements with links. }); Update: I wound up using this regex for link detection… Apparently several years later. kLINK_DETECTION_REGEX = /(([a-z]+:\/\/)?(([a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&]*)?)?(#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(\s+|$)/gi The full helper (with optional Handlebars support) is at … Read more

URL to load resources from the classpath in Java

In Java, you can load all kinds of resources using the same API but with different URL protocols: file:///tmp.txt jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class This nicely decouples the actual loading of the resource from the application that needs the resource, and since a URL is just a String, resource loading is also very easily configurable. Is there a … Read more