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

javax.portlet.ResourceResponse Maven / Gradle / Ivy

Go to download

The Java Portlet API version 3.0 developed by the Java Community Process JSR-362 Expert Group.

The newest version!
/*  Licensed to the Apache Software Foundation (ASF) under one
 *  or more contributor license agreements.  See the NOTICE file
 *  distributed with this work for additional information
 *  regarding copyright ownership.  The ASF licenses this file
 *  to you under the Apache License, Version 2.0 (the
 *  "License"); you may not use this file except in compliance
 *  with the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing,
 *  software distributed under the License is distributed on an
 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *  KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations
 *  under the License.
 */

/*
 * This source code implements specifications defined by the Java
 * Community Process. In order to remain compliant with the specification
 * DO NOT add / change / or delete method signatures!
 */

package javax.portlet;

/**
 * The  
 * ResourceResponse defines an object to assist a portlet 
 * for rendering a resource.
 * 

* The difference between the RenderResponse is that for the * ResourceResponse the output of this response is delivered * directly to the client without any additional markup added by the portal. * It is therefore allowed for the portlet to return binary content in this * response. *

* A portlet can set HTTP headers for the response via the setProperty or * addProperty call in the ResourceResponse. * To be successfully transmitted back to the client, headers must be set * before the response is committed. Headers set after the response is * committed will be ignored by the portlet container. *

* The portlet container creates a ResourceResponse object and * passes it as argument to the portlet's serveResource method. * * @see ResourceServingPortlet * @see MimeResponse * @since 2.0 */ public interface ResourceResponse extends MimeResponse { /** * Constant * for setting the HTTP status code via the * setProperty method. * * Changing the HTTP status code * after the response has been committed has no effect. * */ public static final String HTTP_STATUS_CODE = "portlet.http-status-code"; /** * Sets * the locale of the response, setting the headers * (including the Content-Type's charset) as appropriate. * This method should be called before a call to getWriter(). * By default, the response locale is the default locale provided * by the portlet container. *

* * This method has no effect if it is called * after the response has been committed. * * * @param loc the new locale of the response */ public void setLocale(java.util.Locale loc); /** * Sets the character encoding (MIME charset) of the response being * sent to the client, for example, to UTF-8. If the character encoding * has already been set by either the portlet container, * setContentType(java.lang.String) or * setLocale(java.util.Locale), this method overrides it. Calling * setContentType(java.lang.String) with the String of * text/html and calling this method with the String of * UTF-8 is equivalent with calling setContentType * with the String of text/html; charset=UTF-8. *

* This method can be called repeatedly to change the character encoding. * This method has no effect if it is called after getWriter has been called * or after the response has been committed. * * @param charset a String specifying only the character set defined by * IANA Character Sets (http://www.iana.org/assignments/character-sets) */ public void setCharacterEncoding(java.lang.String charset); /** * Sets * the length of the content body in the response. *

* * This method has no effect if it is called * after the response has been committed. * * * @param len an integer specifying the length of the content being returned; sets the Content-Length header */ public void setContentLength(int len); /** *

* Sets the HTTP status code for this request. *

* The status code should be a valid value as defined in * IETF * rfc2616 "Hypertext Transfer Protocol -- HTTP/1.1" * . The status code constants "SC_*" defined in * {@link javax.servlet.http.HttpServletResponse} may be used. *

* This method has no effect if it is called * after the response has been committed. *

* * @see javax.servlet.http.HttpServletResponse * @see javax.servlet.http.HttpServletResponse#setStatus * * @since 3.0 * * @param sc an integer specifying the status code for this request */ public void setStatus(int sc); /** *
* Gets the current HTTP status code for the response. *
* * @return The HTTP status code * * @see javax.servlet.http.HttpServletResponse * @see javax.servlet.http.HttpServletResponse#getStatus * * @since 3.0 */ public int getStatus(); /** *
* Sets the length of the content body in the response. *

* This method has no effect if it is called * after the response has been committed. *

* * @param len a long specifying the length of the content being returned; sets the Content-Length header * * @since 3.0 */ public void setContentLengthLong(long len); /** * @throws java.lang.IllegalStateException * if the cacheability level of the resource URL * triggering this serveResource call * is not PAGE and thus does not allow * for creating render URLs. */ public T createRenderURL(); /** * @throws java.lang.IllegalStateException * if the cacheability level of the resource URL * triggering this serveResource call * is not PAGE and thus does not allow * for creating render URLs. * * @since 3.0 */ public RenderURL createRenderURL(Copy option); /** * @throws java.lang.IllegalStateException * if the cacheability level of the resource URL * triggering this serveResource call * is not PAGE and thus does not allow * for creating action URLs. */ public T createActionURL(); /** * @throws java.lang.IllegalStateException * if the cacheability level of the resource URL * triggering this serveResource call * is not PAGE and thus does not allow * for creating action URLs. * * @since 3.0 */ public ActionURL createActionURL(Copy option); /** * @throws java.lang.IllegalStateException * if the cacheability level of the resource URL * triggering this serveResource call, * or one of the parent calls, have defined a stricter * cachability level. */ public ResourceURL createResourceURL(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy