DZone
Web Dev Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Web Dev Zone > HTTP-RPC 4.0 Released

HTTP-RPC 4.0 Released

HTTP-RPC is the cornerstone of many a web-based Java application. Come check out what's new with the latest major release, HTTP-RPC 4.0 and see where you can get your hands on it.

Greg Brown user avatar by
Greg Brown
·
Jan. 25, 17 · Web Dev Zone · News
Like (4)
Save
Tweet
3.22K Views

Join the DZone community and get the full member experience.

Join For Free

HTTP-RPC 4.0 is now available for download. This release adds support for application/x-www-form-urlencoded and application/json request encodings. In addition to submitting request arguments as multipart/form-data, client applications can now POST arguments as URL-encoded key/value pairs and POST or PUT argument values as JSON.

For example, the following Java code would submit a JSON-encoded POST request to the resource located at /example:

serviceProxy.setEncoding(WebServiceProxy.APPLICATION_JSON);

serviceProxy.invoke("POST", "/example", mapOf(
    entry("string", "hello"),
    entry("number", 123),
    entry("flag", true)), (result, exception) -> {
    // ...
});


In Swift, the code might look like this:

serviceProxy.encoding = WSApplicationJSON

serviceProxy.invoke("POST", path: "/example", arguments: [
    "string": "hello",
    "number": 123,
    "flag": true
    ]) { result, error in
    // ...
}


In either case, the body of the request would contain the following:

{
  "string": "hello",
  "number": 123,
  "flag": true
}


For more information, see the project README.

Requests application Java (programming language) README Release (agency) JSON Download Swift (programming language)

Published at DZone with permission of Greg Brown, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Dynamically Provisioning Persistent Volumes with Kubernetes
  • What's the Difference Between Static Class vs. Singleton Patterns in C#?
  • What Is Pair Programming?
  • How to Modify Java Command-Line Arguments

Comments

Web Dev Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo