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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:42:53+00:00 2026-06-18T22:42:53+00:00

For quite some time now, I’ve been developing JAX-RS web services for my development

  • 0

For quite some time now, I’ve been developing JAX-RS web services for my development needs. All the methods that I’ve written so far accept java Strings or primitive types as input.

An example of such a method:

@POST  
@Path("MyMethod")  
@Produces(MediaType.APPLICATION_JSON)  
public String MyMethod(@FormParam("username")String username, @FormParam("password")String passowrd)

What I’m trying to do now is accept images as input. I read a lot of articles regarding this. Some suggested accepting the base64 encoding as input and others suggested accepting an actual InputSteam.

However, i’m yet to see a full blown example on how to accept an InputStream. I read about the @consumer annotation and @Provider but i still can’t wrap my head around it. Is there an article, documentation or an example that somehow guides me toward this? i.e. A step by step process on how to implement rather than displaying theory.

I know that the base64 encoding works but out of curiosity i would like to know how the other approach works as well…Thanks in advance.

  • 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-18T22:42:54+00:00Added an answer on June 18, 2026 at 10:42 pm

    This should work:

    import org.apache.commons.io.IOUtils;
    @POST
    @Path("MyMethod") 
    @Consumes("*/*") // to accept all input types 
    public String MyMethod(InputStream stream) {
        byte[] image = IOUtils.toByteArray(stream);
        return "done";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've been developing an ipad app for quite some time now, all the previous
I've been working with web applications for quite some time now. However, I've never
This has been bugging me for quite some time now. All I want to
App Store We have been developing an app for quite some time now for
It's been quite some time now that I've been coding in C++ and I
I've been using MySQL for quite some time now. Most of that time I
I've been consulting stack overflow for quite some time now. I'm developing a system
I'm having a slight problem that's been bugging me for quite some time now
I've been a web developer for really quite some time now, but this is
The Problem I've been developing for Android for quite some time now. One of

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.