Skip to content

Commit

Permalink
Merge branch 'ee9' of https://github.com/resteasy/Resteasy into xJun7…
Browse files Browse the repository at this point in the history
…-upstream-ee9
  • Loading branch information
rsearls committed Jun 8, 2021
2 parents e3ec446 + 50c1f0c commit aa65646
Show file tree
Hide file tree
Showing 5 changed files with 200 additions and 5 deletions.
Expand Up @@ -635,7 +635,6 @@ public Builder createLinkBuilder()

@Override
public SeBootstrap.Configuration.Builder createConfigurationBuilder() {
//TODO:3.1 implementation
return null;
}

Expand Down
Expand Up @@ -39,6 +39,8 @@
import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
import org.jboss.resteasy.resteasy_jaxrs.i18n.LogMessages;
import org.jboss.resteasy.resteasy_jaxrs.i18n.Messages;
import org.jboss.resteasy.specimpl.BootstrapConfigurationBuilderImpl;
import org.jboss.resteasy.specimpl.EntityPartBuilderImpl;
import org.jboss.resteasy.spi.AsyncClientResponseProvider;
import org.jboss.resteasy.spi.AsyncResponseProvider;
import org.jboss.resteasy.spi.AsyncStreamProvider;
Expand Down Expand Up @@ -1684,8 +1686,7 @@ public Link.Builder createLinkBuilder()

@Override
public SeBootstrap.Configuration.Builder createConfigurationBuilder() {
//TODO:3.1 implementation
return null;
return new BootstrapConfigurationBuilderImpl();
}

@Override
Expand All @@ -1697,8 +1698,7 @@ public CompletionStage<SeBootstrap.Instance> bootstrap(Application application,

@Override
public EntityPart.Builder createEntityPartBuilder(String partName) throws IllegalArgumentException {
//TODO:3.1 implementation
return null;
return new EntityPartBuilderImpl(partName);
}

public <I extends RxInvoker> RxInvokerProvider<I> getRxInvokerProvider(Class<I> clazz)
Expand Down
@@ -0,0 +1,85 @@
package org.jboss.resteasy.specimpl;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiFunction;

import javax.net.ssl.SSLContext;

import jakarta.ws.rs.SeBootstrap;

public class BootstrapConfigurationBuilderImpl implements SeBootstrap.Configuration.Builder {
private Map<String, Object> properties = new HashMap<String, Object>();
@SuppressWarnings("rawtypes")
private BiFunction propertiesProvider;

@Override
public SeBootstrap.Configuration build() {
return null;
}

@Override
public SeBootstrap.Configuration.Builder property(String name, Object value) {
properties.put(name, value);
return this;
}

@Override
public SeBootstrap.Configuration.Builder protocol(String protocol) {
return SeBootstrap.Configuration.Builder.super.protocol(protocol);
}

@Override
public SeBootstrap.Configuration.Builder host(String host) {
return SeBootstrap.Configuration.Builder.super.host(host);
}

@Override
public SeBootstrap.Configuration.Builder port(Integer port) {
return SeBootstrap.Configuration.Builder.super.port(port);
}

@Override
public SeBootstrap.Configuration.Builder rootPath(String rootPath) {
return SeBootstrap.Configuration.Builder.super.rootPath(rootPath);
}

@Override public SeBootstrap.Configuration.Builder sslContext(SSLContext sslContext) {
return SeBootstrap.Configuration.Builder.super.sslContext(sslContext);
}

@Override
public SeBootstrap.Configuration.Builder sslClientAuthentication(
SeBootstrap.Configuration.SSLClientAuthentication sslClientAuthentication) {
return SeBootstrap.Configuration.Builder.super.sslClientAuthentication(sslClientAuthentication);
}

@Override
public <T> SeBootstrap.Configuration.Builder from(BiFunction<String, Class<T>, Optional<T>> propertiesProvider) {
Objects.requireNonNull(propertiesProvider);
this.propertiesProvider = propertiesProvider;
return this;
}

@Override
public SeBootstrap.Configuration.Builder from(Object externalConfig) {
return SeBootstrap.Configuration.Builder.super.from(externalConfig);
}
private class ServerConfiguration implements jakarta.ws.rs.SeBootstrap.Configuration {
@Override
@SuppressWarnings({"rawtypes", "unchecked"})
public Object property(String name)
{
Object result = properties.get(name);
if (result == null && propertiesProvider != null)
{
result = propertiesProvider.apply(name, Object.class);
return ((Optional)result).isPresent() ? ((Optional)result).get() : null;
}
return result;
}
}

}
@@ -0,0 +1,61 @@
package org.jboss.resteasy.specimpl;

import java.io.IOException;
import java.io.InputStream;

import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.EntityPart;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.MultivaluedMap;

public class EntityPartBuilderImpl implements EntityPart.Builder{
private String part;
public EntityPartBuilderImpl(final String part) {
this.part = part;
}
@Override
public EntityPart.Builder mediaType(MediaType mediaType) throws IllegalArgumentException {
return null;
}

@Override
public EntityPart.Builder mediaType(String mediaTypeString) throws IllegalArgumentException {
return null;
}

@Override
public EntityPart.Builder header(String headerName, String... headerValues) throws IllegalArgumentException {
return null;
}

@Override
public EntityPart.Builder headers(MultivaluedMap<String, String> newHeaders) throws IllegalArgumentException {
return null;
}

@Override
public EntityPart.Builder fileName(String fileName) throws IllegalArgumentException {
return null;
}

@Override
public EntityPart.Builder content(InputStream content) throws IllegalArgumentException {
return null;
}

@Override
public <T> EntityPart.Builder content(T content, Class<? extends T> type) throws IllegalArgumentException {
return null;
}

@Override
public <T> EntityPart.Builder content(T content, GenericType<T> type) throws IllegalArgumentException {
return null;
}

@Override
public EntityPart build() throws IllegalStateException, IOException, WebApplicationException {
return null;
}
}
@@ -0,0 +1,50 @@
package org.jboss.resteasy.specimpl;

import java.io.IOException;
import java.io.InputStream;
import java.util.Optional;

import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.EntityPart;
import jakarta.ws.rs.core.GenericType;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.MultivaluedMap;
//TODO: 3.1 implementation
public class EntityPartImpl implements EntityPart {
@Override
public String getName() {
return null;
}

@Override
public Optional<String> getFileName() {
return Optional.empty();
}

@Override
public InputStream getContent() {
return null;
}

@Override
public <T> T getContent(Class<T> type)
throws IllegalArgumentException, IllegalStateException, IOException, WebApplicationException {
return null;
}

@Override
public <T> T getContent(GenericType<T> type)
throws IllegalArgumentException, IllegalStateException, IOException, WebApplicationException {
return null;
}

@Override
public MultivaluedMap<String, String> getHeaders() {
return null;
}

@Override
public MediaType getMediaType() {
return null;
}
}

0 comments on commit aa65646

Please sign in to comment.