001package ca.uhn.fhir.rest.server;
002
003import ca.uhn.fhir.context.FhirContext;
004import ca.uhn.fhir.context.api.AddProfileTagEnum;
005import ca.uhn.fhir.interceptor.api.IInterceptorService;
006import ca.uhn.fhir.rest.api.EncodingEnum;
007import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
008
009import java.util.List;
010
011/*
012 * #%L
013 * HAPI FHIR - Server Framework
014 * %%
015 * Copyright (C) 2014 - 2021 Smile CDR, Inc.
016 * %%
017 * Licensed under the Apache License, Version 2.0 (the "License");
018 * you may not use this file except in compliance with the License.
019 * You may obtain a copy of the License at
020 *
021 *      http://www.apache.org/licenses/LICENSE-2.0
022 *
023 * Unless required by applicable law or agreed to in writing, software
024 * distributed under the License is distributed on an "AS IS" BASIS,
025 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
026 * See the License for the specific language governing permissions and
027 * limitations under the License.
028 * #L%
029 */
030
031public interface IRestfulServerDefaults {
032        /**
033         * @return Returns the setting for automatically adding profile tags
034         * @deprecated As of HAPI FHIR 1.5, this property has been moved to
035         * {@link FhirContext#setAddProfileTagWhenEncoding(AddProfileTagEnum)}
036         */
037        @Deprecated
038        AddProfileTagEnum getAddProfileTag();
039
040        /**
041         * @return Returns the default encoding to return (XML/JSON) if an incoming request does not specify a preference
042         * (either with the <code>_format</code> URL parameter, or with an <code>Accept</code> header
043         * in the request. The default is {@link EncodingEnum#XML}. Will not return null.
044         */
045        EncodingEnum getDefaultResponseEncoding();
046
047        /**
048         * @return Returns the server support for ETags (will not be <code>null</code>). Default is
049         * {@link RestfulServer#DEFAULT_ETAG_SUPPORT}
050         */
051        ETagSupportEnum getETagSupport();
052
053        /**
054         * @return Returns the support option for the <code>_elements</code> parameter on search
055         * and read operations.
056         * @see <a href="http://hapifhir.io/doc_rest_server.html#extended_elements_support">Extended Elements Support</a>
057         */
058        ElementsSupportEnum getElementsSupport();
059
060        /**
061         * Gets the {@link FhirContext} associated with this server. For efficient processing, resource providers and plain
062         * providers should generally use this context if one is needed, as opposed to
063         * creating their own.
064         */
065        FhirContext getFhirContext();
066
067        /**
068         * Returns the list of interceptors registered against this server
069         */
070        List<IServerInterceptor> getInterceptors_();
071
072        /**
073         * Returns the paging provider for this server
074         */
075        IPagingProvider getPagingProvider();
076
077        /**
078         * Default page size for searches. Null means no limit (DaoConfig might have size limit however)
079         */
080        default Integer getDefaultPageSize() {
081                return null;
082        }
083
084        /**
085         * Maximum page size for searches. Null means no upper limit.
086         */
087        default Integer getMaximumPageSize() {
088                return null;
089        }
090
091        /**
092         * Should the server "pretty print" responses by default (requesting clients can always override this default by
093         * supplying an <code>Accept</code> header in the request, or a <code>_pretty</code>
094         * parameter in the request URL.
095         * <p>
096         * The default is <code>false</code>
097         * </p>
098         *
099         * @return Returns the default pretty print setting
100         */
101        boolean isDefaultPrettyPrint();
102
103        /**
104         * Returns the interceptor service for this server
105         */
106        IInterceptorService getInterceptorService();
107}