Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Change Solr/Jetty "root context” (default) contextPath =“/“ ?

Matthew,

Looks like a little bug on solr.  In jetty 9.1.something we changed the definition of the webdefault.xml file to avoid the "Uncovered http methods" warning. This is related to the security-constraint for the TRACE method.  We used to have:


  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Disable TRACE</web-resource-name>
      <url-pattern>/</url-pattern>
      <http-method>TRACE</http-method>
    </web-resource-collection>
    <auth-constraint/>
  </security-constraint>

Which meant that according to the servlet spec there were indeed uncovered methods.

So we changed it to this couplet instead:

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Disable TRACE</web-resource-name>
      <url-pattern>/</url-pattern>
      <http-method>TRACE</http-method>
    </web-resource-collection>
    <auth-constraint/>
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Enable everything but TRACE</web-resource-name>
      <url-pattern>/</url-pattern>
      <http-method-omission>TRACE</http-method-omission>
    </web-resource-collection>
  </security-constraint>

However, I notice that solr has the old definition in their etc/webdefault.xml file, and they have chosen to add the extra definition only to the web.xml file of their solr-webapp.

So the easiest thing for you to do is:

1. copy the extra security-constraint into the etc/webdefault.xml file so it applies to all webapps
2. let solr know :)

cheers
Jan


On 16 November 2016 at 15:55, matthew grisius <matthew.grisius@xxxxxxxxxxx> wrote:
Hi Simone,

I can now deploy my app that uses Solr via Jetty similar to my previous tomcat/tomee+ stack, thank you so much!
It took me a while to recreate my data sources along with upgrade to latest Solr 6.3.0 and run full tests to reply back.
As you suggested I commented out the RewriteHandler def and reference.
Then I add servlet or static content at “/“ with the following in server/etc/ dir:

CLJServlet.xml:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <!-- set "root context" .e.g. "/" -->
  <Set name="contextPath"><Property name="hostContext" default="/"/></Set>
  <!-- set non-root context, e.g. "/CLJServlet" -->
  <!-- <Set name="contextPath"><Property name="hostContext" default="/CLJServlet"/></Set> -->
  <Set name="war"><Property name="jetty.base"/>/webapps/CLJServlet</Set>
  <Set name="defaultsDescriptor"><Property name="jetty.base"/>/etc/webdefault.xml</Set>
</Configure>

foo.xml:

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.server.handler.ContextHandler">
  <!-- set "root context" .e.g. "/" -->
  <!-- <Set name="contextPath"><Property name="hostContext" default="/"/></Set> -->
  <!-- set non-root context, e.g. "/foo" -->
  <Set name="contextPath"><Property name="hostContext" default="/foo"/></Set>
  <Set name="resourceBase"><Property name="jetty.home" />/webapps/foo</Set>
  <Set name="handler">
    <New class="org.eclipse.jetty.server.handler.ResourceHandler">
      <!-- nothing required here --> 
    </New>
  </Set>
</Configure>

I’m assuming that these are the accepted ways to define a minimal idiomatic Jetty “Configure” for a servlet or static definition?

Also, It does not present a problem but I get an interesting warning that tomcat/tomee+ did not catch for my servlet:

Log4j (org.slf4j.impl.Log4jLoggerFactory) warnings: {/CLJServlet} has uncovered http methods for path: /

My next steps will be to add authentication realm and integrate a java/clojure/js/clojurescript  client for data import, currently import is via Nutch 1.11.

Again, thank you so much for taking the time to figure this out for me!!

-m.

On Nov 7, 2016, at 1:35 PM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:

Hi,

On Mon, Nov 7, 2016 at 7:06 AM, matthew grisius
<matthew.grisius@xxxxxxxxxxx> wrote:
Hi Simone,

What I meant to say was Solr is deployed to “/solr” and is then mapped to
“/“, e.g. http://localhost:8983/ gets mapped to
http://localhost:8983/solr/#.
My apology for the confusion, I was cutting-n-pasting from another message
and reversed the sense by accident.
I can add static content, add other servlets (java, clojure), etc.
I want to put a different servlet at “/“ while preserving Solr functionality
at “/solr”.
My unsuccessful attempts included:

- edit contexts/solr-jetty-context.xml (contextPath, add resourceBase, etc.)
- unmap solr rewrite rule to pass thru . . .
- edit other '/contexts/' . . .
- edit etc/webdefault.xml . . .
- bin/solr does not appear to affect "/"
- org.apache.solr.util.SolrCLI does not appear to affect "/"

Perhaps I’m not trying the right combination of things in the right order to
solve the issue, but I’ve run out of simple ideas to try.
This is my first project using Jetty so I am not familiar with any
idiosyncrosies . . .

Try to edit $solr/server/etc/jetty.xml.
In there you will find a RewriteHandler definition:

<New id="RewriteHandler" ...

You should try to comment that out, and also comment out a few lines
below where the RewriteHandler is referenced in the handler collection
structure.

Try again with this rewrite handler removed, and let us know.

-- 
Simone Bordet
----
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
Expert assistance from the creators of Jetty and CometD


Back to the top