javax.ws.rs.container

Interface ContainerResponseContext


  • public interface ContainerResponseContext
    Container response filter context. A mutable class that provides response-specific information for the filter, such as message headers, message entity or request-scoped properties. The exposed setters allow modification of the exposed response-specific information.
    Since:
    2.0
    Author:
    Marek Potociar
    • Method Detail

      • getStatus

        int getStatus()
        Get the status code associated with the response.
        Returns:
        the response status code or -1 if the status was not set.
      • setStatus

        void setStatus(int code)
        Set a new response status code.
        Parameters:
        code - new status code.
      • getStatusInfo

        Response.StatusType getStatusInfo()
        Get the complete status information associated with the response.
        Returns:
        the response status information or null if the status was not set.
      • setStatusInfo

        void setStatusInfo(Response.StatusType statusInfo)
        Set the complete status information (status code and reason phrase) associated with the response.
        Parameters:
        statusInfo - the response status information.
      • getHeaderString

        String getHeaderString(String name)
        Get a message header as a single string value. Each single header value is converted to String using a RuntimeDelegate.HeaderDelegate if one is available via RuntimeDelegate.createHeaderDelegate(java.lang.Class) for the header value class or using its toString method if a header delegate is not available.
        Parameters:
        name - the message header.
        Returns:
        the message header value. If the message header is not present then null is returned. If the message header is present but has no value then the empty string is returned. If the message header is present more than once then the values of joined together and separated by a ',' character.
        See Also:
        getHeaders(), getStringHeaders()
      • getAllowedMethods

        Set<String> getAllowedMethods()
        Get the allowed HTTP methods from the Allow HTTP header.
        Returns:
        the allowed HTTP methods, all methods will returned as upper case strings.
      • getDate

        Date getDate()
        Get message date.
        Returns:
        the message date, otherwise null if not present.
      • getLanguage

        Locale getLanguage()
        Get the language of the entity.
        Returns:
        the language of the entity or null if not specified
      • getLength

        int getLength()
        Get Content-Length value.
        Returns:
        Content-Length as integer if present and valid number. In other cases returns -1.
      • getMediaType

        MediaType getMediaType()
        Get the media type of the entity.
        Returns:
        the media type or null if not specified (e.g. there's no response entity).
      • getCookies

        Map<String,NewCookie> getCookies()
        Get any new cookies set on the response message.
        Returns:
        a read-only map of cookie name (String) to a new cookie.
      • getEntityTag

        EntityTag getEntityTag()
        Get the entity tag.
        Returns:
        the entity tag, otherwise null if not present.
      • getLastModified

        Date getLastModified()
        Get the last modified date.
        Returns:
        the last modified date, otherwise null if not present.
      • getLocation

        URI getLocation()
        Get the location.
        Returns:
        the location URI, otherwise null if not present.
      • Set<Link> getLinks()
        Get the links attached to the message as header.
        Returns:
        links, may return empty Set if no links are present. Never returns null.
      • boolean hasLink(String relation)
        Check if link for relation exists.
        Parameters:
        relation - link relation.
        Returns:
        true if the for the relation link exists, false otherwise.
      • Link getLink(String relation)
        Get the link for the relation.
        Parameters:
        relation - link relation.
        Returns:
        the link for the relation, otherwise null if not present.
      • getLinkBuilder

        Link.Builder getLinkBuilder(String relation)
        Convenience method that returns a Link.Builder for the relation.
        Parameters:
        relation - link relation.
        Returns:
        the link builder for the relation, otherwise null if not present.
      • hasEntity

        boolean hasEntity()
        Check if there is an entity available in the response. The method returns true if the entity is present, returns false otherwise.
        Returns:
        true if there is an entity present in the message, false otherwise.
      • getEntity

        Object getEntity()
        Get the message entity Java instance. Returns null if the message does not contain an entity.
        Returns:
        the message entity or null if message does not contain an entity body.
      • getEntityClass

        Class<?> getEntityClass()
        Get the raw entity type information.
        Returns:
        raw entity type.
      • getEntityType

        Type getEntityType()
        Get the generic entity type information.
        Returns:
        declared generic entity type.
      • setEntity

        void setEntity(Object entity,
                       Annotation[] annotations,
                       MediaType mediaType)
        Set a new message entity, including the attached annotations and the media type.

        It is the callers responsibility to wrap the actual entity with GenericEntity if preservation of its generic type is required.

        Parameters:
        entity - entity object.
        annotations - annotations attached to the entity instance.
        mediaType - entity media type.
        See Also:
        setEntity(Object), MessageBodyWriter
      • getEntityAnnotations

        Annotation[] getEntityAnnotations()
        Get the annotations attached to the entity instance.

        Note that the returned annotations array contains only those annotations explicitly attached to entity instance (such as the ones attached using Response.ResponseBuilder.entity(Object, java.lang.annotation.Annotation[]) method or the ones attached to the resource method that returned the response). The entity instance annotations array does not include annotations declared on the entity implementation class or its ancestors.

        Returns:
        annotations attached to the entity instance.
      • getEntityStream

        OutputStream getEntityStream()
        Get the entity output stream. The JAX-RS runtime is responsible for closing the output stream.
        Returns:
        entity output stream.
      • setEntityStream

        void setEntityStream(OutputStream outputStream)
        Set a new entity output stream. The JAX-RS runtime is responsible for closing the output stream.
        Parameters:
        outputStream - new entity output stream.

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/ws/rs/container/ContainerResponseContext.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com, ContainerResponseContext (Java(TM) EE 7 Specification APIs)

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.