My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 218 attachment: context.patch (2.1 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Index: src/org/jmesa/web/HttpServletRequestWebContext.java
===================================================================
--- src/org/jmesa/web/HttpServletRequestWebContext.java (revision 2371)
+++ src/org/jmesa/web/HttpServletRequestWebContext.java (working copy)
@@ -21,6 +21,7 @@
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
+import javax.servlet.ServletContext;

/**
* @since 2.0
@@ -28,11 +29,18 @@
*/
public class HttpServletRequestWebContext implements WebContext {
private HttpServletRequest request;
+ private ServletContext ctx;
private Map<?,?> parameterMap;
private Locale locale;

+ public HttpServletRequestWebContext(HttpServletRequest request, ServletContext ctx) {
+ this.request = request;
+ this.ctx = ctx;
+ }
+
public HttpServletRequestWebContext(HttpServletRequest request) {
this.request = request;
+ this.ctx = request.getSession().getServletContext();
}

protected HttpServletRequest getHttpServletRequest() {
@@ -40,19 +48,19 @@
}

public Object getApplicationInitParameter(String name) {
- return request.getSession().getServletContext().getInitParameter(name);
+ return ctx.getInitParameter(name);
}

public Object getApplicationAttribute(String name) {
- return request.getSession().getServletContext().getAttribute(name);
+ return ctx.getAttribute(name);
}

public void setApplicationAttribute(String name, Object value) {
- request.getSession().getServletContext().setAttribute(name, value);
+ ctx.setAttribute(name, value);
}

public void removeApplicationAttribute(String name) {
- request.getSession().getServletContext().removeAttribute(name);
+ ctx.removeAttribute(name);
}

public Object getPageAttribute(String name) {
@@ -137,7 +145,7 @@
}

public String getRealPath(String path) {
- return request.getSession().getServletContext().getRealPath(path);
+ return ctx.getRealPath(path);
}

public HttpServletRequest getBackingObject() {
Powered by Google Project Hosting