public void criticalNotification(WrappedRequest request,
WrappedResponse response, String cap, String msg,
String details, String outOfSyncURL) throws IOException {
- servlet.criticalNotification(WrappedHttpServletRequest
- .cast(request).getHttpServletRequest(),
- ((WrappedHttpServletResponse) response)
- .getHttpServletResponse(), cap, msg, details,
+ servlet.criticalNotification(
+ WrappedHttpServletRequest.cast(request),
+ ((WrappedHttpServletResponse) response), cap, msg, details,
outOfSyncURL);
}
}
private DeploymentConfiguration deploymentConfiguration = new DeploymentConfiguration() {
public String getStaticFileLocation(WrappedRequest request) {
- HttpServletRequest servletRequest = WrappedHttpServletRequest.cast(
- request).getHttpServletRequest();
+ HttpServletRequest servletRequest = WrappedHttpServletRequest
+ .cast(request);
return AbstractApplicationServlet.this
.getStaticFilesLocation(servletRequest);
}
* @throws IOException
* if the request for the TRACE cannot be handled.
*/
- @SuppressWarnings("unchecked")
@Override
protected void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
+ service(createWrappedRequest(request), createWrappedResponse(response));
+ }
+
+ private void service(WrappedHttpServletRequest request,
+ WrappedHttpServletResponse response) throws ServletException,
+ IOException {
AbstractApplicationServletWrapper servletWrapper = new AbstractApplicationServletWrapper(
this);
- WrappedHttpServletRequest wrappedRequest = createWrappedRequest(request);
- WrappedHttpServletResponse wrappedResponse = createWrappedResponse(response);
RequestType requestType = getRequestType(request);
if (!ensureCookiesEnabled(requestType, request, response)) {
.getApplicationManager(application, this);
/* Update browser information from the request */
- webApplicationContext.getBrowser().updateRequestDetails(
- wrappedRequest);
+ webApplicationContext.getBrowser().updateRequestDetails(request);
/*
* Call application requestStart before Application.init() is called
/* Handle the request */
if (requestType == RequestType.FILE_UPLOAD) {
- applicationManager.handleFileUpload(wrappedRequest,
- wrappedResponse);
+ applicationManager.handleFileUpload(request, response);
return;
} else if (requestType == RequestType.UIDL) {
// Handles AJAX UIDL requests
- Root root = application.getRootForRequest(wrappedRequest);
+ Root root = application.getRootForRequest(request);
if (root == null) {
throw new ServletException(ERROR_NO_WINDOW_FOUND);
}
- applicationManager.handleUidlRequest(wrappedRequest,
- wrappedResponse, servletWrapper, root);
+ applicationManager.handleUidlRequest(request, response,
+ servletWrapper, root);
return;
} else if (requestType == RequestType.BROWSER_DETAILS) {
- applicationManager.handleBrowserDetailsRequest(wrappedRequest,
- wrappedResponse, application);
+ applicationManager.handleBrowserDetailsRequest(request,
+ response, application);
return;
}
return;
}
- if (applicationManager.handleApplicationRequest(wrappedRequest,
- wrappedResponse)) {
+ if (applicationManager.handleApplicationRequest(request, response)) {
return;
}
// TODO Should return 404 error here and not do anything more
getDeploymentConfiguration()) {
@Override
public String getRequestPathInfo() {
- return ApplicationRunnerServlet.this
- .getRequestPathInfo(getHttpServletRequest());
+ return ApplicationRunnerServlet.this.getRequestPathInfo(this);
}
};
}
package com.vaadin.terminal.gwt.server;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Locale;
-import java.util.Map;
-
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
import com.vaadin.Application;
import com.vaadin.terminal.CombinedRequest;
* @see WrappedRequest
* @see WrappedHttpServletResponse
*/
-public class WrappedHttpServletRequest implements WrappedRequest {
+public class WrappedHttpServletRequest extends HttpServletRequestWrapper
+ implements WrappedRequest {
- private final HttpServletRequest request;
private final DeploymentConfiguration deploymentConfiguration;
/**
*/
public WrappedHttpServletRequest(HttpServletRequest request,
DeploymentConfiguration deploymentConfiguration) {
- this.request = request;
+ super(request);
this.deploymentConfiguration = deploymentConfiguration;
}
- public Object getAttribute(String name) {
- return request.getAttribute(name);
- }
-
- public int getContentLength() {
- return request.getContentLength();
- }
-
- public InputStream getInputStream() throws IOException {
- return request.getInputStream();
- }
-
- public String getParameter(String name) {
- return request.getParameter(name);
- }
-
- public Map<String, String[]> getParameterMap() {
- return request.getParameterMap();
- }
-
- public void setAttribute(String name, Object o) {
- request.setAttribute(name, o);
- }
-
public String getRequestPathInfo() {
- return request.getPathInfo();
+ return getPathInfo();
}
public int getSessionMaxInactiveInterval() {
- return request.getSession().getMaxInactiveInterval();
+ return getSession().getMaxInactiveInterval();
}
public Object getSessionAttribute(String name) {
- return request.getSession().getAttribute(name);
+ return getSession().getAttribute(name);
}
public void setSessionAttribute(String name, Object attribute) {
- request.getSession().setAttribute(name, attribute);
+ getSession().setAttribute(name, attribute);
}
/**
* @return the servlet request
*/
public HttpServletRequest getHttpServletRequest() {
- return request;
- }
-
- public String getContentType() {
- return request.getContentType();
+ return this;
}
public DeploymentConfiguration getDeploymentConfiguration() {
};
}
- public Locale getLocale() {
- return request.getLocale();
- }
-
- public String getRemoteAddr() {
- return request.getRemoteAddr();
- }
-
- public boolean isSecure() {
- return request.isSecure();
- }
-
- public String getHeader(String headerName) {
- return request.getHeader(headerName);
- }
-
/**
* Helper method to get a <code>WrappedHttpServletRequest</code> from a
* <code>WrappedRequest</code>. Aside from casting, this method also takes
package com.vaadin.terminal.gwt.server;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
import com.vaadin.terminal.DeploymentConfiguration;
import com.vaadin.terminal.WrappedResponse;
* @see WrappedResponse
* @see WrappedHttpServletRequest
*/
-public class WrappedHttpServletResponse implements WrappedResponse {
+public class WrappedHttpServletResponse extends HttpServletResponseWrapper
+ implements WrappedResponse {
- private final HttpServletResponse response;
private DeploymentConfiguration deploymentConfiguration;
/**
*/
public WrappedHttpServletResponse(HttpServletResponse response,
DeploymentConfiguration deploymentConfiguration) {
- this.response = response;
+ super(response);
this.deploymentConfiguration = deploymentConfiguration;
}
- public OutputStream getOutputStream() throws IOException {
- return response.getOutputStream();
- }
-
/**
* Gets the original unwrapped <code>HttpServletResponse</code>
*
* @return the unwrapped response
*/
public HttpServletResponse getHttpServletResponse() {
- return response;
- }
-
- public void setContentType(String type) {
- response.setContentType(type);
- }
-
- public PrintWriter getWriter() throws IOException {
- return response.getWriter();
- }
-
- public void setStatus(int responseStatus) {
- response.setStatus(responseStatus);
- }
-
- public void setHeader(String name, String value) {
- response.setHeader(name, value);
+ return this;
}
public void setCacheTime(long milliseconds) {
}
}
- public void setDateHeader(String name, long timestamp) {
- response.setDateHeader(name, timestamp);
- }
-
- public void sendError(int errorCode, String message) throws IOException {
- response.sendError(errorCode, message);
- }
-
public DeploymentConfiguration getDeploymentConfiguration() {
return deploymentConfiguration;
}