Do I really need to encode ‘&’ as ‘&’?

I’m using an ‘&‘ symbol with HTML5 and UTF-8 in my site’s <title>. Google shows the ampersand fine on its SERPs, as do all the browsers in their titles. http://validator.w3.org is giving me this: & did not start a character reference. (& probably should have been escaped as &amp;.) Do I really need to do … Read more

What is the best Java email address validation method? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 4 years ago. Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting … Read more

Cross field validation with Hibernate Validator (JSR 303)

Is there an implementation of (or third-party implementation for) cross field validation in Hibernate Validator 4.x? If not, what is the cleanest way to implement a cross field validator? As an example, how can you use the API to validate two bean properties are equal (such as validating a password field matches the password verify … Read more

How can I manually set an Angular form field as invalid?

I am working on a login form and if the user enters invalid credentials we want to mark both the email and password fields as invalid and display a message that says the login failed. How do I go about setting these fields to be invalid from an observable callback? Template: <form #loginForm=”ngForm” (ngSubmit)=”login(loginForm)” id=”loginForm”> … Read more

What’s an appropriate HTTP status code to return by a REST API service for a validation failure?

I’m currently returning 401 Unauthorized whenever I encounter a validation failure in my Django/Piston based REST API application. Having had a look at the HTTP Status Code Registry I’m not convinced that this is an appropriate code for a validation failure, what do y’all recommend? 400 Bad Request 401 Unauthorized 403 Forbidden 405 Method Not … Read more

Which characters make a URL invalid?

Which characters make a URL invalid? Are these valid URLs? example.com/file[/].html http://example.com/file[/].html 10 s 10 In general URIs as defined by RFC 3986 (see Section 2: Characters) may contain any of the following 84 characters: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;= Note that this list doesn’t state where in the URI these characters may occur. Any other character needs to … Read more