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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:17:57+00:00 2026-06-19T02:17:57+00:00

I am using JSF with PrimeFaces and the upload/download components fit my project perfectly.

  • 0

I am using JSF with PrimeFaces and the upload/download components fit my project perfectly. However, since the software will be deployed in some low-bandwidth environments, I was just wondering whether it is possible to limit the upload/download speeds these components will use?

Thanks for your suggestions and best regards
Pascal

  • 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-19T02:17:58+00:00Added an answer on June 19, 2026 at 2:17 am

    There seems to be no out-of-the-box approach. I ended up writing an own “LimitedInputStream” implementation.

    LimitedInputStream:

    public class LimitedInputStream extends InputStream {
        public static InputStream create(ILimitedInputStreamPolicy policy, InputStream wrapped) {
            return new LimitedInputStream(policy, wrapped);
        }
    
        public static InputStream create(Logger log, InputStream wrapped) {
            final ILimitedInputStreamPolicy policy = BytesPerIntervalLimitedInputStreamPolicy.create(log);
            return new LimitedInputStream(policy, wrapped);
        }
    
        private final ILimitedInputStreamPolicy policy;
        private final InputStream wrapped;
    
        private LimitedInputStream(ILimitedInputStreamPolicy policy, InputStream wrapped) {
            this.policy = policy;
            this.wrapped = wrapped;
        }
    
        @Override
        public int available() throws IOException {
            return wrapped.available();
        }
    
        @Override
        public void close() throws IOException {
            wrapped.close();
        }
    
        @Override
        public boolean equals(Object obj) {
            return wrapped.equals(obj);
        }
    
        @Override
        public int hashCode() {
            return wrapped.hashCode();
        }
    
        @Override
        public void mark(int readlimit) {
            wrapped.mark(readlimit);
        }
    
        @Override
        public boolean markSupported() {
            return wrapped.markSupported();
        }
    
        @Override
        public int read() throws IOException {
            policy.waitForBytesToRead();
            final int result = wrapped.read();
            policy.bytesRead(1);
            return result;
        }
    
        @Override
        public int read(byte[] b, int off, int len) throws IOException {
            final long bytesLeft = policy.waitForBytesToRead();
            final int bytesToRead = Long.valueOf(Math.min(bytesLeft, len)).intValue();
            final int bytesRead = wrapped.read(b, off, bytesToRead);
            policy.bytesRead(bytesRead);
            return bytesRead;
        }
    
        @Override
        public void reset() throws IOException {
            wrapped.reset();
        }
    
        @Override
        public long skip(long n) throws IOException {
            return wrapped.skip(n);
        }
    }
    

    ILimitedInputStreamPolicy.java:

    /**
     * Implementing class provide information about in which intervals how much data
     * may be read from a stream.
     */
    public interface ILimitedInputStreamPolicy {
        /**
         * Indicates that the given number of bytes have been read in any atomic
         * action.
         * 
         * @param numberOfBytes
         *            The number of bytes read.
         */
        public void bytesRead(int numberOfBytes);
    
        /**
         * Pauses the current thread until the implemented policy allows for the
         * returned amount of bytes to read,
         * 
         * @return The number of bytes allowed to read.
         */
        public int waitForBytesToRead();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this jQuery snippet to create tooltips on some JSF primefaces elements in
I am doing a project for school. I am using JSF and Primefaces. But
I am doing a project where I am using JSF 2.0 & Primefaces UI
I'm using JSF 2 and Primefaces. But I now need to do some more
I'm using JSF Primefaces 3.0.M3. When I submit (Save) a form some of the
I have a project using JSF primefaces and EJB managed Beans with hibernate storage.
I'm using JSF 2.0 with primefaces over JBoss 7. In some part of the
I am using the Primefaces upload tool since yesterday, but today i started to
i made a little registration form using JSF 2 and Primefaces 2.2 and deployed
I am using JSF + PrimeFaces in my project. I have prepared a Maven

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.