    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.fileupload2.core;
    018
    019/**
    020 * Signals that a requests permitted size is exceeded.
    021 */
    022public class FileUploadSizeException extends FileUploadException {
    023
    024    /**
    025     * Serial version UID, being used, if serialized.
    026     */
    027    private static final long serialVersionUID = 2;
    028
    029    /**
    030     * The actual size of the request.
    031     */
    032    private final long actual;
    033
    034    /**
    035     * The maximum permitted size of the request.
    036     */
    037    private final long permitted;
    038
    039    /**
    040     * Constructs an instance.
    041     *
    042     * @param message   The detail message (which is saved for later retrieval by the {@link #getMessage()} method)
    043     * @param permitted The requests size limit.
    044     * @param actual    The actual values for the request.
    045     */
    046    public FileUploadSizeException(final String message, final long permitted, final long actual) {
    047        super(message);
    048        this.permitted = permitted;
    049        this.actual = actual;
    050    }
    051
    052    /**
    053     * Gets the actual size of the request.
    054     *
    055     * @return The actual size of the request.
    056     */
    057    public long getActualSize() {
    058        return actual;
    059    }
    060
    061    /**
    062     * Gets the limit size of the request.
    063     *
    064     * @return The limit size of the request.
    065     */
    066    public long getPermitted() {
    067        return permitted;
    068    }
    069
    070}