Repository: cxf Updated Branches: refs/heads/3.1.x-fixes 4da4d2300 -> 2dd91b898
Adding OAuthServiceExceptionMapper, can be useful when the error needs to be mapped to a form Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/2dd91b89 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/2dd91b89 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/2dd91b89 Branch: refs/heads/3.1.x-fixes Commit: 2dd91b898f58e99000711810ac0d179a3614d15d Parents: 4da4d23 Author: Sergey Beryozkin <[email protected]> Authored: Wed Nov 18 12:56:28 2015 +0000 Committer: Sergey Beryozkin <[email protected]> Committed: Wed Nov 18 12:57:42 2015 +0000 ---------------------------------------------------------------------- .../provider/OAuthServiceExceptionMapper.java | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/2dd91b89/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/OAuthServiceExceptionMapper.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/OAuthServiceExceptionMapper.java b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/OAuthServiceExceptionMapper.java new file mode 100644 index 0000000..7545570 --- /dev/null +++ b/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/OAuthServiceExceptionMapper.java @@ -0,0 +1,31 @@ +/** + * 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. + */ +package org.apache.cxf.rs.security.oauth2.provider; + +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.ExceptionMapper; + +public class OAuthServiceExceptionMapper implements ExceptionMapper<OAuthServiceException> { + + @Override + public Response toResponse(OAuthServiceException exception) { + return Response.ok().entity(exception.getError()).build(); + } + +}
