1 package org.jmage.mapper;
2
3 import org.jmage.util.ThreadLocalMap;
4 import org.jmage.ImageRequest;
5
6 import javax.servlet.http.HttpServletRequest;
7 import javax.servlet.http.HttpServletResponse;
8
9 /***
10 * ThreadLocalServletImageRequestMap
11 */
12 public class ThreadLocalServletImageRequestMap extends ThreadLocalMap {
13 private static final String MAPPER = "imageRequestMapper";
14 private static final String REQUEST = "servletRequest";
15 private static final String RESPONSE = "servletResponse";
16
17 public ThreadLocalServletImageRequestMap() {
18 super();
19 }
20
21 protected void setMapper(ImageRequestMapper imageRequestMapper) {
22 this.put(MAPPER, imageRequestMapper);
23 }
24
25 protected void setResponse(HttpServletResponse response) {
26 this.put(RESPONSE, response);
27 }
28
29 protected void setRequest(HttpServletRequest request) {
30 this.put(REQUEST, request);
31 }
32
33 protected ImageRequestMapper getMapper() {
34 return (ImageRequestMapper)this.get(MAPPER);
35 }
36
37 protected void removeMapper() {
38 this.remove(MAPPER);
39 }
40
41 protected void removeResponse() {
42 this.remove(RESPONSE);
43 }
44
45 protected void removeRequest() {
46 this.remove(REQUEST);
47 }
48
49 protected ImageRequest getThreadLocalImageRequest() {
50 return this.getMapper().getImageRequest();
51 }
52
53 protected HttpServletResponse getResponse() {
54 return ((HttpServletResponse)this.get(RESPONSE));
55 }
56
57 protected HttpServletRequest getRequest() {
58 return ((HttpServletRequest)this.get(REQUEST));
59 }
60 }