-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathWebWrapper.java
More file actions
61 lines (53 loc) · 1.75 KB
/
WebWrapper.java
File metadata and controls
61 lines (53 loc) · 1.75 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
package com.genexus.webpanels;
import java.io.ByteArrayOutputStream;
import com.genexus.internet.HttpAjaxContext;
import com.genexus.servlet.http.IHttpServletRequest;
import com.genexus.ModelContext;
import com.genexus.internet.HttpContext;
import com.genexus.internet.HttpContextNull;
import com.genexus.internet.HttpRequest;
import org.apache.logging.log4j.Logger;
public class WebWrapper
{
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(WebWrapper.class);
private String baseURL = "";
private GXWebPanel panel;
private ByteArrayOutputStream out;
public void setBaseURL(String baseURL)
{
this.baseURL = baseURL;
}
public String getBaseURL()
{
return baseURL;
}
public void setSource(GXWebPanel panel)
{
this.panel = panel;
ModelContext context = panel.getModelContext();
HttpRequest httpReq = ((HttpContext) context.getHttpContext()).getHttpRequest();
IHttpServletRequest httpSerReq = ((HttpContext) context.getHttpContext()).getRequest();
try {
context.setHttpContext(new HttpAjaxContext(httpSerReq));
((HttpContext) context.getHttpContext()).setHttpRequest(httpReq);
((HttpContext) context.getHttpContext()).setRequest(httpSerReq);
((HttpContext) context.getHttpContext()).setContext(context);
panel.httpContext = (HttpAjaxContext)context.getHttpContext();
panel.httpContext.setCompression(false);
panel.httpContext.setResponseBufferMode(HttpContext.ResponseBufferMode.SERVER_DEFAULT);
panel.httpContext.useUtf8 = true;
panel.httpContext.setOutputStream(new java.io.ByteArrayOutputStream());
}
catch (Exception e) {
log.error("Failed to create WebWrapper", e);
}
}
public GXWebPanel getSource()
{
return panel;
}
public String getresponse()
{
return panel.getresponse(baseURL);
}
}