/** * Returns the preferred representation according to the client preferences * specified in the request. By default it calls the * {@link #represent(Variant)} method with the preferred variant returned by * {@link #getPreferredVariant()}. * * @return The preferred representation. * @see #getPreferredVariant() * @throws ResourceException */ public Representation represent() throws ResourceException { return represent(getPreferredVariant()); }
/** * Returns the preferred representation according to the client preferences * specified in the request. * * @return The preferred representation. * @deprecated Use the {@link #represent()} method instead. * @see #getPreferredVariant() */ @Deprecated public Representation getPreferredRepresentation() { Representation result = null; try { result = represent(); } catch (ResourceException re) { getResponse().setStatus(re.getStatus(), re); } return result; }
/** * Returns a full representation for a given variant previously returned via * the getVariants() method. The default implementation directly returns the * variant in case the variants are already full representations. In all * other cases, you will need to override this method in order to provide * your own implementation. <br> * <br> * * This method is very useful for content negotiation when it is too costly * to initilize all the potential representations. It allows a resource to * simply expose the available variants via the getVariants() method and to * actually server the one selected via this method. * * @param variant * The variant whose full representation must be returned. * @return The full representation for the variant. * @see #getVariants() * @deprecated Use the {@link #represent(Variant)} method instead. */ @Deprecated public Representation getRepresentation(Variant variant) { Representation result = null; try { result = represent(variant); } catch (ResourceException re) { getResponse().setStatus(re.getStatus(), re); } return result; }