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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:25:42+00:00 2026-06-10T20:25:42+00:00

I am looking to create a RESTful API for use with an Android and

  • 0

I am looking to create a RESTful API for use with an Android and iOS app. So far I have been experimenting with using Jersey on the server and then the appropriate http libraries on the client side. At the moment I have been using multipart/related as the mimetype for the request with JSON forming the first part of the body then a jpeg image as the second.

So far I have had problems with making the request to the server, getting a 406 Not Acceptable from Jersey. I note that multipart/related is primarily used in sending emails. Is there actually a way that I can support mixed type content as an upload or have I entirely mis-understood the usage of multipart/related in this context?

  • 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-10T20:25:44+00:00Added an answer on June 10, 2026 at 8:25 pm

    You may want to look at this blog, for more information, but here is the important part to help you along:

    http://www.mkyong.com/webservices/jax-rs/file-upload-example-in-jersey/

    @POST
    @Path("/upload")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public Response uploadFile(
        @FormDataParam("file") InputStream uploadedInputStream,
        @FormDataParam("file") FormDataContentDisposition fileDetail) {
    
        String uploadedFileLocation = "d://uploaded/" + fileDetail.getFileName();
    
        // save it
        writeToFile(uploadedInputStream, uploadedFileLocation);
    
        String output = "File uploaded to : " + uploadedFileLocation;
    
        return Response.status(200).entity(output).build();
    }
    

    I expect you want multipart/form-data instead, as this is part of the description of multipart/related:

    The Multipart/Related media type is intended for compound objects
    consisting of several inter-related body parts. For a
    Multipart/Related object, proper display cannot be achieved by
    individually displaying the constituent body parts. The content-type
    of the Multipart/Related object is specified by the type parameter.
    The "start" parameter, if given, points, via a content-ID, to the
    body part that contains the object root. The default root is the
    first body part within the Multipart/Related body.

    For more on this mime type you can look at

    https://www.rfc-editor.org/rfc/rfc2387

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

Sidebar

Related Questions

I am looking to create a RESTFul PHP based API, and I am wondering
I'm looking to create a portfolio using a Wordpress blog. On the summary page
I'm looking to create something like in this image. Each block would have an
I'm using the popular restful authentication app/tutorial found here: http://railsforum.com/viewtopic.php?pid=74245#p74245 I have been using
I am looking to create a private torrent tracker but I have came across
I'm looking for examples of how others have created a RESTful service that supports
I have a WCF web service that implements a RESTful interface. We're using the
I'm looking for suggestions about a RESTful API design. I've read a lot about
I'm currently looking for ways to create automated tests for a JAX-RS (Java API
I have an Activity that will query a RESTful API every x seconds (polls

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.