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

  • SEARCH
  • Home
  • 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 9069993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:34:19+00:00 2026-06-16T17:34:19+00:00

I’m working on a grails app and for several hours already have been trying

  • 0

I’m working on a grails app and for several hours already have been trying to get html code from a request. What I want to do is to get plain html (like in a webPage source, with all tags and stuff), so that i can work on that.

I have already managed to get it for my get requests with this code:

url = ("http://google.com").toURL().getText())

It works just fine, but I also need to be able to make post requests.

I’ve tried with httpBuilder, but the response I’m getting looks like well formated text (with white spaces and stuff), but that hasn’t got any html tags, and I need them. Code I’m using looks like this:

def url = "http://urlToRemoteServer.com/"
def http = new HTTPBuilder(url);


http.post( path: 'pathToMyApp',
        requestContentType: "text/xml" ) { resp, reader ->

            println "Tweet response status: ${resp.statusLine}"
            assert resp.statusLine.statusCode == 200
            System.out << reader
        }

Can anyone tell me how to get that html code? I’m working on groovy, but Java solution will be just as good.

  • 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-16T17:34:20+00:00Added an answer on June 16, 2026 at 5:34 pm

    Change the post map to include the contentType to force plain-text parsing (and, I believe change to Accepts header) as below:

    http.post( path: 'pathToMyApp',
               requestContentType: "text/xml",
               contentType: "text/xml") { resp, reader ->
    

    Alternatively, you can change parser for this and future requests by adding a ParserRegistry remap after the constructor:

    http.parser.'text/html' = http.parser.'text/plain'
    

    You can also add a call to setContentType(), after your constructor call for HTTPBuilder:

    //...
    def http = new HTTPBuilder(url);  //existing code
    http.contentType = ContentType.TEXT //new addition
    http.post( path: 'pathToMyApp', //existing code
    //...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a jquery bug and I've been looking for hours now, I can't
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a view passing on information from a database: def serve_article(request, id): served_article
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
I have been unable to fix a problem with Java Unicode and encoding. The
I have thousands of HTML files to process using Groovy/Java and I need to

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.