All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.shaded.sun.jersey.api.container.filter.package-info Maven / Gradle / Ivy

There is a newer version: 0.40.13
Show newest version
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2010-2011 Oracle and/or its affiliates. All rights reserved.
 *
 * The contents of this file are subject to the terms of either the GNU
 * General Public License Version 2 only ("GPL") or the Common Development
 * and Distribution License("CDDL") (collectively, the "License").  You
 * may not use this file except in compliance with the License.  You can
 * obtain a copy of the License at
 * http://glassfish.java.net/public/CDDL+GPL_1_1.html
 * or packager/legal/LICENSE.txt.  See the License for the specific
 * language governing permissions and limitations under the License.
 *
 * When distributing the software, include this License Header Notice in each
 * file and include the License file at packager/legal/LICENSE.txt.
 *
 * GPL Classpath Exception:
 * Oracle designates this particular file as subject to the "Classpath"
 * exception as provided by Oracle in the GPL Version 2 section of the License
 * file that accompanied this code.
 *
 * Modifications:
 * If applicable, add the following below the License Header, with the fields
 * enclosed by brackets [] replaced by your own identifying information:
 * "Portions Copyright [year] [name of copyright owner]"
 *
 * Contributor(s):
 * If you wish your version of this file to be governed by only the CDDL or
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
 * elects to include this software in this distribution under the [CDDL or GPL
 * Version 2] license."  If you don't indicate a single choice of license, a
 * recipient has the option to distribute your version of this file under
 * either the CDDL, the GPL Version 2 or to extend the choice of license to
 * its licensees as provided above.  However, if you add GPL Version 2 code
 * and therefore, elected the GPL Version 2 license, then the option applies
 * only if the new code is made subject to such option by the copyright
 * holder.
 */

/**
 * Provides common server-side filters.
 * 

* There are two types of filter that may be registered with Jersey: *

    *
  1. Container filters, which are filters that are registered to filter * the request before the request is matched and dispatched to a root * resource class, and filters that are registered to filter the response * after the response has returned from a resource method.
  2. *
  3. Resource filters, which are filters that are registered to filter * requests and responses specific to resource methods, sub-resource methods * and sub-resource locators.
  4. *

    *

* A request will be filtered by container filters before the request is filtered * by resource filters. A response will be filtered by resource filters before * the response is filtered by container filters. *

* Container filters are registered as properties of the {@link com.sun.jersey.api.core.ResourceConfig}. * Container request filters, of the class {@link com.sun.jersey.spi.container.ContainerRequestFilter}, are * registered using the property {@link com.sun.jersey.api.core.ResourceConfig#PROPERTY_CONTAINER_REQUEST_FILTERS}. * Container response filters, of the class {@link com.sun.jersey.spi.container.ContainerResponseFilter}, are * registered using the property {@link com.sun.jersey.api.core.ResourceConfig#PROPERTY_CONTAINER_RESPONSE_FILTERS}. *

* For example, to log requests and responses when an application is deployed * as a Servlet or Filter a {@link com.sun.jersey.api.container.filter.LoggingFilter} can be registered using * the following initialization parameters: *

 *     <init-param>
 *         <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
 *         <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
 *     </init-param>
 *     <init-param>
 *         <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
 *         <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
 *     </init-param>
 * 
* Note that two or more request or response filters may be registered as a ';' separated list of fully * qualified class names. *

* Resource filters are registered using two mechanisms: *

    *
  1. As resource filter factories. Resource filter factories, of the class * {@link com.sun.jersey.spi.container.ResourceFilterFactory}, are registered using the * property {@link com.sun.jersey.api.core.ResourceConfig#PROPERTY_RESOURCE_FILTER_FACTORIES}.
  2. *
  3. As resource filters, of the class * {@link com.sun.jersey.spi.container.ResourceFilter}, declared using the * annotation {@link com.sun.jersey.spi.container.ResourceFilters}, which may * occur on a resource class, resource method, sub-resource method or sub-resource locator.
  4. *
* A request will be filtered by filters produced by resource filter factories before a request is filtered * by resource filters declared by annotation. A response will be filtered by resource filters declared by annotation * before the response is filtered by filters produced by resource filter factories. *

* For example, to support {@link javax.annotation.security.RolesAllowed} on resource classes when an application * is deployed as a Servlet or Filter a * {@link com.sun.jersey.api.container.filter.RolesAllowedResourceFilterFactory} * can be registered using the following initialization parameter: *

 *     <init-param>
 *         <param-name>com.sun.jersey.spi.container.ResourceFilters</param-name>
 *         <param-value>com.sun.jersey.api.container.filter.RolesAllowedResourceFilterFactory</param-value>
 *     </init-param>
 * 
* Note that two or more resource filter factories may be registered as a ';' separated list of fully * qualified class names. *

* The use of resource filter factories allow the application of filters to any * method of a resource class that conforms to a certain pattern as defined by * a resource filter factory implementation. For example, the support for the * annotation {@link com.sun.jersey.spi.container.ResourceFilters} is implemented * as a resource filter factory, that is registered after all user-registered * resource filter factories. *

* If an exception is thrown by a request filter (registered using any mechanism) * then: *

    *
  1. the request processing is terminated;
  2. *
  3. the exception is mapped to a response; and
  4. *
  5. the response is filtered by the response filters.
  6. *
* If an exception is thrown by a response filter (registered using any mechanism) * then: *
    *
  1. the response processing is terminated;
  2. *
  3. the exception is mapped to a response; and
  4. *
  5. the response is returned to the client.
  6. *
*/ package com.sun.jersey.api.container.filter;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy