summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-06-28 15:55:02 +0300
committerLeif Åstrand <leif@vaadin.com>2012-06-28 15:55:02 +0300
commit5e46aa3dd23c194a741c4e7c6c5821b6eb3d7a2d (patch)
tree0e3249e310dde050637cef40075275c7aec13ecb /src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
parentd9822150a389d97c50d9321752b5054ade336d5b (diff)
downloadvaadin-framework-5e46aa3dd23c194a741c4e7c6c5821b6eb3d7a2d.tar.gz
vaadin-framework-5e46aa3dd23c194a741c4e7c6c5821b6eb3d7a2d.zip
Support connector:// and use it for relative dependency urls (#9048)
Diffstat (limited to 'src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java')
-rw-r--r--src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
index f7e46a7ca9..6930961497 100644
--- a/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
+++ b/src/com/vaadin/terminal/gwt/server/AbstractApplicationServlet.java
@@ -136,6 +136,8 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
static final String UPLOAD_URL_PREFIX = "APP/UPLOAD/";
+ static final String CONNECTOR_RESOURCE_PREFIX = "/APP/CONNECTOR/";
+
/**
* Called by the servlet container to indicate to a servlet that the servlet
* is being placed into service.
@@ -396,6 +398,19 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
CommunicationManager applicationManager = webApplicationContext
.getApplicationManager(application, this);
+ if (requestType == RequestType.CONNECTOR_RESOURCE) {
+ String pathInfo = getRequestPathInfo(request);
+ String resourceName = pathInfo
+ .substring(CONNECTOR_RESOURCE_PREFIX.length());
+
+ final String mimetype = getServletContext().getMimeType(
+ resourceName);
+
+ applicationManager.serveConnectorResource(resourceName,
+ request, response, mimetype);
+ return;
+ }
+
/* Update browser information from the request */
webApplicationContext.getBrowser().updateRequestDetails(request);
@@ -1250,12 +1265,14 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
}
protected enum RequestType {
- FILE_UPLOAD, BROWSER_DETAILS, UIDL, OTHER, STATIC_FILE, APPLICATION_RESOURCE;
+ FILE_UPLOAD, BROWSER_DETAILS, UIDL, OTHER, STATIC_FILE, APPLICATION_RESOURCE, CONNECTOR_RESOURCE;
}
protected RequestType getRequestType(HttpServletRequest request) {
if (isFileUploadRequest(request)) {
return RequestType.FILE_UPLOAD;
+ } else if (isConnectorResourceRequest(request)) {
+ return RequestType.CONNECTOR_RESOURCE;
} else if (isBrowserDetailsRequest(request)) {
return RequestType.BROWSER_DETAILS;
} else if (isUIDLRequest(request)) {
@@ -1276,6 +1293,14 @@ public abstract class AbstractApplicationServlet extends HttpServlet implements
&& request.getParameter("browserDetails") != null;
}
+ private boolean isConnectorResourceRequest(HttpServletRequest request) {
+ String path = getRequestPathInfo(request);
+ if (path != null && path.startsWith(CONNECTOR_RESOURCE_PREFIX)) {
+ return true;
+ }
+ return false;
+ }
+
private boolean isApplicationRequest(HttpServletRequest request) {
String path = getRequestPathInfo(request);
if (path != null && path.startsWith("/APP/")) {