diff options
author | Raymond Auge | 2016-02-17 15:23:47 +0000 |
---|---|---|
committer | Raymond Auge | 2016-02-17 15:23:47 +0000 |
commit | 0779ae0b4fe93a68f97175f4483fc84efd35b619 (patch) | |
tree | 72d77ab1cc1a1a9a5924531f014319d44f867ae8 /bundles/org.eclipse.equinox.http.servlet/src | |
parent | 379bea2a45135b5c6c1bac3523742d15ec4016a9 (diff) | |
download | rt.equinox.bundles-0779ae0b4fe93a68f97175f4483fc84efd35b619.tar.gz rt.equinox.bundles-0779ae0b4fe93a68f97175f4483fc84efd35b619.tar.xz rt.equinox.bundles-0779ae0b4fe93a68f97175f4483fc84efd35b619.zip |
Bug 487944 - [http whiteboard] name only servlets are not supported in the whiteboard
Signed-off-by: Raymond Auge <raymond.auge@liferay.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.http.servlet/src')
2 files changed, 21 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java index 1bb95fd6e..6e5c7e40b 100644 --- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java +++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/HttpServiceRuntimeImpl.java @@ -885,6 +885,8 @@ public class HttpServiceRuntimeImpl sb.append(")(|("); //$NON-NLS-1$ sb.append(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE); sb.append("=*)("); //$NON-NLS-1$ + sb.append(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME); + sb.append("=*)("); //$NON-NLS-1$ sb.append(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN); sb.append("=*)))"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java index 854868384..8b731bf7b 100644 --- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java +++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ContextController.java @@ -478,16 +478,28 @@ public class ContextController { // this is a legacy registration; use a negative id for the DTO serviceId = -serviceId; } - String servletName = ServiceProperties.parseName( + String servletNameFromProperties = (String)servletRef.getProperty( + HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME); + String generatedServletName = ServiceProperties.parseName( servletRef.getProperty( HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME), servletHolder.get()); boolean multipartSupported = ServiceProperties.parseBoolean( servletRef, Const.EQUINOX_HTTP_MULTIPARTSUPPORTED); if (((patterns == null) || (patterns.length == 0)) && - ((errorPages == null) || errorPages.length == 0)) { - throw new IllegalArgumentException( - "Either patterns or errorPages must contain a value."); //$NON-NLS-1$ + ((errorPages == null) || errorPages.length == 0) && + (servletNameFromProperties == null)) { + + StringBuilder sb = new StringBuilder(); + sb.append("One of the service properties "); //$NON-NLS-1$ + sb.append(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_ERROR_PAGE); + sb.append(", "); //$NON-NLS-1$ + sb.append(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME); + sb.append(", "); //$NON-NLS-1$ + sb.append(HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN); + sb.append(" must contain a value."); //$NON-NLS-1$ + + throw new IllegalArgumentException(sb.toString()); } if (patterns != null) { @@ -501,7 +513,7 @@ public class ContextController { servletDTO.asyncSupported = asyncSupported; servletDTO.initParams = servletInitParams; servletDTO.multipartSupported = multipartSupported; - servletDTO.name = servletName; + servletDTO.name = generatedServletName; servletDTO.patterns = sort(patterns); servletDTO.serviceId = serviceId; servletDTO.servletContextId = contextServiceId; @@ -547,7 +559,7 @@ public class ContextController { errorPageDTO.errorCodes = errorCodes; errorPageDTO.exceptions = exceptions.toArray(new String[exceptions.size()]); errorPageDTO.initParams = servletInitParams; - errorPageDTO.name = servletName; + errorPageDTO.name = generatedServletName; errorPageDTO.serviceId = serviceId; errorPageDTO.servletContextId = contextServiceId; errorPageDTO.servletInfo = servletHolder.get().getServletInfo(); @@ -562,7 +574,7 @@ public class ContextController { servletHolder, servletDTO, errorPageDTO, curServletContextHelper, this, legacyTCCL); ServletConfig servletConfig = new ServletConfigImpl( - servletName, servletInitParams, servletContext); + generatedServletName, servletInitParams, servletContext); servletRegistration.init(servletConfig); |