blob: cf4dd47d4cd434cde2baaeb9af2b8d2665e80570 [file] [log] [blame]
/*
* 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.
*/
package org.apache.struts2.dispatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Interface for loading static resources, based on a path. After implementing your own static content loader
* you must tell the framework how to use it, eg.
*
* <bean name="myContentLoader" type="org.apache.struts2.dispatcher" class="com.company.struts.MyContentLoader"/>
* <constant name="struts.staticContentLoader" value="myContentLoader"/>
*
* Check {@link org.apache.struts2.config.DefaultBeanSelectionProvider} for more details.
*/
public interface StaticContentLoader {
/**
* @param path Requested resource path
* @return true if this loader is able to load this type of resource, false otherwise
*/
public boolean canHandle(String path);
/**
* @param filterConfig The filter configuration
*/
public abstract void setHostConfig(HostConfig filterConfig);
/**
* Locate a static resource and copy directly to the response, setting the
* appropriate caching headers.
*
* @param path The resource name
* @param request The request
* @param response The response
* @throws IOException If anything goes wrong
*/
public abstract void findStaticResource(String path, HttpServletRequest request, HttpServletResponse response)
throws IOException;
}