On Wed, Dec 12, 2018 at 2:21 PM James Bognar <jamesbognar@apache.org> wrote:
Yea, it should be at the following location to be picked up:

/src/main/resources/org/apache/juneau/microservice/resources/files/htdocs/themes/devops.css

However, since you're getting a 500 error, it sounds like something
else is going on.

The fix was made in 8.0.  I'll have to create a branch off of 7.2.2 to
backport it.

Right now, I am seeing the same behavior in 8.0.0-SNAPSHOT. I can test 7.2.3-SNAPSHOT or 8.0.0-SNAPSHOT (which looks 10 days old), you tell me.

With the following on my classpath:
 
- src/main/resources/com/rs/seagull/httpmonitor/admin/htdocs/themes/devops.css, 
- src/main/resources/org/apache/juneau/microservice/resource/files/htdocs/themes/devops.css
- src/main/resources/org/apache/juneau/microservice/resource/files/htdocs/devops.css

my /admin page is styled but admin/logs is not.

Without the files, nothing is styled.

Gary

 
On Wed, Dec 12, 2018 at 4:19 PM Gary Gregory <garydgregory@gmail.com> wrote:
>
>
>
> On Wed, Dec 12, 2018 at 2:01 PM James Bognar <jamesbognar@apache.org> wrote:
>>
>> I think you may be hitting a bug I recently found and fixed in
>> ClasspathResourceFinderSimple.  For the LogsResource class, it's only
>> going to look on the classpath at the location
>> "org/apache.juneau/microservice/resource/files/htdocs".
>>
>
> Is there really a dot in the folder name in "org/apache.juneau/microservice/resource/files/htdocs"? As opposed to "org/apache/juneau/microservice/resource/files/htdocs".
>
> But... if I add the files to my project where /src/main/resources/ is on the classpath in Eclipse:
>
> /src/main/resources/org/apache/juneau/microservice/resource/files/htdocs/themes/devops.css
> /src/main/resources/org/apache/juneau/microservice/resource/files/htdocs/devops.css
>
> The file is still not served.
>
> You are saying that this should work without your fix?
>
> Should I try 7.2.3-SNAPSHOT?
>
> Gary
>
>
>>
>> If you need the files folder to be in the jar, I can fix it in the 7.2
>> branch and cut a 7.2.3 release.  I'll also see if I can reproduce that
>> 500 error.
>>
>> On Wed, Dec 12, 2018 at 3:49 PM James Bognar <jamesbognar@gmail.com> wrote:
>> >
>> > Is that the org.apache.juneau.microservice.resources.LogsResource class?
>> >
>> > A 500 error definitely sounds like something is wrong.  If it can't
>> > find the file, it should be a 404.
>> >
>> > How this works is that the BasicRestConfig interface defines the
>> > following annotation:
>> >    @RestResource(
>> >       staticFiles="$C{REST/staticFiles}"
>> >    )
>> >
>> > Then the config file defines the following:
>> >    [REST]
>> >    # URL mappings to static files in the working directory or classpath.
>> >    staticFiles = htdocs:files/htdocs
>> >
>> > So when a request is sent to /admin/logs/htdocs/..., it gets
>> > intercepted by our resource at /admin/logs which checks to see if the
>> > remainder /htdocs/... matches one of our static file mappings.  If it
>> > does, it tries to find that file in the working directory
>> > "files/htdocs", or in the classpath "files/htdocs".  If it can't find
>> > the file then it should return a 404.
>> >
>> > Out of curiosity, what happens if you place it in the following
>> > location in your classpath?
>> > "org/apache.juneau/microservice/resource/files/htdocs/devops.css"
>> > On Wed, Dec 12, 2018 at 3:36 PM Gary Gregory <garydgregory@gmail.com> wrote:
>> > >
>> > > On Wed, Dec 12, 2018 at 1:35 PM Gary Gregory <garydgregory@gmail.com> wrote:
>> > >>
>> > >> On Wed, Dec 12, 2018 at 1:26 PM Gary Gregory <garydgregory@gmail.com> wrote:
>> > >>>
>> > >>> On Wed, Dec 12, 2018 at 1:08 PM James Bognar <jamesbognar@apache.org> wrote:
>> > >>>>
>> > >>>> Hi Gary,
>> > >>>>
>> > >>>> Two things to check:
>> > >>>> 1) What's the path on the root resource?  Is it "/*"?  If it's "/",
>> > >>>> then subpaths are not going to be picked up.
>> > >>>
>> > >>>
>> > >>> I have:
>> > >>>
>> > >>> @RestResource(
>> > >>> path="/",
>> > >>> ...
>> > >>>
>> > >>> changing that to "/*" does not help :-( but...
>> > >>>
>> > >>>  2) Make sure you have this /files directory in your working directory:
>> > >>>>
>> > >>>> https://github.com/apache/juneau/tree/juneau-7.2.2/juneau-microservice/juneau-microservice-template/files
>> > >>>> The files were moved outside the classpath to make it easier to make
>> > >>>> modifications.  They can also be placed in the root of the jar, but by
>> > >>>> default are being kept outside the jar.
>> > >>>
>> > >>>
>> > >>> If I copy the folders and files from
>> > >>>
>> > >>> https://github.com/apache/juneau/tree/juneau-7.2.2/juneau-microservice/juneau-microservice-template/files
>> > >>>
>> > >>> into my Eclipse/Maven project at
>> > >>>
>> > >>> src/main/resources/com/rs/seagull/httpmonitor/admin/htdocs
>> > >>>
>> > >>> for my @RestResource class com.rs.seagull.httpmonitor.admin.AdminRootResources, then my main page at /admin is now styled (good) but when I click on the built-in "logs" link, then _that_ page is not styled.
>> > >>>
>> > >>> So I copied devops.css to src/main/resources but that does not help.
>> > >>>
>> > >>> What am I missing?
>> > >>
>> > >>
>> > >> A few more details. I embed Jetty and use a jetty.xml to map /admin to com.rs.seagull.httpmonitor.admin.AdminRootResources
>> > >>
>> > >> For the logs page, the browser requests http://localhost:9193/admin/logs/htdocs/themes/devops.css and does not find it.
>> > >
>> > >
>> > > The server returns a 500 which is odd, as opposed to a 404.
>> > >
>> > > Gary
>> > >
>> > >>
>> > >>
>> > >> Where is logs/htdocs/themes/devops.css supposed to be mapped?
>> > >>
>> > >> Gary
>> > >>
>> > >>>
>> > >>> Thank you,
>> > >>> Gary
>> > >>>
>> > >>>
>> > >>>> On Wed, Dec 12, 2018 at 2:52 PM Gary Gregory <garydgregory@gmail.com> wrote:
>> > >>>> >
>> > >>>> > Hi James and all:
>> > >>>> >
>> > >>>> > We embed juneau-microservice-server 7.2.2 programatically and when a browser displays a page, it has NO styling and the server console shows:
>> > >>>> >
>> > >>>> > [2018.12.12 12:41:37 WARNING] [4579979f.404.1] HTTP GET 404 /admin/htdocs/themes/devops.css, Method 'GET' not found on resource with matching pattern on path '/htdocs/themes/devops.css'.
>> > >>>> >
>> > >>>> > We have a demo upcoming and the lack of styling looks _really_ bad :-(
>> > >>>> >
>> > >>>> > Has something changed since 7.1.0 to cause this? Can I change _something_ in our server to pickup the stylesheet?
>> > >>>> >
>> > >>>> > For us to revert to 7.1.0 would mean some code changes :-(
>> > >>>> >
>> > >>>> > Thank you,
>> > >>>> > Gary