You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Derek Baum (JIRA)" <ji...@apache.org> on 2016/08/05 11:51:20 UTC

[jira] [Created] (FELIX-5319) HttpServiceRuntime provides incorrect info for service that is both Servlet and Resource

Derek Baum created FELIX-5319:
---------------------------------

             Summary: HttpServiceRuntime provides incorrect info for service that is both Servlet and Resource
                 Key: FELIX-5319
                 URL: https://issues.apache.org/jira/browse/FELIX-5319
             Project: Felix
          Issue Type: Bug
          Components: HTTP Service
    Affects Versions: http.jetty-3.2.2
            Reporter: Derek Baum
            Priority: Minor


I have a servlet defined as follows:
Note: it defines _both_ servlet and resource properties.

@Component(property = {
		HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_NAME + "=Hello World",
		HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN + "=/hello/sayHello",
        HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PATTERN + "=/hello/static/*",
        HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PREFIX + "=/static"
        })
public class HelloWorldServlet extends HttpServlet implements Servlet {
}


I am using the HttpServiceRuntime to discover servlet info, but this servlet does not appear.

@Reference
HttpServiceRuntime httpRuntime;

RuntimeDTO runtimeDTO = httpRuntime.getRuntimeDTO();

for (ServletContextDTO servletContextDTO : runtimeDTO.servletContextDTOs) {
	ServletDTO[] servletDTOs = servletContextDTO.servletDTOs;
    // servletDTOs.length == 0
}

The equivalent code for ResourceDTO _does_ find a ResourceDTO for this servlet, but it contains servlet, rather than resource info:

resourceDTO.patterns = [/hello/sayHello]
resourceDTO.prefix = null


If I remove this resource property from the servlet, then the above code finds the servlet, as expected:
HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PATTERN + "=/hello/static/*"







--
This message was sent by Atlassian JIRA
(v6.3.4#6332)