package com.foundation.web; import java.io.File; import java.security.InvalidParameterException; import java.util.Date; import com.common.debug.Debug; import com.common.io.StreamSupport; import com.foundation.web.interfaces.*; /** * Some support method for the response. */ public class ResponseSupport { /** * Sets the content using a resource contained in the application's base directory. * @param IResponse The IResponse whose content is being set. * @param resource The resource to use as the content of the IResponse. * @deprecated */ public static void setContentResource(IResponse response, String resource) { setContentResource(response, resource, response.getRequest(), null, null, false); }//setContentResource()// /** * Sets the content using a resource contained in the application's base directory. * @param IResponse The IResponse whose content is being set. * @param resource The resource to use as the content of the IResponse. * @param clientCacheDate The date the client supplied for the IResponse it has cached. If non-null, this can be used to send a 304 Not Modified message back to the client if the resource is unchanged. * @deprecated */ public static void setContentResource(IResponse response, String resource, Date clientCacheDate) { setContentResource(response, resource, response.getRequest(), clientCacheDate, null, false); }//setContentResource()// /** * @param resource The resource to use as the content of the IResponse. * @param IResponse The IResponse whose content is being set. * @param request The request whose refering URL is used to create a relative path for the resource. If null, then the resource will be relative to the web app's base directory. * @deprecated */ public static void setContentResource(IResponse response, String resource, IRequest request) { setContentResource(response, resource, request, null, null, false); }//setContentResource()// /** * @param resource The resource to use as the content of the IResponse. * @param IResponse The IResponse whose content is being set. * @param request The request whose refering URL is used to create a relative path for the resource. If null, then the resource will be relative to the web app's base directory. * @param isDownload Whether the resource should be downloaded rather than opened in the browser. If this is null then the default action will be taken based on the mime settings. * @deprecated */ public static void setContentResource(IResponse response, String resource, IRequest request, Boolean isDownload) { setContentResource(response, resource, request, null, isDownload, false); }//setContentResource()// /** * Sets the content using a resource contained in the application's base directory. * @param IResponse The IResponse whose content is being set. * @param resource The resource to use as the content of the IResponse. * @param request The request whose refering URL is used to create a relative path for the resource. If null, then the resource will be relative to the web app's base directory. * @param clientCacheDate The date the client supplied for the IResponse it has cached. If non-null, this can be used to send a 304 Not Modified message back to the client if the resource is unchanged. * @param isDownload Whether the resource should be downloaded rather than opened in the browser. If this is null then the default action will be taken based on the mime settings. * @deprecated */ public static void setContentResource(IResponse response, String resource, IRequest request, Date clientCacheDate, Boolean isDownload) { setContentResource(response, resource, request, clientCacheDate, isDownload, false); }//setContentResource()// /** * Sets the content using a resource contained in the application's base directory. * @param IResponse The IResponse whose content is being set. * @param resource The resource to use as the content of the IResponse. * @param request The request whose refering URL is used to create a relative path for the resource. If null, then the resource will be relative to the web app's base directory. * @param clientCacheDate The date the client supplied for the IResponse it has cached. If non-null, this can be used to send a 304 Not Modified message back to the client if the resource is unchanged. * @param isDownload Whether the resource should be downloaded rather than opened in the browser. If this is null then the default action will be taken based on the mime settings. * @param infinateCache Whether the client should cache the resource indefinately. This is useful for overriding the default caching limits for things like images that will never change. * @deprecated */ public static void setContentResource(IResponse response, String resource, IRequest request, Date clientCacheDate, Boolean isDownload, boolean infinateCache) { FileContent.setContentResource(response, resource, request, clientCacheDate, isDownload, infinateCache); }//setContentResource()// /** * Sets the content using a resource contained in the application's base directory. * @param IResponse The IResponse whose content is being set. * @param resource The resource to use as the content of the IResponse. * @param request The request whose refering URL is used to create a relative path for the resource. If null, then the resource will be relative to the web app's base directory. * @param clientCacheDate The date the client supplied for the IResponse it has cached. If non-null, this can be used to send a 304 Not Modified message back to the client if the resource is unchanged. * @param isDownload Whether the resource should be downloaded rather than opened in the browser. If this is null then the default action will be taken based on the mime settings. * @param infinateCache Whether the client should cache the resource indefinately. This is useful for overriding the default caching limits for things like images that will never change. * @deprecated */ public static void setContentResource(IResponse response, File file, IRequest request, Date clientCacheDate, Boolean isDownload, boolean infinateCache) { FileContent.setContentResource(response, file, request, clientCacheDate, isDownload, infinateCache); }//setContentResource()// }//ResponseSupport//