[ 
https://issues.apache.org/jira/browse/TOMEE-1390?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14164486#comment-14164486
 ] 

Thiago Veronezi commented on TOMEE-1390:
----------------------------------------

Now it is possible to use webaccess/groovy to load maven dependencies with 
grab. Example:

{code}
@Grab(group='org.apache.httpcomponents', module='httpclient', version='4.3.2')
import org.apache.http.impl.client.HttpClients
import org.apache.http.client.methods.*;
import org.apache.http.util.EntityUtils

String getBody(CloseableHttpResponse response) {
    String body = null
    try {
        def entity = response.getEntity()
        body = EntityUtils.toString(entity)
        EntityUtils.consume(entity)
    } finally {
        response.close()
    }
    body
}

def client = HttpClients.custom().build()
def get = new HttpGet('http://www.apache.org')
println getBody(client.execute(get));
{code}

> WebAccess Groovy with Grab  
> ----------------------------
>
>                 Key: TOMEE-1390
>                 URL: https://issues.apache.org/jira/browse/TOMEE-1390
>             Project: TomEE
>          Issue Type: Improvement
>            Reporter: Thiago Veronezi
>            Assignee: Thiago Veronezi
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to