|
Apache CXF example source code file (JAXRSClientServerUserResourceTest.java)
The Apache CXF JAXRSClientServerUserResourceTest.java source code/** * 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.systest.jaxrs; import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.cxf.jaxrs.JAXRSServerFactoryBean; import org.apache.cxf.jaxrs.model.Parameter; import org.apache.cxf.jaxrs.model.ParameterType; import org.apache.cxf.jaxrs.model.UserOperation; import org.apache.cxf.jaxrs.model.UserResource; import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase; import org.apache.cxf.testutil.common.AbstractBusTestServerBase; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; public class JAXRSClientServerUserResourceTest extends AbstractBusClientServerTestBase { public static final String PORT = allocatePort(Server.class); @Ignore public static class Server extends AbstractBusTestServerBase { protected void run() { JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); sf.setAddress("http://localhost:" + PORT + "/"); UserResource ur = new UserResource(); ur.setName(BookStoreNoAnnotations.class.getName()); ur.setPath("/bookstoreNoAnnotations"); UserOperation op = new UserOperation(); op.setPath("/books/{id}"); op.setName("getBook"); op.setVerb("GET"); op.setParameters(Collections.singletonList(new Parameter(ParameterType.PATH, "id"))); UserOperation op2 = new UserOperation(); op2.setPath("/books/{id}/chapter"); op2.setName("getBookChapter"); op2.setParameters(Collections.singletonList(new Parameter(ParameterType.PATH, "id"))); List<UserOperation> ops = new ArrayList Other Apache CXF examples (source code examples)Here is a short list of links related to this Apache CXF JAXRSClientServerUserResourceTest.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.