Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7818321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:32:28+00:00 2026-06-02T06:32:28+00:00

I am launching requests to a web service using Groovy/XmlSlurper : new XmlSlurper().parse(http://en.wikipedia.org/w/api.php?action=…) I

  • 0

I am launching requests to a web service using Groovy/XmlSlurper:

new XmlSlurper().parse("http://en.wikipedia.org/w/api.php?action=...")

I would like to set the user agent to let the website know what project the requests are from.

How to set the user agent?

  • XMLSlurper’s constructors do not have anything like this.
  • The setProperty method sounds interesting but Google does not lead to anything related to UA.
  • I would rather avoid changing the code to abandon XmlSlurper in favor of another library.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:32:30+00:00Added an answer on June 2, 2026 at 6:32 am

    Looks like Groovy uses the JVM’s default SAX parser to connect to the input stream and perform the initial parsing. I saw this answer on SO that might help – all you need to do is set this before your call to the slurper to make it happen:

    System.setProperty("http.agent", "my-agent-name");
    

    P.S. This is just a guess – hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After launching our first public alpha release of http://wwww.trademango.com which is built with Play
We are launching a site that is media heavy and looking at using silverlight,
im trying to implement simple secured client server communiction using WCF. when im launching
Does it need Certificate/License/Registration before launching the website using https ? I want to
#!/bin/bash i=0 echo echo ################## echo LAUNCHING REQUESTS echo COUNT: $2 echo DELAY: $3
I'm launching the email program in Android from my app, using the following code...
I'm using launching firefox from the command line in a script to get snapshots
I'm out to create a fairly simple web service for intranet use. The service
I have this a when launching(clean build and run) my JavaEE web application :
Launching jetty by calling the API in 6.1.24. The JSP 2.1 component is on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.