jakarta.mvc.event.ControllerRedirectEvent Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016-2018 JSR 371 expert group and contributors
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package jakarta.mvc.event;
import jakarta.ws.rs.container.ResourceInfo;
import jakarta.ws.rs.core.UriInfo;
import java.net.URI;
/**
* Event fired when a controller triggers a redirect. Only the
* status codes 301 (moved permanently), 302 (found), 303 (see other) and
* 307 (temporary redirect) are REQUIRED to be reported. Note that the
* JAX-RS methods
* {@link jakarta.ws.rs.core.Response#seeOther(java.net.URI)}} and
* {@link jakarta.ws.rs.core.Response#temporaryRedirect(java.net.URI)}}
* use the status codes to 303 and 307, respectively. Must be
* fired after {@link jakarta.mvc.event.AfterControllerEvent}.
*
* For example:
*
public class EventObserver {
* public void onControllerRedirect(@Observes ControllerRedirectEvent e) {
* ...
* }
* }
*
* @author Santiago Pericas-Geertsen
* @author Ivar Grimstad
* @see jakarta.enterprise.event.Observes
* @since 1.0
*/
public interface ControllerRedirectEvent extends MvcEvent {
/**
* Access to the current request URI information.
*
* @return URI info.
* @see jakarta.ws.rs.core.UriInfo
*/
UriInfo getUriInfo();
/**
* Access to the current request controller information.
*
* @return resources info.
* @see jakarta.ws.rs.container.ResourceInfo
*/
ResourceInfo getResourceInfo();
/**
* The target of the redirection.
*
* @return URI of redirection.
*/
URI getLocation();
}