Sunday, 15 March 2015

web services - In which XML do I insert the RemoteAddrValve filter? -


I want to restrict one to my web services running under Tomcat 7. Here is an example of Tomcat 7 which hosts many web services, some of these web services are not restricted to a specific IP address, so this restriction should be a per-app.

The initial search on this topic shows that it is possible to add something like this:

   & Lt; Valve classname = "org.apache.catalina.valves.RemoteAddrValve" permission = "127 \. \ D + \. \ D + \. \ D + | :: 1 | 0: 0: 0: 0: 0: 0: 0: 1 "/> & Lt; / Context & gt;  

My problem is that "some XML files" are very misleadingly designated. I understand that this is considered context , but the reference XML can be given anything name ... (this & lt; param-name & gt; context config location web.xml in and gt in the name of & lt; / param-name & gt;; ) Therefore, making available to various sources

  • (I have this file, but I do not have this information, but this is the file that indicates / Em> reference XML, Reference XML not only)
  • (Tomato-wide looks, not per-app)
  • named my reference XML beans.xml And it is located in the WEB-INF / classes subfolder ...

    Can anyone clarify this issue?

    I'm going to experiment with my guess now, but an official answer would be good.

    If you want to include the valve for only one application, & Lt; Context / & gt; You can do this in the block as you have found, there are some different places where you can configure the contact. Explanation below.

    Meta-INF / Context. Xml (not a META-INF subfolder in my battle, only web-INF)

    This is the only place where you can configure the reference from your application. If you want to do this, just create a meta-INF folder in the root of your project (the same place as the web-embed directory). Inside the Meta-INF, create a context.xml file and enter your application specific configuration there.

    When your application is deployed on Tomcat, this reference file (If Tomcat is configured to do so, see CopyXM ), file the $ CATALINA_BASE / conf / Catalina / localhost / & lt; AppName & gt; Copy in .xml and include it in insertion.

    conf \ Catalina \ localhost \ manager.xml (Tomcat-wide, per-app does not appear)

    This should be the actual format $ CATALINA_BASE / conf / Localhost for default 'Catalina' and [Hostname] for default / [enginename] / [hostname] / [appname] .xml where [Enginename] . Thus for the "manager" application, the path you listed is correct. If your application is called "map" then you will use for conf / Catalina / localhost / myapp.xml or root app, you will use conf / Catalina / localhost / root Xml .

    This is the second place where you can put application specific reference configurations, and that will be what I would recommend.

    There are two other places that you can enter the contextual configuration, a conf / context.xml and the other is conf / server.xml . Do not use conf / context.xml in this case because it will be server-wide (i.e. in all your applications). It is possible to use conf / server.xml , but I will suggest against it. Use of conf / server.xml for this kind of configuration is mainly discouraged because it is inflexible and when you make changes, the full server must be restarted.

    For reference ...

    WEB-INF / web.xml (I have that file, but this is the file that reference XML indicates, reference XML is not the same)

    This can not be used for context configurations, but you can use it to configure sublet filters and tomcat ships together, which That works just like a remote address valve.

    This is generally recommended to use a filter, when available, a valve vs.

    My reference is called XML Beans.XML and the web- NF / SUB is located in subfolder ...

    You can not use custom name or location for your context configuration to match one of the names and locations specified by Tomcat For more information on this, see Not.


    No comments:

    Post a Comment