Revision: 22927
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 26, 2010 04:06 by jeremi
Initial Code
import javax.ws.rs.Path import javax.ws.rs.POST import javax.ws.rs.FormParam @Path("/proxy") public class Proxy { @POST @Path("basic_auth/") public String basic_auth(@FormParam("url") String url, @FormParam("login") String login, @FormParam("password") String password) { def encoded = "$login:$password".getBytes().encodeBase64().toString() def c= new URL(url).openConnection() c.setRequestProperty("Authorization", "Basic $encoded") return c.content.text } }
Initial URL
http://blog.jeremi.info/entry/jax-rs-service-to-proxy-an-http-request-in-groovy
Initial Description
Initial Title
JAX-RS service to proxy and authenticate an HTTP request in groovy
Initial Tags
groovy
Initial Language
Groovy