Re: [pax-web][whiteboard] Unable to access resources that are registered to context

2017-04-13 Thread Peter Schyma
Hi,

I need a Jira-User.

You are right, I can set any set of service types as long as Object is one 
of them. I looked into the related tracker class and indeed it was only 
triggered if Object is exposed as a service type [1]. Unfortunateley I 
don't have the sources availalable here to test it right now.
I hope that I will find some time during the next days to dig deeper into 
this.


Greetings,
Peter

[1]https://github.com/ops4j/org.ops4j.pax.web/blob/master/pax-web-extender-whiteboard/src/main/java/org/ops4j/pax/web/extender/whiteboard/internal/tracker/ResourceTracker.java#L61


Am Donnerstag, 13. April 2017 23:58:27 UTC+2 schrieb Achim Nierbeck:
>
> Hi, 
>
> hmm ... you're right according to the spec, 140.6 Registering Resources, 
> it should be a pattern, therefore a /* should be trailing it. 
> could you open a bug for this? (if you need a Jira-User I'll create one)
> regarding your second question, I'm not sure it's Object only cause in the 
> pax-web sample we don't set it only to Object [1].
>
> regards, Achim 
>
> [1] - 
> https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/whiteboard-ds/src/main/java/org/ops4j/pax/web/samples/whiteboard/ds/WhiteboardResource.java#L23
>  
> 
>
>
> 2017-04-13 23:19 GMT+02:00 Peter Schyma :
>
>> Hi,
>>
>> thank you.
>>
>> I wonder whether the resource pattern is correct. I was following the 
>> example from RFC 189 that uses the trailing /* on a class extending 
>> HttpServlet without defining any explicit service type (and thus resulting 
>> in Servlet). But this service registration was not recongized by the 
>> whiteboard. After some googling I found an example that declared the 
>> service type as Object and now it was recognized and registered but not 
>> accessible due to the trailing /*.
>>
>> This yields two questions:
>> 1. Shouldn't the pattern without the trailing /* match only the /web 
>> folder (as an absolute resource mapping)?
>> 2. Why do I have to use Object as service type even though the RFC states 
>> "The service type can be any type, it is adviced to use the implementation 
>> class as the type."?
>>
>> Greetings,
>> Peter
>>
>> Am Donnerstag, 13. April 2017 21:48:09 UTC+2 schrieb Achim Nierbeck:
>>>
>>> Hi Peter, 
>>>
>>> I provided a pull request. 
>>> The issue is actually a wrong resource.pattern, it needs to be only 
>>> /resource without the trailing /*
>>> after that the resources did work correctly. 
>>>
>>> Regarding PAXWEB-1077 it's still open and will take a bit. 
>>> It's especially annoying as an update or restart of such a bundle 
>>> doesn't work. 
>>>
>>> regards, Achim 
>>>
>> -- 
>> -- 
>> --
>> OPS4J - http://www.ops4j.org - op...@googlegroups.com 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ops4j+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Apache Member
> Apache Karaf  Committer & PMC
> OPS4J Pax Web  Committer & 
> Project Lead
> blog 
> Co-Author of Apache Karaf Cookbook 
>
> Software Architect / Project Manager / Scrum Master 
>
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pax-web][whiteboard] Unable to access resources that are registered to context

2017-04-13 Thread 'Achim Nierbeck' via OPS4J
Hi,

hmm ... you're right according to the spec, 140.6 Registering Resources, it
should be a pattern, therefore a /* should be trailing it.
could you open a bug for this? (if you need a Jira-User I'll create one)
regarding your second question, I'm not sure it's Object only cause in the
pax-web sample we don't set it only to Object [1].

regards, Achim

[1] -
https://github.com/ops4j/org.ops4j.pax.web/blob/master/samples/whiteboard-ds/src/main/java/org/ops4j/pax/web/samples/whiteboard/ds/WhiteboardResource.java#L23


2017-04-13 23:19 GMT+02:00 Peter Schyma :

> Hi,
>
> thank you.
>
> I wonder whether the resource pattern is correct. I was following the
> example from RFC 189 that uses the trailing /* on a class extending
> HttpServlet without defining any explicit service type (and thus resulting
> in Servlet). But this service registration was not recongized by the
> whiteboard. After some googling I found an example that declared the
> service type as Object and now it was recognized and registered but not
> accessible due to the trailing /*.
>
> This yields two questions:
> 1. Shouldn't the pattern without the trailing /* match only the /web
> folder (as an absolute resource mapping)?
> 2. Why do I have to use Object as service type even though the RFC states
> "The service type can be any type, it is adviced to use the implementation
> class as the type."?
>
> Greetings,
> Peter
>
> Am Donnerstag, 13. April 2017 21:48:09 UTC+2 schrieb Achim Nierbeck:
>>
>> Hi Peter,
>>
>> I provided a pull request.
>> The issue is actually a wrong resource.pattern, it needs to be only
>> /resource without the trailing /*
>> after that the resources did work correctly.
>>
>> Regarding PAXWEB-1077 it's still open and will take a bit.
>> It's especially annoying as an update or restart of such a bundle doesn't
>> work.
>>
>> regards, Achim
>>
> --
> --
> --
> OPS4J - http://www.ops4j.org - ops4j@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ops4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Apache Member
Apache Karaf  Committer & PMC
OPS4J Pax Web  Committer &
Project Lead
blog 
Co-Author of Apache Karaf Cookbook 

Software Architect / Project Manager / Scrum Master

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pax-web][whiteboard] Unable to access resources that are registered to context

2017-04-13 Thread Peter Schyma
Hi,

thank you.

I wonder whether the resource pattern is correct. I was following the 
example from RFC 189 that uses the trailing /* on a class extending 
HttpServlet without defining any explicit service type (and thus resulting 
in Servlet). But this service registration was not recongized by the 
whiteboard. After some googling I found an example that declared the 
service type as Object and now it was recognized and registered but not 
accessible due to the trailing /*.

This yields two questions:
1. Shouldn't the pattern without the trailing /* match only the /web folder 
(as an absolute resource mapping)?
2. Why do I have to use Object as service type even though the RFC states 
"The service type can be any type, it is adviced to use the implementation 
class as the type."?

Greetings,
Peter

Am Donnerstag, 13. April 2017 21:48:09 UTC+2 schrieb Achim Nierbeck:
>
> Hi Peter, 
>
> I provided a pull request. 
> The issue is actually a wrong resource.pattern, it needs to be only 
> /resource without the trailing /*
> after that the resources did work correctly. 
>
> Regarding PAXWEB-1077 it's still open and will take a bit. 
> It's especially annoying as an update or restart of such a bundle doesn't 
> work. 
>
> regards, Achim 
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [pax-web][whiteboard] Unable to access resources that are registered to context

2017-04-13 Thread 'Achim Nierbeck' via OPS4J
Hi Peter,

I provided a pull request.
The issue is actually a wrong resource.pattern, it needs to be only
/resource without the trailing /*
after that the resources did work correctly.

Regarding PAXWEB-1077 it's still open and will take a bit.
It's especially annoying as an update or restart of such a bundle doesn't
work.

regards, Achim


2017-04-13 18:36 GMT+02:00 Peter Schyma :

> Please find the simplyfied demo at https://github.com/pschyma/
> servlet-context-test
>
> It's a Gradle build, hope this is ok.
>
> A strange observation regarding PAXWEB-1077 -I'm not sure whether my
> problem is related to this-, but when I remove the context selector from
> the resources registration then PAXWEB-1077 is not triggered, when I
> restart the bundle.
>
> Greetings,
> Peter
>
>
>
> Am Donnerstag, 13. April 2017 17:52:44 UTC+2 schrieb Achim Nierbeck:
>>
>> sorry but these provided sources are really hard to read :/
>>
>> do you have a link to the sources, like a github repo?
>>
>> regards, Achim
>>
>>
>> 2017-04-13 17:43 GMT+02:00 Peter Schyma :
>>
>>> Hi,
>>>
>>> I'm trying to register resources via DS in a shared servlet context but
>>> the registered ServletContextHelper is called with strange resource name
>>> parameter values.
>>>
>>> @Component(
>>>   service = Object.class,
>>>   scope = ServiceScope.PROTOTYPE,
>>>   property = {
>>> HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PREFIX + "=/web",
>>> HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PATTERN + 
>>> "=/resources/*",
>>> DemoServletContext.CONTEXT_SERVICE_SELECTOR
>>>   }
>>> )
>>> public class DemoResourceService {
>>>   // nothing to implement
>>> }
>>>
>>> Code hier eingeben...
>>>
>>> @Component(
>>>   service = ServletContextHelper.class,
>>>   scope = ServiceScope.BUNDLE,
>>>   property = {
>>> HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=" + 
>>> DemoServletContext.NAME,
>>> HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH + "=/demo",
>>>   }
>>> )
>>> public class DemoServletContext
>>>   extends ServletContextHelper {
>>>
>>>   private static final Logger LOGGER = 
>>> LoggerFactory.getLogger(DemoServletContext.class);
>>>
>>>
>>>   public static final String NAME = "demo-ctx";
>>>
>>>
>>>   public static final String CONTEXT_SERVICE_SELECTOR = 
>>> HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT +
>>> "=(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=" + 
>>> DemoServletContext.NAME + ")";
>>>
>>>
>>>   private ServletContextHelper delegate;
>>>
>>>
>>>   @Activate
>>>   public void activate(BundleContext bundleContext) {
>>> delegate = new ServletContextHelper(bundleContext.getBundle()) {
>>> };
>>>   }
>>>
>>>
>>>   @Override
>>>   public URL getResource(String name) {
>>> LOGGER.info("requested resource: {}", name);
>>> return delegate.getResource(name);
>>>   }
>>>
>>>
>>>   @Override
>>>   public String getMimeType(String name) {
>>> return delegate.getMimeType(name);
>>>   }
>>>
>>>
>>>   @Override
>>>   public Set getResourcePaths(String path) {
>>> return delegate.getResourcePaths(path);
>>>   }
>>>
>>>
>>>   @Override
>>>   public String getRealPath(String path) {
>>> return delegate.getRealPath(path);
>>>   }
>>>
>>> }
>>>
>>>
>>> Using this simple setup and issuing a request for "
>>> http://localhost:8181/demo/resources/demo.html; prints "requested
>>> resource: //webdemo.html" in Karaf.
>>>
>>> I tested this with Karaf 4.1.1 and Pax Web 6.1.0-SNAPSHOT.
>>>
>>> Removing the context selector does not make the resources accessible at "
>>> http://localhost:8181/resources/demo.html;. I don't see any output
>>> related to looking up the file. Accessing /resources/ emits following in
>>> the log:
>>> 2017-04-13 17:35:22,994 | DEBUG | tp1929020177-132 | DefaultHttpContext
>>>   | 240 - org.ops4j.pax.web.pax-web-runtime - 6.1.0.SNAPSHOT
>>> | Searching bundle [servlet-context-test [242]] for resource [web]
>>> 2017-04-13 17:35:22,994 | DEBUG | tp1929020177-132 | DefaultHttpContext
>>>   | 240 - org.ops4j.pax.web.pax-web-runtime - 6.1.0.SNAPSHOT
>>> | Searching bundle [servlet-context-test [242]] for resource [web/index.
>>> html]
>>> 2017-04-13 17:35:22,994 | DEBUG | tp1929020177-132 | DefaultHttpContext
>>>   | 240 - org.ops4j.pax.web.pax-web-runtime - 6.1.0.SNAPSHOT
>>> | Searching bundle [servlet-context-test [242]] for resource [web/index.
>>> jsp]
>>>
>>> Am I missing something?
>>>
>>> Thanks
>>> Peter
>>>
>>> --
>>> --
>>> --
>>> OPS4J - http://www.ops4j.org - op...@googlegroups.com
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "OPS4J" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to ops4j+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Apache Member
>> Apache Karaf 

Re: [pax-web][whiteboard] Unable to access resources that are registered to context

2017-04-13 Thread Peter Schyma
Please find the simplyfied demo at 
https://github.com/pschyma/servlet-context-test

It's a Gradle build, hope this is ok. 

A strange observation regarding PAXWEB-1077 -I'm not sure whether my 
problem is related to this-, but when I remove the context selector from 
the resources registration then PAXWEB-1077 is not triggered, when I 
restart the bundle.

Greetings,
Peter



Am Donnerstag, 13. April 2017 17:52:44 UTC+2 schrieb Achim Nierbeck:
>
> sorry but these provided sources are really hard to read :/ 
>
> do you have a link to the sources, like a github repo?
>
> regards, Achim 
>
>
> 2017-04-13 17:43 GMT+02:00 Peter Schyma :
>
>> Hi,
>>
>> I'm trying to register resources via DS in a shared servlet context but 
>> the registered ServletContextHelper is called with strange resource name 
>> parameter values.
>>
>> @Component(
>>   service = Object.class,
>>   scope = ServiceScope.PROTOTYPE,
>>   property = {
>> HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PREFIX + "=/web",
>> HttpWhiteboardConstants.HTTP_WHITEBOARD_RESOURCE_PATTERN + 
>> "=/resources/*",
>> DemoServletContext.CONTEXT_SERVICE_SELECTOR
>>   }
>> )
>> public class DemoResourceService {
>>   // nothing to implement
>> }
>>
>> Code hier eingeben...
>>
>> @Component(
>>   service = ServletContextHelper.class,
>>   scope = ServiceScope.BUNDLE,
>>   property = {
>> HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=" + 
>> DemoServletContext.NAME,
>> HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_PATH + "=/demo",
>>   }
>> )
>> public class DemoServletContext
>>   extends ServletContextHelper {
>>
>>   private static final Logger LOGGER = 
>> LoggerFactory.getLogger(DemoServletContext.class);
>>
>>
>>   public static final String NAME = "demo-ctx";
>>
>>
>>   public static final String CONTEXT_SERVICE_SELECTOR = 
>> HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_SELECT +
>> "=(" + HttpWhiteboardConstants.HTTP_WHITEBOARD_CONTEXT_NAME + "=" + 
>> DemoServletContext.NAME + ")";
>>
>>
>>   private ServletContextHelper delegate;
>>
>>
>>   @Activate
>>   public void activate(BundleContext bundleContext) {
>> delegate = new ServletContextHelper(bundleContext.getBundle()) {
>> };
>>   }
>>
>>
>>   @Override
>>   public URL getResource(String name) {
>> LOGGER.info("requested resource: {}", name);
>> return delegate.getResource(name);
>>   }
>>
>>
>>   @Override
>>   public String getMimeType(String name) {
>> return delegate.getMimeType(name);
>>   }
>>
>>
>>   @Override
>>   public Set getResourcePaths(String path) {
>> return delegate.getResourcePaths(path);
>>   }
>>
>>
>>   @Override
>>   public String getRealPath(String path) {
>> return delegate.getRealPath(path);
>>   }
>>
>> }
>>
>>
>> Using this simple setup and issuing a request for "
>> http://localhost:8181/demo/resources/demo.html; prints "requested 
>> resource: //webdemo.html" in Karaf.
>>
>> I tested this with Karaf 4.1.1 and Pax Web 6.1.0-SNAPSHOT.
>>
>> Removing the context selector does not make the resources accessible at "
>> http://localhost:8181/resources/demo.html;. I don't see any output 
>> related to looking up the file. Accessing /resources/ emits following in 
>> the log:
>> 2017-04-13 17:35:22,994 | DEBUG | tp1929020177-132 | DefaultHttpContext 
>>   | 240 - org.ops4j.pax.web.pax-web-runtime - 6.1.0.SNAPSHOT 
>> | Searching bundle [servlet-context-test [242]] for resource [web]
>> 2017-04-13 17:35:22,994 | DEBUG | tp1929020177-132 | DefaultHttpContext 
>>   | 240 - org.ops4j.pax.web.pax-web-runtime - 6.1.0.SNAPSHOT 
>> | Searching bundle [servlet-context-test [242]] for resource [web/index.
>> html]
>> 2017-04-13 17:35:22,994 | DEBUG | tp1929020177-132 | DefaultHttpContext 
>>   | 240 - org.ops4j.pax.web.pax-web-runtime - 6.1.0.SNAPSHOT 
>> | Searching bundle [servlet-context-test [242]] for resource [web/index.
>> jsp]
>>
>> Am I missing something?
>>
>> Thanks
>> Peter
>>
>> -- 
>> -- 
>> --
>> OPS4J - http://www.ops4j.org - op...@googlegroups.com 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ops4j+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Apache Member
> Apache Karaf  Committer & PMC
> OPS4J Pax Web  Committer & 
> Project Lead
> blog 
> Co-Author of Apache Karaf Cookbook 
>
> Software Architect / Project Manager / Scrum Master 
>
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 

Re: [pax-cdi] Pax-cdi 1.0.0.RC2 - > @Singleton are ignored when bean-discovery-mode="annotated"

2017-04-13 Thread Pavel
Done. https://ops4j1.jira.com/browse/PAXCDI-231

среда, 12 апреля 2017 г., 22:22:51 UTC+3 пользователь Guillaume Nodet 
написал:
>
> Could you raise a JIRA issue on pax-cdi and provide the necessary bundles 
> to replicate the problem ? A unit test would be even better ...
>
> 2017-04-12 21:17 GMT+02:00 Pavel :
>
>> Hi all
>>
>> Before I used pax-cdi 0.13.0-SNAPSHOT with pax-web 6.0.0-SNAPSHOT with 
>> weld-osgi-bundle-2.2.12.Final.jar and I didn't have any problems.
>>
>> Today I started to use pax-cdi 1.0.0.RC2 with pax-web 6.1.0-SNAPSHOT with 
>> weld-osgi-bundle-2.3.5.Final.jar. And I have a problem -
>> when I set bean-discovery-mode="annotated" @Singleton beans are totally 
>> ignored. At the same time @Dependent and @ApplicationScoped are
>> found.
>>
>> The only information I found is 
>> https://issues.jboss.org/browse/WELD-1733?_sscc=t but it says about 
>> 2.2.4 but I used 2.2.12 on it was ok.
>>
>> This is my beans.xml
>>
>> 
>> http://xmlns.jcp.org/xml/ns/javaee;
>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
>>xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
>> http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd;
>>bean-discovery-mode="annotated">
>> 
>>
>> Could anyone advise something?
>>
>> Best regards, Pavel
>>
>>
>>
>> -- 
>> -- 
>> --
>> OPS4J - http://www.ops4j.org - op...@googlegroups.com 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to ops4j+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> 
> Guillaume Nodet
>
>

-- 
-- 
--
OPS4J - http://www.ops4j.org - ops4j@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ops4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.