com.liferay.object.rest.internal.jaxrs.exception.mapper.ObjectEntryCountExceptionMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.object.rest.impl
Show all versions of com.liferay.object.rest.impl
Liferay Object REST Implementation
/**
* SPDX-FileCopyrightText: (c) 2023 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.object.rest.internal.jaxrs.exception.mapper;
import com.liferay.object.exception.ObjectEntryCountException;
import com.liferay.object.jaxrs.exception.mapper.util.ObjectExceptionMapperUtil;
import com.liferay.portal.kernel.language.Language;
import com.liferay.portal.vulcan.accept.language.AcceptLanguage;
import com.liferay.portal.vulcan.jaxrs.exception.mapper.BaseExceptionMapper;
import com.liferay.portal.vulcan.jaxrs.exception.mapper.Problem;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Provider;
/**
* @author Thalles Montenegro
*/
@Provider
public class ObjectEntryCountExceptionMapper
extends BaseExceptionMapper {
public ObjectEntryCountExceptionMapper(Language language) {
_language = language;
}
@Override
protected Problem getProblem(
ObjectEntryCountException objectEntryCountException) {
return new Problem(
Response.Status.BAD_REQUEST,
ObjectExceptionMapperUtil.getTitle(
_acceptLanguage, objectEntryCountException.getArguments(),
_language, objectEntryCountException.getMessage(),
objectEntryCountException.getMessageKey()));
}
@Context
private AcceptLanguage _acceptLanguage;
private final Language _language;
}