001/* 002 * nimbus-jose-jwt 003 * 004 * Copyright 2012-2016, Connect2id Ltd. 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use 007 * this file except in compliance with the License. You may obtain a copy of the 008 * License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software distributed 013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 015 * specific language governing permissions and limitations under the License. 016 */ 017 018package com.nimbusds.jose.util; 019 020 021/** 022 * Retriever of resources specified by URL which permits setting of HTTP 023 * connect and read timeouts as well as a size limit. 024 */ 025public interface RestrictedResourceRetriever extends ResourceRetriever { 026 027 028 /** 029 * Gets the HTTP connect timeout. 030 * 031 * @return The HTTP connect timeout, in milliseconds, zero for 032 * infinite. 033 */ 034 int getConnectTimeout(); 035 036 037 /** 038 * Sets the HTTP connect timeout. 039 * 040 * @param connectTimeoutMs The HTTP connect timeout, in milliseconds, 041 * zero for infinite. Must not be negative. 042 */ 043 void setConnectTimeout(final int connectTimeoutMs); 044 045 046 /** 047 * Gets the HTTP read timeout. 048 * 049 * @return The HTTP read timeout, in milliseconds, zero for infinite. 050 */ 051 int getReadTimeout(); 052 053 054 /** 055 * Sets the HTTP read timeout. 056 * 057 * @param readTimeoutMs The HTTP read timeout, in milliseconds, zero 058 * for infinite. Must not be negative. 059 */ 060 void setReadTimeout(final int readTimeoutMs); 061 062 063 /** 064 * Gets the HTTP entity size limit. 065 * 066 * @return The HTTP entity size limit, in bytes, zero for infinite. 067 */ 068 int getSizeLimit(); 069 070 071 /** 072 * Sets the HTTP entity size limit. 073 * 074 * @param sizeLimitBytes The HTTP entity size limit, in bytes, zero for 075 * infinite. Must not be negative. 076 */ 077 void setSizeLimit(int sizeLimitBytes); 078}