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 6070605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:57:09+00:00 2026-05-23T09:57:09+00:00

I’m prototyping a simple RPC server in Java for an internal application. While eventually

  • 0

I’m prototyping a simple RPC server in Java for an internal application.

While eventually I’d like to switch to a specialized, high performance RPC library such as MessagePack, Apache Avro, or the Java bindings to 0mq, right now I’d like to keep things as simple as possible, so am starting with JSON over HTTP. I’d like to use Jetty so that I can embed the webserver and make installation and deployment as easy as possible. But I don’t have much experience with Java webdev, and am getting hung up on the very simple challenge of associating each of a handful of specific request handler objects with a specific URL. My general impression is that this may be the kind of thing the web.xml file is used for, but I’d rather wire it into the source code if possible.

I should emphasize that I need no interesting webapp functionality like sessions, templating, database access, etc. I just need to get a JSON string out of a POST request body, do stuff, and then write a string back in the response.

So basically, what’s the best way to, say, write two request handlers (servlets?), which return the request body uppercased and lowercased, respectively, and register them with the paths “/upper” and “/lower” on my server, preferably without using a config file. This will be taking place in an embedded Jetty app, but you certainly don’t need to depend on that if you don’t want to.

  • 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-05-23T09:57:09+00:00Added an answer on May 23, 2026 at 9:57 am

    Personally I’d do it with Spring. Spring can do a lot and as you’ve said, you don’t need a ton of web functionality, but you can still pick and choose functionality that you want from it.

    For what you need, you would set up Spring with a single controller and use a @ResponseBody annotation on the method handling the request. You then tell Spring to serialize response objects to JSON (I think it’s the default actually). Then Spring handles the serialization for you and your code just deals with Java objects.

    Here’s a more detailed article on the functionality I’m talking about: http://java.dzone.com/articles/spring-3-rest-json-path-variables

    if you go searching around you’ll likely see A lot of examples with a bunch of nasty xml configuration, but don’t worry, later versions of Spring can be configured with just a few lines of Java code.

    To address your note about using Avro, it actually not not be as tough as you might think to get it set up. Here’s a full sample application using Avro inside a servlet container for your server component:
    http://code.google.com/p/avro-http-example/wiki/Guide

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.