[ 
https://issues.apache.org/jira/browse/FELIX-5319?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carsten Ziegeler resolved FELIX-5319.
-------------------------------------
    Resolution: Fixed

I've committed a fix - test passes now.

The problem was that internally a Resource is treated like a Servlet using the 
same ServletInfo implementation - which then leads to one object overwriting 
the other. As the DTO handling makes the assumption that this can't happen, the 
state gets totally corrupted.
We're now using a  sub class of ServletInfo for resources and compare the class 
names in the compareTo method

> 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.base-3.0.10, http.jetty-3.2.2, http.bridge-3.0.10
>            Reporter: Derek Baum
>            Assignee: Carsten Ziegeler
>            Priority: Minor
>             Fix For: http.base-3.0.12, http.jetty-3.2.4, http.bridge-3.0.12
>
>
> 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)

Reply via email to