import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.portlet.PortletResponse;
-import javax.servlet.ServletResponse;
-
import com.vaadin.Application;
import com.vaadin.Application.SystemMessages;
import com.vaadin.terminal.PaintException;
private static final RequestHandler APP_RESOURCE_HANDLER = new ApplicationResourceHandler();
- /**
- * Generic interface of a (HTTP or Portlet) response from the application.
- *
- * This is a wrapper interface that allows
- * {@link AbstractCommunicationManager} to use a unified API.
- *
- * @see javax.servlet.ServletResponse
- * @see javax.portlet.PortletResponse
- *
- * @author peholmst
- */
- public interface Response extends WrappedResponse {
-
- /**
- * Gets the output stream to which the response can be written.
- *
- * @return
- * @throws IOException
- */
- public OutputStream getOutputStream() throws IOException;
-
- /**
- * Sets the MIME content type for the response to be communicated to the
- * browser.
- *
- * @param type
- */
- public void setContentType(String type);
-
- /**
- * Gets the wrapped response object, usually a class implementing either
- * {@link ServletResponse} or {@link PortletResponse}.
- *
- * @return wrapped request object
- */
- public Object getWrappedResponse();
-
- }
-
/**
* TODO Document me!
*
public interface Callback {
public void criticalNotification(WrappedRequest request,
- Response response, String cap, String msg, String details,
- String outOfSyncURL) throws IOException;
+ WrappedResponse response, String cap, String msg,
+ String details, String outOfSyncURL) throws IOException;
public String getRequestPathInfo(WrappedRequest request);
* @throws IOException
*/
protected void doHandleSimpleMultipartFileUpload(WrappedRequest request,
- Response response, StreamVariable streamVariable,
+ WrappedResponse response, StreamVariable streamVariable,
String variableName, VariableOwner owner, String boundary)
throws IOException {
// multipart parsing, supports only one file for request, but that is
* @throws IOException
*/
protected void doHandleXhrFilePost(WrappedRequest request,
- Response response, StreamVariable streamVariable,
+ WrappedResponse response, StreamVariable streamVariable,
String variableName, VariableOwner owner, int contentLength)
throws IOException {
* @param response
* @throws IOException
*/
- protected void sendUploadResponse(WrappedRequest request, Response response)
- throws IOException {
+ protected void sendUploadResponse(WrappedRequest request,
+ WrappedResponse response) throws IOException {
response.setContentType("text/html");
final OutputStream out = response.getOutputStream();
final PrintWriter outWriter = new PrintWriter(new BufferedWriter(
* @throws InvalidUIDLSecurityKeyException
*/
protected void doHandleUidlRequest(WrappedRequest request,
- Response response, Callback callback, Root root)
+ WrappedResponse response, Callback callback, Root root)
throws IOException, InvalidUIDLSecurityKeyException {
requestThemeName = request.getParameter("theme");
* @throws IOException
*/
private void paintAfterVariableChanges(WrappedRequest request,
- Response response, Callback callback, boolean repaintAll,
+ WrappedResponse response, Callback callback, boolean repaintAll,
final PrintWriter outWriter, Root root, boolean analyzeLayouts)
throws PaintException, IOException {
*
* @return true if successful, false if there was an inconsistency
*/
- private boolean handleVariables(WrappedRequest request, Response response,
- Callback callback, Application application2, Root root)
- throws IOException, InvalidUIDLSecurityKeyException {
+ private boolean handleVariables(WrappedRequest request,
+ WrappedResponse response, Callback callback,
+ Application application2, Root root) throws IOException,
+ InvalidUIDLSecurityKeyException {
boolean success = true;
String changes = getRequestPayload(request);
* @throws IOException
* if the writing failed due to input/output error.
*/
- private void endApplication(WrappedRequest request, Response response,
- Application application) throws IOException {
+ private void endApplication(WrappedRequest request,
+ WrappedResponse response, Application application)
+ throws IOException {
String logoutUrl = application.getLogoutURL();
if (logoutUrl == null) {
* @param outWriter
* @param response
*/
- protected void openJsonMessage(PrintWriter outWriter, Response response) {
+ protected void openJsonMessage(PrintWriter outWriter,
+ WrappedResponse response) {
// Sets the response type
response.setContentType("application/json; charset=UTF-8");
// some dirt to prevent cross site scripting
import com.vaadin.terminal.StreamVariable;
import com.vaadin.terminal.VariableOwner;
import com.vaadin.terminal.WrappedRequest;
+import com.vaadin.terminal.WrappedResponse;
import com.vaadin.ui.Component;
import com.vaadin.ui.Root;
*
* @see Response
*/
- private static class HttpServletResponseWrapper implements Response {
+ private static class HttpServletResponseWrapper implements WrappedResponse {
private final HttpServletResponse response;
return response.getOutputStream();
}
- public Object getWrappedResponse() {
+ public HttpServletResponse getHttpServletResponse() {
return response;
}
}
public void criticalNotification(WrappedRequest request,
- Response response, String cap, String msg, String details,
- String outOfSyncURL) throws IOException {
+ WrappedResponse response, String cap, String msg,
+ String details, String outOfSyncURL) throws IOException {
servlet.criticalNotification(((WrappedHttpServletRequest) request)
- .getHttpServletRequest(), (HttpServletResponse) response
- .getWrappedResponse(), cap, msg, details, outOfSyncURL);
+ .getHttpServletRequest(),
+ ((HttpServletResponseWrapper) response)
+ .getHttpServletResponse(), cap, msg, details,
+ outOfSyncURL);
}
public String getRequestPathInfo(WrappedRequest request) {
import com.vaadin.terminal.StreamVariable;
import com.vaadin.terminal.VariableOwner;
import com.vaadin.terminal.WrappedRequest;
+import com.vaadin.terminal.WrappedResponse;
import com.vaadin.ui.Component;
import com.vaadin.ui.Root;
private transient ResourceResponse currentUidlResponse;
- private static class PortletResponseWrapper implements Response {
+ private static class PortletResponseWrapper implements WrappedResponse {
private final PortletResponse response;
return ((MimeResponse) response).getPortletOutputStream();
}
- public Object getWrappedResponse() {
- return response;
+ public MimeResponse getPortletResponse() {
+ return (MimeResponse) response;
}
public void setContentType(String type) {
}
public void criticalNotification(WrappedRequest request,
- Response response, String cap, String msg, String details,
- String outOfSyncURL) throws IOException {
+ WrappedResponse response, String cap, String msg,
+ String details, String outOfSyncURL) throws IOException {
portlet.criticalNotification(
((WrappedPortletRequest) request).getPortletRequest(),
- (MimeResponse) response.getWrappedResponse(), cap, msg,
- details, outOfSyncURL);
+ ((PortletResponseWrapper) response).getPortletResponse(),
+ cap, msg, details, outOfSyncURL);
}
public String getRequestPathInfo(WrappedRequest request) {