mirror of https://github.com/apache/lucene.git
SOLR-6476 removing othe vestiges of config REST APIs
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1642660 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f317f12f87
commit
56d7da62ba
|
@ -116,8 +116,7 @@ public abstract class BaseSolrResource extends ServerResource {
|
|||
responseWriter = solrCore.getQueryResponseWriter(responseWriterName);
|
||||
contentType = responseWriter.getContentType(solrRequest, solrResponse);
|
||||
final String path = getRequest().getRootRef().getPath();
|
||||
if ( ! RestManager.SCHEMA_BASE_PATH.equals(path)
|
||||
&& ! RestManager.CONFIG_BASE_PATH.equals(path)) {
|
||||
if ( ! RestManager.SCHEMA_BASE_PATH.equals(path)) {
|
||||
// don't set webapp property on the request when context and core/collection are excluded
|
||||
final int cutoffPoint = path.indexOf("/", 1);
|
||||
final String firstPathElement = -1 == cutoffPoint ? path : path.substring(0, cutoffPoint);
|
||||
|
|
|
@ -60,7 +60,6 @@ public class RestManager {
|
|||
public static final Logger log = LoggerFactory.getLogger(RestManager.class);
|
||||
|
||||
public static final String SCHEMA_BASE_PATH = "/schema";
|
||||
public static final String CONFIG_BASE_PATH = "/config";
|
||||
public static final String MANAGED_ENDPOINT = "/managed";
|
||||
|
||||
// used for validating resourceIds provided during registration
|
||||
|
@ -118,15 +117,12 @@ public class RestManager {
|
|||
private final Pattern reservedEndpointsPattern;
|
||||
|
||||
public Registry() {
|
||||
reservedEndpoints.add(CONFIG_BASE_PATH + MANAGED_ENDPOINT);
|
||||
reservedEndpoints.add(SCHEMA_BASE_PATH + MANAGED_ENDPOINT);
|
||||
|
||||
for (String reservedEndpoint : SolrSchemaRestApi.getReservedEndpoints()) {
|
||||
reservedEndpoints.add(reservedEndpoint);
|
||||
}
|
||||
for (String reservedEndpoint : SolrConfigRestApi.getReservedEndpoints()) {
|
||||
reservedEndpoints.add(reservedEndpoint);
|
||||
}
|
||||
|
||||
reservedEndpointsPattern = getReservedEndpointsPattern();
|
||||
}
|
||||
|
||||
|
@ -192,8 +188,8 @@ public class RestManager {
|
|||
Matcher resourceIdValidator = resourceIdRegex.matcher(resourceId);
|
||||
if (!resourceIdValidator.matches()) {
|
||||
String errMsg = String.format(Locale.ROOT,
|
||||
"Invalid resourceId '%s'; must start with %s or %s.",
|
||||
resourceId, CONFIG_BASE_PATH, SCHEMA_BASE_PATH);
|
||||
"Invalid resourceId '%s'; must start with %s.",
|
||||
resourceId, SCHEMA_BASE_PATH);
|
||||
throw new SolrException(ErrorCode.SERVER_ERROR, errMsg);
|
||||
}
|
||||
|
||||
|
@ -603,7 +599,6 @@ public class RestManager {
|
|||
endpoint = new RestManagerManagedResource(this);
|
||||
endpoint.loadManagedDataAndNotify(null); // no observers for my endpoint
|
||||
// responds to requests to /config/managed and /schema/managed
|
||||
managed.put(CONFIG_BASE_PATH+MANAGED_ENDPOINT, endpoint);
|
||||
managed.put(SCHEMA_BASE_PATH+MANAGED_ENDPOINT, endpoint);
|
||||
|
||||
// init registered managed resources
|
||||
|
@ -734,10 +729,7 @@ public class RestManager {
|
|||
* @param router - Restlet Router
|
||||
*/
|
||||
public synchronized void attachManagedResources(String routerPath, Router router) {
|
||||
|
||||
if (CONFIG_BASE_PATH.equals(routerPath)) {
|
||||
this.configRouter = router;
|
||||
} else if (SCHEMA_BASE_PATH.equals(routerPath)) {
|
||||
if (SCHEMA_BASE_PATH.equals(routerPath)) {
|
||||
this.schemaRouter = router;
|
||||
} else {
|
||||
throw new SolrException(ErrorCode.SERVER_ERROR,
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
package org.apache.solr.rest;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.solr.request.SolrRequestInfo;
|
||||
import org.restlet.Application;
|
||||
import org.restlet.Restlet;
|
||||
import org.restlet.routing.Router;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Restlet servlet handling /<context>/<collection>/config/* URL paths
|
||||
*/
|
||||
public class SolrConfigRestApi extends Application {
|
||||
public static final Logger log = LoggerFactory.getLogger(SolrConfigRestApi.class);
|
||||
|
||||
private Router router;
|
||||
|
||||
public SolrConfigRestApi() {
|
||||
router = new Router(getContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: If and when this API has reserved endpoints, add them to the set returned here.
|
||||
* @see SolrSchemaRestApi#getReservedEndpoints()
|
||||
*/
|
||||
public static Set<String> getReservedEndpoints() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
if (null != router) {
|
||||
router.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind URL paths to the appropriate ServerResource subclass.
|
||||
*/
|
||||
@Override
|
||||
public synchronized Restlet createInboundRoot() {
|
||||
/*
|
||||
log.info("createInboundRoot started for /config");
|
||||
|
||||
router.attachDefault(RestManager.ManagedEndpoint.class);
|
||||
|
||||
// attach all the dynamically registered /config resources
|
||||
RestManager restManager =
|
||||
RestManager.getRestManager(SolrRequestInfo.getRequestInfo());
|
||||
restManager.attachManagedResources(RestManager.CONFIG_BASE_PATH, router);
|
||||
|
||||
log.info("createInboundRoot complete for /config");
|
||||
|
||||
return router;*/
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -47,10 +47,6 @@ abstract public class SolrRestletTestBase extends RestTestBase {
|
|||
solrSchemaRestApi.setInitParameter("org.restlet.application", "org.apache.solr.rest.SolrSchemaRestApi");
|
||||
extraServlets.put(solrSchemaRestApi, "/schema/*"); // '/schema/*' matches '/schema', '/schema/', and '/schema/whatever...'
|
||||
|
||||
final ServletHolder solrConfigRestApi = new ServletHolder("SolrConfigRestApi", ServerServlet.class);
|
||||
solrConfigRestApi.setInitParameter("org.restlet.application", "org.apache.solr.rest.SolrConfigRestApi");
|
||||
extraServlets.put(solrConfigRestApi, "/config/*");
|
||||
|
||||
createJettyAndHarness(TEST_HOME(), "solrconfig.xml", "schema-rest.xml", "/solr", true, extraServlets);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,7 +125,6 @@ public class TestRestManager extends SolrRestletTestBase {
|
|||
Set<String> reservedEndpoints = registry.getReservedEndpoints();
|
||||
assertTrue(reservedEndpoints.size() > 2);
|
||||
assertTrue(reservedEndpoints.contains(RestManager.SCHEMA_BASE_PATH + RestManager.MANAGED_ENDPOINT));
|
||||
assertTrue(reservedEndpoints.contains(RestManager.CONFIG_BASE_PATH + RestManager.MANAGED_ENDPOINT));
|
||||
for (String endpoint : reservedEndpoints) {
|
||||
|
||||
try {
|
||||
|
|
|
@ -135,15 +135,6 @@
|
|||
</init-param>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>SolrConfigRestApi</servlet-name>
|
||||
<servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>org.restlet.application</param-name>
|
||||
<param-value>org.apache.solr.rest.SolrConfigRestApi</param-value>
|
||||
</init-param>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>RedirectOldAdminUI</servlet-name>
|
||||
<url-pattern>/admin/</url-pattern>
|
||||
|
|
Loading…
Reference in New Issue