java - Case-insensitive URLs with JAX-RS -


is there easy way provide case-insensitive urls in jax-rs web service? goal of produce web service "lenient acceptor."1

i imagine it's possible filter .to[lower|upper]case()s incoming urls. unfortunately, implementation demands programmer discipline/consistency in making sure all hard-coded url strings in application strictly [lower|upper]case.
also, don't yet know jax-rs analog servlet filter.

if matters, i'm using jersey jax-rs implementation.


1as in, "be lenient in accept, , strict in produce" (can't recall source)

the answer no, since uris according rfc 3986 case sensitive:

6.2.2.1. case normalization

for uris, hexadecimal digits within percent-encoding triplet (e.g., "%3a" versus "%3a") case-insensitive , therefore should normalized use uppercase letters digits a-f.

when uri uses components of generic syntax, component syntax equivalence rules apply; namely, scheme , host case-insensitive , therefore should normalized lowercase. example, uri equivalent http://www.example.com/. other generic syntax components assumed case-sensitive unless defined otherwise scheme (see section 6.2.3).

if still want make them case insensitive, can use servlet filter , put in front of jax-rs framework. still need consistent in application.

if consider switching jersey apache wink, can use dynamic resources ensure urls lower/upper-cased. combining servlet filter dynamic resources can full solution case.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -