Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* 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.jaxrs;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.logging.Logger;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import org.apache.cxf.common.i18n.BundleUtils;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.ClassHelper;
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.jaxrs.impl.MetadataMap;
import org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor;
import org.apache.cxf.jaxrs.model.ClassResourceInfo;
import org.apache.cxf.jaxrs.model.MethodInvocationInfo;
import org.apache.cxf.jaxrs.model.OperationResourceInfo;
import org.apache.cxf.jaxrs.model.OperationResourceInfoStack;
import org.apache.cxf.jaxrs.model.URITemplate;
import org.apache.cxf.jaxrs.provider.ProviderFactory;
import org.apache.cxf.jaxrs.utils.InjectionUtils;
import org.apache.cxf.jaxrs.utils.JAXRSUtils;
import org.apache.cxf.message.Exchange;
import org.apache.cxf.message.Message;
import org.apache.cxf.message.MessageContentsList;
import org.apache.cxf.service.invoker.AbstractInvoker;
public class JAXRSInvoker extends AbstractInvoker {
private static final Logger LOG = LogUtils.getL7dLogger(JAXRSServiceFactoryBean.class);
private static final ResourceBundle BUNDLE = BundleUtils.getBundle(JAXRSInvoker.class);
private static final String SERVICE_LOADER_AS_CONTEXT = "org.apache.cxf.serviceloader-context";
public JAXRSInvoker() {
}
public Object invoke(Exchange exchange, Object request) {
Response response = exchange.get(Response.class);
if (response != null) {
// this means a blocking request filter provided a Response
// or earlier exception has been converted to Response
//TODO: should we remove response from exchange ?
// or should we rather ignore content list and have
// Response set here for all cases and extract it
// in the out interceptor instead of dealing with the contents list ?
return new MessageContentsList(response);
}
return invoke(exchange, request, getServiceObject(exchange));
}
@SuppressWarnings("unchecked")
public Object invoke(Exchange exchange, Object request, Object resourceObject) {
OperationResourceInfo ori = exchange.get(OperationResourceInfo.class);
ClassResourceInfo cri = ori.getClassResourceInfo();
pushOntoStack(ori, ClassHelper.getRealClass(resourceObject), exchange.getInMessage());
Method methodToInvoke = InjectionUtils.checkProxy(
cri.getMethodDispatcher().getMethod(ori), resourceObject);
if (cri.isRoot()) {
JAXRSUtils.handleSetters(ori, resourceObject,
exchange.getInMessage());
InjectionUtils.injectContextFields(resourceObject,
ori.getClassResourceInfo(),
exchange.getInMessage());
InjectionUtils.injectResourceFields(resourceObject,
ori.getClassResourceInfo(),
exchange.getInMessage());
}
List