Развертывание модуля Liferay 7.2 не обновляет api - PullRequest
0 голосов
/ 27 мая 2020

У меня: Eclispse Версия: 2019-06 (4.12.0) Идентификатор сборки: 20190614-1200

Liferay 7.2.0 CE GA1. Я использую Gradle.

Я создал модуль rest .

Сначала разверните мой код MyRestWebserviceApplication. java было:

package com.liferaystack.application;

    /**
     * Copyright 2000-present Liferay, Inc.
 *
 * Licensed 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 com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.service.UserLocalService;

import java.util.Collections;
import java.util.Set;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Application;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.jaxrs.whiteboard.JaxrsWhiteboardConstants;
/**
 * @author Liferay
 */
@Component(
    property = {
        JaxrsWhiteboardConstants.JAX_RS_APPLICATION_BASE + "=/pippo",
        JaxrsWhiteboardConstants.JAX_RS_NAME + "=Pippo"
    },
    service = Application.class
)
public class MyRestWebserviceApplication extends Application {

    public Set<Object> getSingletons() {
        return Collections.<Object>singleton(this);
    }

    @GET
    @Produces("text/plain")
    public String working() {
        return "It works!";
    }

    @GET
    @Path("/morning")
    @Produces("text/plain")
    public String hello() {
        return "Good morning! test1";
    }

    @GET
    @Path("/mattina")
    @Produces("text/plain")
    public String helloGa() {
        return "Good morning test2";
    }

    @GET
    @Path("/buonamattina")
    @Produces("text/plain")
    public String buonamattina() {
        return "BUONA MATTINA!";
    }

    @GET
    @Path("/morning/{name}")
    @Produces("text/plain")
    public String morning(
        @PathParam("name") String name,
        @QueryParam("drink") String drink) {

        String greeting = "Good Morning " + name;

        if (drink != null) {
            greeting += ". Would you like some " + drink + "?";
        }

        return greeting;
    }

}

. Я изменил метод вывода hello () , но ответ по-прежнему остается: « Доброе утро! Test1 »:.

package com.liferaystack.application;

/**
 * Copyright 2000-present Liferay, Inc.
 *
 * Licensed 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 com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.service.UserLocalService;

import java.util.Collections;
import java.util.Set;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Application;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.jaxrs.whiteboard.JaxrsWhiteboardConstants;
/**
 * @author Liferay
 */
@Component(
    property = {
        JaxrsWhiteboardConstants.JAX_RS_APPLICATION_BASE + "=/pippo",
        JaxrsWhiteboardConstants.JAX_RS_NAME + "=Pippo"
    },
    service = Application.class
)
public class MyRestWebserviceApplication extends Application {

    public Set<Object> getSingletons() {
        return Collections.<Object>singleton(this);
    }

    @GET
    @Produces("text/plain")
    public String working() {
        return "It works!";
    }

    @GET
    @Path("/morning")
    @Produces("text/plain")
    public String hello() {
        return "Good morning! after first deploy";
    }

    @GET
    @Path("/mattina")
    @Produces("text/plain")
    public String helloGa() {
        return "Good morning test2";
    }

    @GET
    @Path("/buonamattina")
    @Produces("text/plain")
    public String buonamattina() {
        return "BUONA MATTINA!";
    }

    @GET
    @Path("/morning/{name}")
    @Produces("text/plain")
    public String morning(
        @PathParam("name") String name,
        @QueryParam("drink") String drink) {

        String greeting = "Good Morning " + name;

        if (drink != null) {
            greeting += ". Would you like some " + drink + "?";
        }

        return greeting;
    }

}

Я запускаю чистую, сборку, развертывание, но изменения не работают.

Я много раз менял bundle-версию в bnd.bnd. Единственное изменение, которое я вижу, это Bundle-Version в Back-End Liferay:

Bundle-SymbolicName: my-rest-webservice
Bundle-Version: 1.1.4
Liferay-Configuration-Path: /configuration
Require-Capability:\
    osgi.contract;\
        filter:="(&(osgi.contract=JavaJAXRS)(version=2))"
-sources: true
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...