source: other-projects/hathitrust/wcsa/extracted-features-solr/trunk/web-portal/WEB-INF/web.xml@ 31622

Last change on this file since 31622 was 31622, checked in by davidb, 7 years ago

Adding in CORS support to Solr

File size: 8.0 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Licensed to the Apache Software Foundation (ASF) under one or more
4 contributor license agreements. See the NOTICE file distributed with
5 this work for additional information regarding copyright ownership.
6 The ASF licenses this file to You under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with
8 the License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17-->
18<web-app xmlns="http://java.sun.com/xml/ns/javaee"
19 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
21 version="2.5"
22 metadata-complete="true"
23>
24
25
26 <!-- Uncomment if you are trying to use a Resin version before 3.0.19.
27 Their XML implementation isn't entirely compatible with Xerces.
28 Below are the implementations to use with Sun's JVM.
29 <system-property javax.xml.xpath.XPathFactory=
30 "com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl"/>
31 <system-property javax.xml.parsers.DocumentBuilderFactory=
32 "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"/>
33 <system-property javax.xml.parsers.SAXParserFactory=
34 "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"/>
35 -->
36
37 <!-- People who want to hardcode their "Solr Home" directly into the
38 WAR File can set the JNDI property here...
39 -->
40 <!--
41 <env-entry>
42 <env-entry-name>solr/home</env-entry-name>
43 <env-entry-value>/put/your/solr/home/here</env-entry-value>
44 <env-entry-type>java.lang.String</env-entry-type>
45 </env-entry>
46 -->
47
48 <!-- Any path (name) registered in solrconfig.xml will be sent to that filter -->
49
50 <filter>
51 <filter-name>cross-origin</filter-name>
52 <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
53 <init-param>
54 <param-name>allowedOrigins</param-name>
55 <param-value>*</param-value><!-- orig example was http://localhost* -->
56 </init-param>
57 <init-param>
58 <param-name>allowedMethods</param-name>
59 <param-value>GET,POST,DELETE,PUT,HEAD,OPTIONS</param-value>
60 </init-param>
61 <init-param>
62 <param-name>allowedHeaders</param-name>
63 <param-value>origin, content-type, cache-control, accept, options, authorization, x-requested-with</param-value>
64 </init-param>
65 <init-param>
66 <param-name>supportsCredentials</param-name>
67 <param-value>true</param-value>
68 </init-param>
69 <init-param>
70 <param-name>chainPreflight</param-name>
71 <param-value>false</param-value>
72 </init-param>
73 </filter>
74
75 <filter-mapping>
76 <filter-name>cross-origin</filter-name>
77 <url-pattern>/*</url-pattern>
78 </filter-mapping>
79
80
81
82 <filter>
83 <filter-name>SolrRequestFilter</filter-name>
84 <filter-class>org.apache.solr.servlet.SolrDispatchFilter</filter-class>
85 <!--
86 Exclude patterns is a list of directories that would be short circuited by the
87 SolrDispatchFilter. It includes all Admin UI related static content.
88 NOTE: It is NOT a pattern but only matches the start of the HTTP ServletPath.
89 -->
90 <init-param>
91 <param-name>excludePatterns</param-name>
92 <param-value>/css/.+,/js/.+,/img/.+,/tpl/.+</param-value>
93 </init-param>
94 </filter>
95
96 <filter-mapping>
97 <!--
98 NOTE: When using multicore, /admin JSP URLs with a core specified
99 such as /solr/coreName/admin/stats.jsp get forwarded by a
100 RequestDispatcher to /solr/admin/stats.jsp with the specified core
101 put into request scope keyed as "org.apache.solr.SolrCore".
102
103 It is unnecessary, and potentially problematic, to have the SolrDispatchFilter
104 configured to also filter on forwards. Do not configure
105 this dispatcher as <dispatcher>FORWARD</dispatcher>.
106 -->
107 <filter-name>SolrRequestFilter</filter-name>
108 <url-pattern>/*</url-pattern>
109 </filter-mapping>
110
111 <servlet>
112 <servlet-name>LoadAdminUI</servlet-name>
113 <servlet-class>org.apache.solr.servlet.LoadAdminUiServlet</servlet-class>
114 </servlet>
115
116 <!-- Remove in Solr 5.0 -->
117 <!-- This sends SC_MOVED_PERMANENTLY (301) for resources that changed in 4.0 -->
118 <servlet>
119 <servlet-name>RedirectOldAdminUI</servlet-name>
120 <servlet-class>org.apache.solr.servlet.RedirectServlet</servlet-class>
121 <init-param>
122 <param-name>destination</param-name>
123 <param-value>${context}/#/</param-value>
124 </init-param>
125 </servlet>
126
127 <servlet>
128 <servlet-name>RedirectOldZookeeper</servlet-name>
129 <servlet-class>org.apache.solr.servlet.RedirectServlet</servlet-class>
130 <init-param>
131 <param-name>destination</param-name>
132 <param-value>${context}/admin/zookeeper</param-value>
133 </init-param>
134 </servlet>
135
136 <servlet>
137 <servlet-name>RedirectLogging</servlet-name>
138 <servlet-class>org.apache.solr.servlet.RedirectServlet</servlet-class>
139 <init-param>
140 <param-name>destination</param-name>
141 <param-value>${context}/#/~logging</param-value>
142 </init-param>
143 </servlet>
144
145 <servlet>
146 <servlet-name>SolrRestApi</servlet-name>
147 <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
148 <init-param>
149 <param-name>org.restlet.application</param-name>
150 <param-value>org.apache.solr.rest.SolrSchemaRestApi</param-value>
151 </init-param>
152 </servlet>
153
154 <servlet-mapping>
155 <servlet-name>RedirectOldAdminUI</servlet-name>
156 <url-pattern>/admin/</url-pattern>
157 </servlet-mapping>
158 <servlet-mapping>
159 <servlet-name>RedirectOldAdminUI</servlet-name>
160 <url-pattern>/admin</url-pattern>
161 </servlet-mapping>
162 <servlet-mapping>
163 <servlet-name>RedirectOldZookeeper</servlet-name>
164 <url-pattern>/zookeeper.jsp</url-pattern>
165 </servlet-mapping>
166 <servlet-mapping>
167 <servlet-name>RedirectOldZookeeper</servlet-name>
168 <url-pattern>/zookeeper</url-pattern>
169 </servlet-mapping>
170 <servlet-mapping>
171 <servlet-name>RedirectLogging</servlet-name>
172 <url-pattern>/logging</url-pattern>
173 </servlet-mapping>
174
175 <servlet-mapping>
176 <servlet-name>LoadAdminUI</servlet-name>
177 <url-pattern>/old.html</url-pattern>
178 </servlet-mapping>
179
180 <servlet-mapping>
181 <servlet-name>LoadAdminUI</servlet-name>
182 <url-pattern>/index.html</url-pattern>
183 </servlet-mapping>
184
185 <servlet-mapping>
186 <servlet-name>SolrRestApi</servlet-name>
187 <url-pattern>/schema/*</url-pattern>
188 </servlet-mapping>
189
190 <mime-mapping>
191 <extension>.xsl</extension>
192 <!-- per http://www.w3.org/TR/2006/PR-xslt20-20061121/ -->
193 <mime-type>application/xslt+xml</mime-type>
194 </mime-mapping>
195
196 <welcome-file-list>
197 <welcome-file>index.html</welcome-file>
198 </welcome-file-list>
199
200 <!-- Get rid of error message -->
201 <security-constraint>
202 <web-resource-collection>
203 <web-resource-name>Disable TRACE</web-resource-name>
204 <url-pattern>/</url-pattern>
205 <http-method>TRACE</http-method>
206 </web-resource-collection>
207 <auth-constraint/>
208 </security-constraint>
209 <security-constraint>
210 <web-resource-collection>
211 <web-resource-name>Enable everything but TRACE</web-resource-name>
212 <url-pattern>/</url-pattern>
213 <http-method-omission>TRACE</http-method-omission>
214 </web-resource-collection>
215 </security-constraint>
216
217
218 <security-constraint>
219 <web-resource-collection>
220 <web-resource-name>Secured area</web-resource-name>
221 <url-pattern>/admin.html</url-pattern>
222 </web-resource-collection>
223 <auth-constraint>
224 <role-name>admin</role-name>
225 </auth-constraint>
226 </security-constraint>
227
228 <login-config>
229 <auth-method>BASIC</auth-method>
230 <realm-name>HTRC-EF Realm</realm-name>
231 </login-config>
232 <security-role>
233 <role-name>admin</role-name>
234 </security-role>
235
236</web-app>
Note: See TracBrowser for help on using the repository browser.