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

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

    [ https://issues.apache.org/jira/browse/FELIX-5319?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15409497#comment-15409497 ] 

Carsten Ziegeler commented on FELIX-5319:
-----------------------------------------

Thanks for reporting, as a first step I've added a test case for that to our integration tests...and the test fails of course atm, with the problem mentioned in the description

> 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
>            Assignee: Carsten Ziegeler
>            Priority: Minor
>             Fix For: http.jetty-3.2.4
>
>
> 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)