juneau-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Bognar <jamesbog...@apache.org>
Subject Re: Method 'GET' not found on resource with matching pattern on path '/htdocs/themes/devops.css'.
Date Thu, 13 Dec 2018 13:31:03 GMT
A couple of notes:

1) It should be "files/htdocs" like so based on the setting in the
config file, so...
src/main/resources/com/rs/seagull/httpmonitor/admin/files/htdocs/themes/devops.css
I would also try putting a copy of it here as well to see if it
resolves the issue for LogsResource:
/src/main/resources/org/apache/juneau/microservice/resources/files/htdocs/themes/devops.css

2) You shouldn't need staticFiles={"htdocs:htdocs"} at all since it's
being set in the BasicRestConfig interface.

3) On a side note, you shouldn't need to specify any of those
serializers in your annotation since those are also being defined on
the BasicRestConfig interface.  And if you're not interested in the
RDF serializers, you can extend from BasicRestServletGroup instead.

4) If you are still getting 500 errors, try adding the following to
your @RestResource annotation to log errors:
@RestResource(debug="true")
On Wed, Dec 12, 2018 at 7:59 PM Gary Gregory <garydgregory@gmail.com> wrote:
>
> On Wed, Dec 12, 2018 at 3:59 PM James Bognar <jamesbognar@apache.org> wrote:
>>
>> It was fixed in 8.0.0-SNAPSHOT 4 days ago, so if your snapshot is 10
>> days old you're not going to have the fix.
>>
>> I just uploaded a 7.2.3-SNAPSHOT with the fix.  Can you try it again?
>>
>> The files should be located in the following folder:
>> src/main/resources/files/htdocs
>>
>> Also, you shouldn't need staticFiles={"htdocs:htdocs"} on your
>> resource anymore.  The staticFiles value is being defined by the
>> BasicRestConfig interface that your class is likely extending from.
>
>
> James,
>
> I was able to depend and build with 7.2.3-SNAPSHOT but it still does not work.
> My class extends BasicRestServletJenaGroup like this:
>
> @RestResource(
> // @formatter:off
> path="/*",
> title="Access & Connectivity Agent Administration Microservice",
> description="Access & Connectivity Agent Administration Microservice",
>         defaultRequestHeaders= {
>                 "Accept: application/json"
> },
>         serializers={
>                 JsonSerializer.class,
>                 HtmlDocSerializer.class,
>                 HtmlStrippedDocSerializer.class,
>                 HtmlSchemaDocSerializer.class,
>                 SimpleJsonSerializer.class,
>                 JsonSchemaSerializer.class,
>                 XmlDocSerializer.class,
>                 XmlSchemaDocSerializer.class,
>                 UonSerializer.class,
>                 UrlEncodingSerializer.class,
>                 MsgPackSerializer.class,
>                 SoapXmlSerializer.class,
>                 PlainTextSerializer.class
>         },
> htmldoc=@HtmlDoc(
>                 head={
>                         "<link rel='apple-touch-icon' sizes='57x57' href='$U{servlet:/htdocs/images/apple-icon-57x57.png}'/>",
>                         "<link rel='apple-touch-icon' sizes='60x60' href='$U{servlet:/htdocs/images/apple-icon-60x60.png}'/>",
>                         "<link rel='apple-touch-icon' sizes='72x72' href='$U{servlet:/htdocs/images/apple-icon-72x72.png}'/>",
>                         "<link rel='apple-touch-icon' sizes='76x76' href='$U{servlet:/htdocs/images/apple-icon-76x76.png}'/>",
>                         "<link rel='apple-touch-icon' sizes='114x114' href='$U{servlet:/htdocs/images/apple-icon-114x114.png}'/>",
>                         "<link rel='apple-touch-icon' sizes='120x120' href='$U{servlet:/htdocs/images/apple-icon-120x120.png}'/>",
>                         "<link rel='apple-touch-icon' sizes='144x144' href='$U{servlet:/htdocs/images/apple-icon-144x144.png}'/>",
>                         "<link rel='apple-touch-icon' sizes='152x152' href='$U{servlet:/htdocs/images/apple-icon-152x152.png}'/>",
>                         "<link rel='apple-touch-icon' sizes='180x180' href='$U{servlet:/htdocs/images/apple-icon-180x180.png}'/>",
>                         "<link rel='icon' type='image/png' sizes='192x192'  href='$U{servlet:/htdocs/images/android-icon-192x192.png}'/>",
>                         "<link rel='icon' type='image/png' sizes='32x32' href='$U{servlet:/htdocs/images/favicon-32x32.png}'/>",
>                         "<link rel='icon' type='image/png' sizes='96x96' href='$U{servlet:/htdocs/images/favicon-96x96.png}'/>",
>                         "<link rel='icon' type='image/png' sizes='16x16' href='$U{servlet:/htdocs/images/favicon-16x16.png}'/>",
>                         "<link rel='icon' type='image/png' href='$U{servlet:/htdocs/images/favicon.png}'
/>",
>                         "<link rel='shortcut icon' href='$U{servlet:/htdocs/favicon.ico}'
/>",
>                         "<link rel='manifest' href='$U{servlet:/htdocs/manifest.json}'/>",
>                         "<meta name='msapplication-TileColor' content='#ffffff'/>",
>                         "<meta name='msapplication-TileImage' content='$U{servlet:/htdocs/images/ms-icon-144x144.png}'/>",
>                         "<meta name='theme-color' content='#ffffff'/>"
>                 },
>                 header={
>                         "<h1>$R{resourceTitle}</h1>",
>                 "<h2>$R{methodSummary,$R{servletDescription}}</h2>",
>                 "<a href='https://www.rocketsoftware.com'><img src='$U{servlet:/htdocs/images/ram.png}'
style='position:absolute;top:5;right:5;background-color:transparent;height:30px'/></a>"
>         },
> widgets={
> ContentTypeMenuItem.class,
> ThemeMenuItem.class,
> PoweredByRocketSoftware.class
> },
> navlinks={
> "options: servlet:/?method=OPTIONS",
>         "$W{ContentTypeMenuItem}"
> },
> footer="$W{PoweredByRocketSoftware}"
> ),
> staticFiles={"htdocs:htdocs"},
> children={
> ConfigResource.class,
> LogsResource.class
> }
> // @formatter:on
> )
> public class AdminRootResources extends BasicRestServletJenaGroup {
>
> Right now, I see my /admin page styled.
> If I remove staticFiles={"htdocs:htdocs"}, then /admin is not styled.
> On /admin clicking on "logs" displays an unstyled page.
> I have:
> src/main/resources/com/rs/seagull/httpmonitor/admin/htdocs/themes/devops.css
> and I "turned off" the other one like this: src/main/resources/org/apache/juneau/microservice2
(notice the "2")
>
> What else should I try?
>
> Gary
>
>
>> On Wed, Dec 12, 2018 at 4:35 PM Gary Gregory <garydgregory@gmail.com> wrote:
>> >
>> > 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

Mime
View raw message