org.apache.cxf.jaxrs.provider.MultipartProvider Java Examples

The following examples show how to use org.apache.cxf.jaxrs.provider.MultipartProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Server.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected Server() throws Exception {
    org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(9000);

    final ServletHolder servletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
    final ServletContextHandler context = new ServletContextHandler();
    context.setContextPath("/");
    context.addServlet(servletHolder, "/*");
    servletHolder.setInitParameter("jaxrs.serviceClasses", Sample.class.getName());
    servletHolder.setInitParameter("jaxrs.features",
        OpenApiFeature.class.getName());
    servletHolder.setInitParameter("jaxrs.providers", StringUtils.join(
        new String[] {
            MultipartProvider.class.getName(),
            JacksonJsonProvider.class.getName(),
            ApiOriginFilter.class.getName()
        }, ",")
    );

    server.setHandler(context);
    server.start();
    server.join();
}
 
Example #2
Source File: Server.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected Server() throws Exception {
    org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(9000);

    final ServletHolder servletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
    final ServletContextHandler context = new ServletContextHandler();
    context.setContextPath("/");
    context.addServlet(servletHolder, "/*");
    servletHolder.setInitParameter("jaxrs.serviceClasses", Sample.class.getName());
    servletHolder.setInitParameter("jaxrs.features",
        Swagger2Feature.class.getName());
    servletHolder.setInitParameter("jaxrs.providers", StringUtils.join(
        new String[] {
            MultipartProvider.class.getName(),
            JacksonJsonProvider.class.getName(),
            ApiOriginFilter.class.getName()
        }, ",")
    );

    server.setHandler(context);
    server.start();
    server.join();
}
 
Example #3
Source File: JAXRSClientServerTikaTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected void run() {
    JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();

    final Map< String, Object > properties = new HashMap<>();
    properties.put("search.query.parameter.name", "$filter");
    properties.put("search.parser", new FiqlParser< SearchBean >(SearchBean.class));
    properties.put(SearchUtils.DATE_FORMAT_PROPERTY, "yyyy/MM/dd");

    sf.setResourceClasses(BookCatalog.class);
    sf.setResourceProvider(BookCatalog.class, new SingletonResourceProvider(new BookCatalog()));
    sf.setAddress("http://localhost:" + PORT + "/");
    sf.setProperties(properties);
    sf.setProvider(new MultipartProvider());
    sf.setProvider(new SearchContextProvider());
    sf.setProvider(new JacksonJsonProvider());

    sf.create();
}
 
Example #4
Source File: StoreApiTest.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    List<?> providers = Arrays.asList(new JacksonJsonProvider(), new JacksonXMLProvider(), new MultipartProvider());

    api = JAXRSClientFactory.create("http://localhost:" + serverPort + "/services", StoreApi.class, providers);
    org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);

    ClientConfiguration config = WebClient.getConfig(client); 
}
 
Example #5
Source File: PetApiTest.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    List<?> providers = Arrays.asList(new JacksonJsonProvider(), new JacksonXMLProvider(), new MultipartProvider());

    api = JAXRSClientFactory.create("http://localhost:" + serverPort + "/services", PetApi.class, providers);
    org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);

    ClientConfiguration config = WebClient.getConfig(client); 
}
 
Example #6
Source File: FakeClassnameTags123ApiTest.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    List<?> providers = Arrays.asList(new JacksonJsonProvider(), new JacksonXMLProvider(), new MultipartProvider());

    api = JAXRSClientFactory.create("http://localhost:" + serverPort + "/services", FakeClassnameTags123Api.class, providers);
    org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);

    ClientConfiguration config = WebClient.getConfig(client); 
}
 
Example #7
Source File: UserApiTest.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    List<?> providers = Arrays.asList(new JacksonJsonProvider(), new JacksonXMLProvider(), new MultipartProvider());

    api = JAXRSClientFactory.create("http://localhost:" + serverPort + "/services", UserApi.class, providers);
    org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);

    ClientConfiguration config = WebClient.getConfig(client); 
}
 
Example #8
Source File: FakeApiTest.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    List<?> providers = Arrays.asList(new JacksonJsonProvider(), new JacksonXMLProvider(), new MultipartProvider());

    api = JAXRSClientFactory.create("http://localhost:" + serverPort + "/services", FakeApi.class, providers);
    org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);

    ClientConfiguration config = WebClient.getConfig(client); 
}
 
Example #9
Source File: AnotherFakeApiTest.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    List<?> providers = Arrays.asList(new JacksonJsonProvider(), new JacksonXMLProvider(), new MultipartProvider());

    api = JAXRSClientFactory.create("http://localhost:" + serverPort + "/services", AnotherFakeApi.class, providers);
    org.apache.cxf.jaxrs.client.Client client = WebClient.client(api);

    ClientConfiguration config = WebClient.getConfig(client); 
}
 
Example #10
Source File: CxfServerBean.java    From bamboobsc with Apache License 2.0 5 votes vote down vote up
public static List<Object> getProvider() {
	List<Object> providers = new ArrayList<Object>();
	providers.add(new JSONProvider<Object>());
	providers.add(new JAXBElementProvider<Object>());
	providers.add(new MultipartProvider());
	providers.add(new XPathProvider<Object>());
	providers.add(new DataBindingProvider<Object>());
	providers.add(new BinaryDataProvider<Object>());
	providers.add(new JacksonJaxbJsonProvider());
	return providers;
}
 
Example #11
Source File: Server.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected Server() throws Exception {
    org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(9000);

    // Configuring all static web resource
    final ServletHolder staticHolder = new ServletHolder(new DefaultServlet());
    // Register and map the dispatcher servlet
    final ServletHolder servletHolder = new ServletHolder(new CXFNonSpringJaxrsServlet());
    final ServletContextHandler context = new ServletContextHandler();
    context.setContextPath("/");
    context.addServlet(staticHolder, "/static/*");
    context.addServlet(servletHolder, "/*");
    context.setResourceBase(getClass().getResource("/browser").toURI().toString());

    servletHolder.setInitParameter("redirects-list",
        "/ /index.html /js/fileinput.min.js /css/fileinput.min.css");
    servletHolder.setInitParameter("redirect-servlet-name", staticHolder.getName());
    servletHolder.setInitParameter("redirect-attributes", "javax.servlet.include.request_uri");
    servletHolder.setInitParameter("jaxrs.serviceClasses", Catalog.class.getName());
    servletHolder.setInitParameter("jaxrs.properties", StringUtils.join(
        new String[] {
            "search.query.parameter.name=$filter",
            SearchUtils.DATE_FORMAT_PROPERTY + "=yyyy/MM/dd"
        }, " ")
    );
    servletHolder.setInitParameter("jaxrs.providers", StringUtils.join(
        new String[] {
            MultipartProvider.class.getName(),
            SearchContextProvider.class.getName(),
            JsrJsonpProvider.class.getName(),
            CrossOriginResourceSharingFilter.class.getName()
        }, ",")
    );

    server.setHandler(context);
    server.start();
    server.join();
}
 
Example #12
Source File: JAXRSClientServerTikaTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
private WebClient createWebClient(final String url) {
    WebClient wc = WebClient.create("http://localhost:" + PORT + url,
        Arrays.asList(new MultipartProvider(), new JacksonJsonProvider()));
    WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(10000000L);
    return wc;
}