use of com.genexus.servlet.http.IHttpServletRequest in project JavaClasses by genexuslabs.
the class GXWebObjectStub method dumpRequestInfo.
private void dumpRequestInfo(HttpContext httpContext) {
IHttpServletRequest request = httpContext.getRequest();
StringBuffer sBuffer = new StringBuffer();
String nl = System.getProperty("line.separator");
sBuffer.append("Request Information");
sBuffer.append(nl + "Url: ");
sBuffer.append(request.getRequestURL());
sBuffer.append(nl + "HttpHeaders: " + nl);
for (Enumeration<String> headerNames = request.getHeaderNames(); headerNames.hasMoreElements(); ) {
String header = headerNames.nextElement();
sBuffer.append(header);
sBuffer.append(":");
sBuffer.append(request.getHeader(header));
}
sBuffer.append(nl + "HttpCookies: " + nl);
ICookie[] cookies = httpContext.getCookies();
if (cookies != null) {
for (int i = 0; i < cookies.length; i++) {
sBuffer.append(cookies[i].getName());
sBuffer.append(":");
sBuffer.append(cookies[i].getValue());
}
}
logger.debug(sBuffer.toString());
}
use of com.genexus.servlet.http.IHttpServletRequest in project JavaClasses by genexuslabs.
the class CustomFilter method doFilter.
public void doFilter(IServletRequest request, IServletResponse response, IFilterChain chain) throws Exception {
if (request != null && request.isHttpServletRequest()) {
IHttpServletRequest req = request.getHttpServletRequest();
String url = req.getRequestURL().toString();
if (url.contains("apple-app-site-association")) {
IHttpServletResponse resp = response.getHttpServletResponse();
resp.setContentType("application/json");
}
}
// pass the request along the filter chain
chain.doFilter(request, response);
}
use of com.genexus.servlet.http.IHttpServletRequest in project JavaClasses by genexuslabs.
the class InternalRestServicesFilter method doFilter.
public void doFilter(IServletRequest request, IServletResponse response, IFilterChain chain) throws Exception {
if (request.isHttpServletRequest() && response.isHttpServletResponse()) {
IHttpServletRequest httpRequest = request.getHttpServletRequest();
String path = httpRequest.getRequestURI().substring(httpRequest.getContextPath().length()).substring(1);
String urlString = (path.lastIndexOf("/") > -1) ? path.substring(0, path.lastIndexOf("/")).toLowerCase() : path.toLowerCase();
boolean isPath = appPath.contains(urlString);
if (isPath) {
String fwdURI = "/rest/" + path;
httpRequest.getRequestDispatcher(fwdURI).forward(request, response);
} else {
chain.doFilter(request, response);
}
} else {
chain.doFilter(request, response);
}
}
use of com.genexus.servlet.http.IHttpServletRequest in project JavaClasses by genexuslabs.
the class WebWrapper method setSource.
public void setSource(GXWebPanel panel) {
this.panel = panel;
ModelContext context = panel.getModelContext();
HttpRequest httpReq = ((HttpContext) context.getHttpContext()).getHttpRequest();
IHttpServletRequest httpSerReq = ((HttpContext) context.getHttpContext()).getRequest();
context.setHttpContext(new HttpContextNull());
((HttpContext) context.getHttpContext()).setHttpRequest(httpReq);
((HttpContext) context.getHttpContext()).setRequest(httpSerReq);
((HttpContext) context.getHttpContext()).setContext(context);
panel.setHttpContext(((HttpContext) context.getHttpContext()));
panel.getHttpContext().setCompression(false);
panel.getHttpContext().setBuffered(false);
panel.getHttpContext().useUtf8 = true;
panel.getHttpContext().setOutputStream(new java.io.ByteArrayOutputStream());
}
use of com.genexus.servlet.http.IHttpServletRequest in project JavaClasses by genexuslabs.
the class APIObjectFilter method doFilter.
public void doFilter(IServletRequest request, IServletResponse response, IFilterChain chain) throws Exception {
if (request.isHttpServletRequest() && response.isHttpServletResponse()) {
IHttpServletRequest httpRequest = request.getHttpServletRequest();
String path = httpRequest.getRequestURI().substring(httpRequest.getContextPath().length()).substring(1);
String urlString = path.toLowerCase();
boolean isPath = false;
for (String appBasePath : appPath) {
if (urlString.startsWith(appBasePath)) {
isPath = true;
break;
}
}
if (isPath) {
String fwdURI = "/rest/" + path;
httpRequest.getRequestDispatcher(fwdURI).forward(request, response);
} else {
chain.doFilter(request, response);
}
} else {
chain.doFilter(request, response);
}
}
Aggregations