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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:50:38+00:00 2026-05-20T03:50:38+00:00

I have some JavaScript which I want to perform a REST Request (GET) to

  • 0

I have some JavaScript which I want to perform a REST Request (GET) to my servlet.
The format of the record I want to send is in the following format …

/id1/vara/varb/varc/timedelta1,timedelta2,timedelta3,....,timedeltaN/ 

So basically there would be 5 attributes in each record I send. I need to batch these up – I’m sending multiple records in a single GET Request. My Get URL might look a little like the following.

myservletname/id1/vara/varb/varc/timedelta1,timedelta2,timedelta3/id2/vara/varb/varc/timedelta1,timedelta2,timedelta3/id3/vara/varb/varc/timedelta1,timedelta2,timedelta3/  

I’m aware on the limit of around 2000 chars in the URL String so to keep things safe I’ll ensure the length of the URL is less than this.
In the above example 3 records were sent to the servlet.

I’m wondering how I might process these on the server end. Havent really worked with REST before in Java. What do I need to do on the server end to process these URLs to extract the data ?

Thanks

  • 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-20T03:50:39+00:00Added an answer on May 20, 2026 at 3:50 am

    Basically

    public class RestServlet extends HttpServlet {
        public void doGet(HttpServletRequest request, HttpServletResponse response) {
            String uri = request.getPathInfo();
            Pattern p = Pattern.compile(
                "/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(\d+)(?:,(\d+))*/"
            );
            Matcher m = p.matcher(uri);
            if (m.matches()) {
                String id = m.group(1);
                String vara = m.group(2);
                String varb = m.group(3);
                String deltas = m.group(4);
    
                // etc
            }
        }
    }
    

    It’s not a very good model for how to do it, but it is simple and understandable for someone not familiar with Servlets

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

Sidebar

Related Questions

I have some XML which I want to extract via a javascript regular expression.
I have some jQuery/JavaScript code that I want to run only when there is
I have coded some JavaScript to perform an ajax call in an asp.net application.
I have some code in a javascript file that needs to send queries back
I want to write some javascript and have it call into the DOM for
I have some javascript which will create some sort of widget on a page.
I have some javascript that I'm trying to retool using jQuery to learn the
I'm writing a web page in ASP.NET. I have some JavaScript code, and I
Like the Delicious submission bookmark-let, I'd like to have some standard JavaScript I can
I have to do some JavaScript in the future, so it is time 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.