01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/entity/tags/sakai_2-4-1/entity-api/api/src/java/org/sakaiproject/entity/api/HttpAccess.java $
03: * $Id: HttpAccess.java 7040 2006-03-27 03:04:33Z ggolden@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.entity.api;
21:
22: import java.util.Collection;
23:
24: import javax.servlet.http.HttpServletRequest;
25: import javax.servlet.http.HttpServletResponse;
26:
27: /**
28: * <p>
29: * Provide entity access via http for use in the access servlet.
30: * </p>
31: */
32: public interface HttpAccess {
33: /**
34: * Handle an HTTP request for access. The request and response objects are provider.<br />
35: * The access is for the referenced entity.<br />
36: * Use the response object to send the headers, length, content type, and bytes of the response in whatever manner needed.<br />
37: * Make the response ONLY if it is permitted and exists and otherwise valid. Use the exceptions for any error handling.
38: *
39: * @param req
40: * The request object.
41: * @param res
42: * The response object.
43: * @param ref
44: * The entity reference
45: * @param copyrightAcceptedRefs
46: * The collection (entity reference String) of entities that the end user in this session have already accepted the copyright for.
47: * @throws EntityPermissionException
48: * Throw this if the current user does not have permission for the access.
49: * @throws EntityNotDefinedException
50: * Throw this if the ref is not supported or the entity is not available for access in any way.
51: * @throws EntityAccessOverloadException
52: * Throw this if you are rejecting an otherwise valid request because of some sort of server resource shortage or limit.
53: * @throws EntityCopyrightException
54: * Throw this if you are rejecting an otherwise valid request because the user needs to agree to the copyright and has not yet done so.
55: */
56: void handleAccess(HttpServletRequest req, HttpServletResponse res,
57: Reference ref, Collection copyrightAcceptedRefs)
58: throws EntityPermissionException,
59: EntityNotDefinedException, EntityAccessOverloadException,
60: EntityCopyrightException;
61: }
|