You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by rm...@apache.org on 2014/07/22 19:50:27 UTC
svn commit: r1612628 [4/4] - in
/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec: ./ src/ src/main/
src/main/java/ src/main/java/javax/ src/main/java/javax/ws/
src/main/java/javax/ws/rs/ src/main/java/javax/ws/rs/client/
src/main/java/javax/ws/rs/containe...
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/Response.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/Response.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/Response.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/Response.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,515 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.core;
+
+import javax.ws.rs.ext.RuntimeDelegate;
+import java.lang.annotation.Annotation;
+import java.net.URI;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+
+public abstract class Response {
+
+
+ protected Response() {
+ }
+
+
+ public abstract int getStatus();
+
+
+ public abstract StatusType getStatusInfo();
+
+
+ public abstract Object getEntity();
+
+
+ public abstract <T> T readEntity(Class<T> entityType);
+
+
+ public abstract <T> T readEntity(GenericType<T> entityType);
+
+
+ public abstract <T> T readEntity(Class<T> entityType, Annotation[] annotations);
+
+
+ public abstract <T> T readEntity(GenericType<T> entityType, Annotation[] annotations);
+
+
+ public abstract boolean hasEntity();
+
+
+ public abstract boolean bufferEntity();
+
+
+ public abstract void close();
+
+
+ public abstract MediaType getMediaType();
+
+
+ public abstract Locale getLanguage();
+
+
+ public abstract int getLength();
+
+
+ public abstract Set<String> getAllowedMethods();
+
+
+ public abstract Map<String, NewCookie> getCookies();
+
+
+ public abstract EntityTag getEntityTag();
+
+
+ public abstract Date getDate();
+
+
+ public abstract Date getLastModified();
+
+
+ public abstract URI getLocation();
+
+
+ public abstract Set<Link> getLinks();
+
+
+ public abstract boolean hasLink(String relation);
+
+
+ public abstract Link getLink(String relation);
+
+
+ public abstract Link.Builder getLinkBuilder(String relation);
+
+
+ public abstract MultivaluedMap<String, Object> getMetadata();
+
+
+ public MultivaluedMap<String, Object> getHeaders() {
+ return getMetadata();
+ }
+
+
+ public abstract MultivaluedMap<String, String> getStringHeaders();
+
+
+ public abstract String getHeaderString(String name);
+
+
+ public static ResponseBuilder fromResponse(Response response) {
+ ResponseBuilder b = status(response.getStatus());
+ if (response.hasEntity()) {
+ b.entity(response.getEntity());
+ }
+ for (String headerName : response.getHeaders().keySet()) {
+ List<Object> headerValues = response.getHeaders().get(headerName);
+ for (Object headerValue : headerValues) {
+ b.header(headerName, headerValue);
+ }
+ }
+ return b;
+ }
+
+
+ public static ResponseBuilder status(StatusType status) {
+ return ResponseBuilder.newInstance().status(status);
+ }
+
+
+ public static ResponseBuilder status(Status status) {
+ return status((StatusType) status);
+ }
+
+
+ public static ResponseBuilder status(int status) {
+ return ResponseBuilder.newInstance().status(status);
+ }
+
+
+ public static ResponseBuilder ok() {
+ return status(Status.OK);
+ }
+
+
+ public static ResponseBuilder ok(Object entity) {
+ ResponseBuilder b = ok();
+ b.entity(entity);
+ return b;
+ }
+
+
+ public static ResponseBuilder ok(Object entity, MediaType type) {
+ return ok().entity(entity).type(type);
+ }
+
+
+ public static ResponseBuilder ok(Object entity, String type) {
+ return ok().entity(entity).type(type);
+ }
+
+
+ public static ResponseBuilder ok(Object entity, Variant variant) {
+ return ok().entity(entity).variant(variant);
+ }
+
+
+ public static ResponseBuilder serverError() {
+ return status(Status.INTERNAL_SERVER_ERROR);
+ }
+
+
+ public static ResponseBuilder created(URI location) {
+ return status(Status.CREATED).location(location);
+ }
+
+
+ public static ResponseBuilder accepted() {
+ return status(Status.ACCEPTED);
+ }
+
+
+ public static ResponseBuilder accepted(Object entity) {
+ return accepted().entity(entity);
+ }
+
+
+ public static ResponseBuilder noContent() {
+ return status(Status.NO_CONTENT);
+ }
+
+
+ public static ResponseBuilder notModified() {
+ return status(Status.NOT_MODIFIED);
+ }
+
+
+ public static ResponseBuilder notModified(EntityTag tag) {
+ return notModified().tag(tag);
+ }
+
+
+ @SuppressWarnings("HtmlTagCanBeJavadocTag")
+ public static ResponseBuilder notModified(String tag) {
+ return notModified().tag(tag);
+ }
+
+
+ public static ResponseBuilder seeOther(URI location) {
+ return status(Status.SEE_OTHER).location(location);
+ }
+
+
+ public static ResponseBuilder temporaryRedirect(URI location) {
+ return status(Status.TEMPORARY_REDIRECT).location(location);
+ }
+
+
+ public static ResponseBuilder notAcceptable(List<Variant> variants) {
+ return status(Status.NOT_ACCEPTABLE).variants(variants);
+ }
+
+
+ public static abstract class ResponseBuilder {
+
+
+ protected ResponseBuilder() {
+ }
+
+
+ protected static ResponseBuilder newInstance() {
+ return RuntimeDelegate.getInstance().createResponseBuilder();
+ }
+
+
+ public abstract Response build();
+
+
+ @Override
+ @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException")
+ public abstract ResponseBuilder clone();
+
+
+ public abstract ResponseBuilder status(int status);
+
+
+ public ResponseBuilder status(StatusType status) {
+ if (status == null) {
+ throw new IllegalArgumentException();
+ }
+ return status(status.getStatusCode());
+ }
+
+
+ public ResponseBuilder status(Status status) {
+ return status((StatusType) status);
+ }
+
+
+ public abstract ResponseBuilder entity(Object entity);
+
+
+ public abstract ResponseBuilder entity(Object entity, Annotation[] annotations);
+
+
+ public abstract ResponseBuilder allow(String... methods);
+
+
+ public abstract ResponseBuilder allow(Set<String> methods);
+
+
+ public abstract ResponseBuilder cacheControl(CacheControl cacheControl);
+
+
+ public abstract ResponseBuilder encoding(String encoding);
+
+
+ public abstract ResponseBuilder header(String name, Object value);
+
+
+ public abstract ResponseBuilder replaceAll(MultivaluedMap<String, Object> headers);
+
+
+ public abstract ResponseBuilder language(String language);
+
+
+ public abstract ResponseBuilder language(Locale language);
+
+
+ public abstract ResponseBuilder type(MediaType type);
+
+
+ public abstract ResponseBuilder type(String type);
+
+
+ public abstract ResponseBuilder variant(Variant variant);
+
+
+ public abstract ResponseBuilder contentLocation(URI location);
+
+
+ public abstract ResponseBuilder cookie(NewCookie... cookies);
+
+
+ public abstract ResponseBuilder expires(Date expires);
+
+
+ public abstract ResponseBuilder lastModified(Date lastModified);
+
+
+ public abstract ResponseBuilder location(URI location);
+
+
+ public abstract ResponseBuilder tag(EntityTag tag);
+
+
+ @SuppressWarnings("HtmlTagCanBeJavadocTag")
+ public abstract ResponseBuilder tag(String tag);
+
+
+ public abstract ResponseBuilder variants(Variant... variants);
+
+
+ public abstract ResponseBuilder variants(List<Variant> variants);
+
+
+ public abstract ResponseBuilder links(Link... links);
+
+
+ public abstract ResponseBuilder link(URI uri, String rel);
+
+
+ public abstract ResponseBuilder link(String uri, String rel);
+ }
+
+
+ public interface StatusType {
+
+
+ public int getStatusCode();
+
+
+ public Status.Family getFamily();
+
+
+ public String getReasonPhrase();
+ }
+
+
+ public enum Status implements StatusType {
+
+
+ OK(200, "OK"),
+
+ CREATED(201, "Created"),
+
+ ACCEPTED(202, "Accepted"),
+
+ NO_CONTENT(204, "No Content"),
+
+ RESET_CONTENT(205, "Reset Content"),
+
+ PARTIAL_CONTENT(206, "Partial Content"),
+
+ MOVED_PERMANENTLY(301, "Moved Permanently"),
+
+ FOUND(302, "Found"),
+
+ SEE_OTHER(303, "See Other"),
+
+ NOT_MODIFIED(304, "Not Modified"),
+
+ USE_PROXY(305, "Use Proxy"),
+
+ TEMPORARY_REDIRECT(307, "Temporary Redirect"),
+
+ BAD_REQUEST(400, "Bad Request"),
+
+ UNAUTHORIZED(401, "Unauthorized"),
+
+ PAYMENT_REQUIRED(402, "Payment Required"),
+
+ FORBIDDEN(403, "Forbidden"),
+
+ NOT_FOUND(404, "Not Found"),
+
+ METHOD_NOT_ALLOWED(405, "Method Not Allowed"),
+
+ NOT_ACCEPTABLE(406, "Not Acceptable"),
+
+ PROXY_AUTHENTICATION_REQUIRED(407, "Proxy Authentication Required"),
+
+ REQUEST_TIMEOUT(408, "Request Timeout"),
+
+ CONFLICT(409, "Conflict"),
+
+ GONE(410, "Gone"),
+
+ LENGTH_REQUIRED(411, "Length Required"),
+
+ PRECONDITION_FAILED(412, "Precondition Failed"),
+
+ REQUEST_ENTITY_TOO_LARGE(413, "Request Entity Too Large"),
+
+ REQUEST_URI_TOO_LONG(414, "Request-URI Too Long"),
+
+ UNSUPPORTED_MEDIA_TYPE(415, "Unsupported Media Type"),
+
+ REQUESTED_RANGE_NOT_SATISFIABLE(416, "Requested Range Not Satisfiable"),
+
+ EXPECTATION_FAILED(417, "Expectation Failed"),
+
+ INTERNAL_SERVER_ERROR(500, "Internal Server Error"),
+
+ NOT_IMPLEMENTED(501, "Not Implemented"),
+
+ BAD_GATEWAY(502, "Bad Gateway"),
+
+ SERVICE_UNAVAILABLE(503, "Service Unavailable"),
+
+ GATEWAY_TIMEOUT(504, "Gateway Timeout"),
+
+ HTTP_VERSION_NOT_SUPPORTED(505, "HTTP Version Not Supported");
+ private final int code;
+ private final String reason;
+ private final Family family;
+
+
+ public enum Family {
+
+
+ INFORMATIONAL,
+
+ SUCCESSFUL,
+
+ REDIRECTION,
+
+ CLIENT_ERROR,
+
+ SERVER_ERROR,
+
+ OTHER;
+
+
+ public static Family familyOf(final int statusCode) {
+ switch (statusCode / 100) {
+ case 1:
+ return Family.INFORMATIONAL;
+ case 2:
+ return Family.SUCCESSFUL;
+ case 3:
+ return Family.REDIRECTION;
+ case 4:
+ return Family.CLIENT_ERROR;
+ case 5:
+ return Family.SERVER_ERROR;
+ default:
+ return Family.OTHER;
+ }
+ }
+ }
+
+ Status(final int statusCode, final String reasonPhrase) {
+ this.code = statusCode;
+ this.reason = reasonPhrase;
+ this.family = Family.familyOf(statusCode);
+ }
+
+
+ @Override
+ public Family getFamily() {
+ return family;
+ }
+
+
+ @Override
+ public int getStatusCode() {
+ return code;
+ }
+
+
+ @Override
+ public String getReasonPhrase() {
+ return toString();
+ }
+
+
+ @Override
+ public String toString() {
+ return reason;
+ }
+
+
+ public static Status fromStatusCode(final int statusCode) {
+ for (Status s : Status.values()) {
+ if (s.code == statusCode) {
+ return s;
+ }
+ }
+ return null;
+ }
+ }
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/SecurityContext.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/SecurityContext.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/SecurityContext.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/SecurityContext.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,48 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.core;
+
+import java.security.Principal;
+
+
+public interface SecurityContext {
+
+
+ String BASIC_AUTH = "BASIC";
+
+ String CLIENT_CERT_AUTH = "CLIENT_CERT";
+
+ String DIGEST_AUTH = "DIGEST";
+
+ String FORM_AUTH = "FORM";
+
+
+ Principal getUserPrincipal();
+
+
+ boolean isUserInRole(String role);
+
+
+ boolean isSecure();
+
+
+ String getAuthenticationScheme();
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/StreamingOutput.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/StreamingOutput.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/StreamingOutput.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/StreamingOutput.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,32 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.core;
+
+import javax.ws.rs.WebApplicationException;
+import java.io.IOException;
+import java.io.OutputStream;
+
+
+public interface StreamingOutput {
+
+
+ void write(OutputStream output) throws IOException, WebApplicationException;
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriBuilder.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriBuilder.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriBuilder.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,176 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.core;
+
+import javax.ws.rs.ext.RuntimeDelegate;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.Map;
+
+
+public abstract class UriBuilder {
+
+
+ protected UriBuilder() {
+ }
+
+
+ protected static UriBuilder newInstance() {
+ return RuntimeDelegate.getInstance().createUriBuilder();
+ }
+
+
+ public static UriBuilder fromUri(URI uri) {
+ return newInstance().uri(uri);
+ }
+
+
+ public static UriBuilder fromUri(String uriTemplate) {
+ return newInstance().uri(uriTemplate);
+ }
+
+
+ public static UriBuilder fromLink(Link link) {
+ if (link == null) {
+ throw new IllegalArgumentException("The provider 'link' parameter value is 'null'.");
+ }
+ return UriBuilder.fromUri(link.getUri());
+ }
+
+
+ public static UriBuilder fromPath(String path) throws IllegalArgumentException {
+ return newInstance().path(path);
+ }
+
+
+ public static UriBuilder fromResource(Class<?> resource) {
+ return newInstance().path(resource);
+ }
+
+
+ public static UriBuilder fromMethod(Class<?> resource, String method) {
+ return newInstance().path(resource, method);
+ }
+
+
+ @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException")
+ @Override
+ public abstract UriBuilder clone();
+
+
+ public abstract UriBuilder uri(URI uri);
+
+
+ public abstract UriBuilder uri(String uriTemplate);
+
+
+ public abstract UriBuilder scheme(String scheme);
+
+
+ public abstract UriBuilder schemeSpecificPart(String ssp);
+
+
+ public abstract UriBuilder userInfo(String ui);
+
+
+ public abstract UriBuilder host(String host);
+
+
+ public abstract UriBuilder port(int port);
+
+
+ public abstract UriBuilder replacePath(String path);
+
+
+ public abstract UriBuilder path(String path);
+
+
+ public abstract UriBuilder path(Class resource);
+
+
+ public abstract UriBuilder path(Class resource, String method);
+
+
+ public abstract UriBuilder path(Method method);
+
+
+ public abstract UriBuilder segment(String... segments);
+
+
+ public abstract UriBuilder replaceMatrix(String matrix);
+
+
+ public abstract UriBuilder matrixParam(String name, Object... values);
+
+
+ public abstract UriBuilder replaceMatrixParam(String name, Object... values);
+
+
+ public abstract UriBuilder replaceQuery(String query);
+
+
+ public abstract UriBuilder queryParam(String name, Object... values);
+
+
+ public abstract UriBuilder replaceQueryParam(String name, Object... values);
+
+
+ public abstract UriBuilder fragment(String fragment);
+
+
+ public abstract UriBuilder resolveTemplate(String name, Object value);
+
+
+ public abstract UriBuilder resolveTemplate(String name, Object value, boolean encodeSlashInPath);
+
+
+ public abstract UriBuilder resolveTemplateFromEncoded(String name, Object value);
+
+
+ public abstract UriBuilder resolveTemplates(Map<String, Object> templateValues);
+
+
+ public abstract UriBuilder resolveTemplates(Map<String, Object> templateValues, boolean encodeSlashInPath) throws IllegalArgumentException;
+
+
+ public abstract UriBuilder resolveTemplatesFromEncoded(Map<String, Object> templateValues);
+
+
+ public abstract URI buildFromMap(Map<String, ?> values);
+
+
+ public abstract URI buildFromMap(Map<String, ?> values, boolean encodeSlashInPath) throws IllegalArgumentException, UriBuilderException;
+
+
+ public abstract URI buildFromEncodedMap(Map<String, ?> values) throws IllegalArgumentException, UriBuilderException;
+
+
+ public abstract URI build(Object... values) throws IllegalArgumentException, UriBuilderException;
+
+
+ public abstract URI build(Object[] values, boolean encodeSlashInPath) throws IllegalArgumentException, UriBuilderException;
+
+
+ public abstract URI buildFromEncoded(Object... values) throws IllegalArgumentException, UriBuilderException;
+
+
+ public abstract String toTemplate();
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriBuilderException.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriBuilderException.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriBuilderException.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriBuilderException.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,46 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.core;
+
+
+public class UriBuilderException extends java.lang.RuntimeException {
+
+ private static final long serialVersionUID = 956255913370721193L;
+
+
+ public UriBuilderException() {
+ }
+
+
+ public UriBuilderException(String msg) {
+ super(msg);
+ }
+
+
+ public UriBuilderException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+
+ public UriBuilderException(Throwable cause) {
+ super(cause);
+ }
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriInfo.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriInfo.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriInfo.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/UriInfo.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,86 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.core;
+
+import java.net.URI;
+import java.util.List;
+
+
+public interface UriInfo {
+
+
+ public String getPath();
+
+
+ public String getPath(boolean decode);
+
+
+ public List<PathSegment> getPathSegments();
+
+
+ public List<PathSegment> getPathSegments(boolean decode);
+
+
+ public URI getRequestUri();
+
+
+ public UriBuilder getRequestUriBuilder();
+
+
+ public URI getAbsolutePath();
+
+
+ public UriBuilder getAbsolutePathBuilder();
+
+
+ public URI getBaseUri();
+
+
+ public UriBuilder getBaseUriBuilder();
+
+
+ public MultivaluedMap<String, String> getPathParameters();
+
+
+ public MultivaluedMap<String, String> getPathParameters(boolean decode);
+
+
+ public MultivaluedMap<String, String> getQueryParameters();
+
+
+ public MultivaluedMap<String, String> getQueryParameters(boolean decode);
+
+
+ public List<String> getMatchedURIs();
+
+
+ public List<String> getMatchedURIs(boolean decode);
+
+
+ public List<Object> getMatchedResources();
+
+
+ public URI resolve(URI uri);
+
+
+ public URI relativize(URI uri);
+
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/Variant.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/Variant.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/Variant.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/Variant.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,186 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.core;
+
+import javax.ws.rs.ext.RuntimeDelegate;
+import java.io.StringWriter;
+import java.util.List;
+import java.util.Locale;
+
+
+public class Variant {
+
+ private Locale language;
+ private MediaType mediaType;
+ private String encoding;
+
+
+ public Variant(MediaType mediaType, String language, String encoding) {
+ if (mediaType == null && language == null && encoding == null) {
+ throw new IllegalArgumentException("mediaType, language, encoding all null");
+ }
+ this.encoding = encoding;
+ this.language = (language == null) ? null : new Locale(language);
+ this.mediaType = mediaType;
+ }
+
+
+ public Variant(MediaType mediaType, String language, String country, String encoding) {
+ if (mediaType == null && language == null && encoding == null) {
+ throw new IllegalArgumentException("mediaType, language, encoding all null");
+ }
+ this.encoding = encoding;
+ this.language = (language == null) ? null : new Locale(language, country);
+ this.mediaType = mediaType;
+ }
+
+
+ public Variant(MediaType mediaType, String language, String country, String languageVariant, String encoding) {
+ if (mediaType == null && language == null && encoding == null) {
+ throw new IllegalArgumentException("mediaType, language, encoding all null");
+ }
+ this.encoding = encoding;
+ this.language = (language == null) ? null : new Locale(language, country, languageVariant);
+ this.mediaType = mediaType;
+ }
+
+
+ public Variant(MediaType mediaType, Locale language, String encoding) {
+ if (mediaType == null && language == null && encoding == null) {
+ throw new IllegalArgumentException("mediaType, language, encoding all null");
+ }
+ this.encoding = encoding;
+ this.language = language;
+ this.mediaType = mediaType;
+ }
+
+
+ public Locale getLanguage() {
+ return language;
+ }
+
+
+ public String getLanguageString() {
+ return (language == null) ? null : language.toString();
+ }
+
+
+ public MediaType getMediaType() {
+ return mediaType;
+ }
+
+
+ public String getEncoding() {
+ return encoding;
+ }
+
+
+ public static VariantListBuilder mediaTypes(MediaType... mediaTypes) {
+ VariantListBuilder b = VariantListBuilder.newInstance();
+ b.mediaTypes(mediaTypes);
+ return b;
+ }
+
+
+ public static VariantListBuilder languages(Locale... languages) {
+ VariantListBuilder b = VariantListBuilder.newInstance();
+ b.languages(languages);
+ return b;
+ }
+
+
+ public static VariantListBuilder encodings(String... encodings) {
+ VariantListBuilder b = VariantListBuilder.newInstance();
+ b.encodings(encodings);
+ return b;
+ }
+
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 29 * hash + (this.language != null ? this.language.hashCode() : 0);
+ hash = 29 * hash + (this.mediaType != null ? this.mediaType.hashCode() : 0);
+ hash = 29 * hash + (this.encoding != null ? this.encoding.hashCode() : 0);
+ return hash;
+ }
+
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final Variant other = (Variant) obj;
+ if (this.language != other.language && (this.language == null || !this.language.equals(other.language))) {
+ return false;
+ }
+ if (this.mediaType != other.mediaType && (this.mediaType == null || !this.mediaType.equals(other.mediaType))) {
+ return false;
+ }
+
+ return this.encoding == other.encoding || (this.encoding != null && this.encoding.equals(other.encoding));
+ }
+
+ @Override
+ public String toString() {
+ StringWriter w = new StringWriter();
+ w.append("Variant[mediaType=");
+ w.append(mediaType == null ? "null" : mediaType.toString());
+ w.append(", language=");
+ w.append(language == null ? "null" : language.toString());
+ w.append(", encoding=");
+ w.append(encoding == null ? "null" : encoding);
+ w.append("]");
+ return w.toString();
+ }
+
+
+ public static abstract class VariantListBuilder {
+
+
+ protected VariantListBuilder() {
+ }
+
+
+ public static VariantListBuilder newInstance() {
+ return RuntimeDelegate.getInstance().createVariantListBuilder();
+ }
+
+
+ public abstract List<Variant> build();
+
+
+ public abstract VariantListBuilder add();
+
+
+ public abstract VariantListBuilder languages(Locale... languages);
+
+
+ public abstract VariantListBuilder encodings(String... encodings);
+
+
+ public abstract VariantListBuilder mediaTypes(MediaType... mediaTypes);
+ }
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/package-info.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/package-info.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/package-info.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/core/package-info.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,22 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+
+package javax.ws.rs.core;
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ContextResolver.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ContextResolver.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ContextResolver.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ContextResolver.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,28 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+
+public interface ContextResolver<T> {
+
+
+ T getContext(Class<?> type);
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ExceptionMapper.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ExceptionMapper.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ExceptionMapper.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ExceptionMapper.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,30 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import javax.ws.rs.core.Response;
+
+
+public interface ExceptionMapper<E extends Throwable> {
+
+
+ Response toResponse(E exception);
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/InterceptorContext.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/InterceptorContext.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/InterceptorContext.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/InterceptorContext.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,66 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import javax.ws.rs.core.MediaType;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collection;
+
+
+public interface InterceptorContext {
+
+
+ Object getProperty(String name);
+
+
+ Collection<String> getPropertyNames();
+
+
+ void setProperty(String name, Object object);
+
+
+ void removeProperty(String name);
+
+
+ Annotation[] getAnnotations();
+
+
+ void setAnnotations(Annotation[] annotations);
+
+
+ Class<?> getType();
+
+
+ void setType(Class<?> type);
+
+
+ Type getGenericType();
+
+
+ void setGenericType(Type genericType);
+
+
+ MediaType getMediaType();
+
+
+ void setMediaType(MediaType mediaType);
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/MessageBodyReader.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/MessageBodyReader.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/MessageBodyReader.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/MessageBodyReader.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,37 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.InputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+
+public interface MessageBodyReader<T> {
+
+
+ public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType);
+
+
+ public T readFrom(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws java.io.IOException, javax.ws.rs.WebApplicationException;
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/MessageBodyWriter.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/MessageBodyWriter.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/MessageBodyWriter.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/MessageBodyWriter.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,40 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+
+public interface MessageBodyWriter<T> {
+
+
+ boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType);
+
+
+ long getSize(T t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType);
+
+
+ void writeTo(T t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws java.io.IOException, javax.ws.rs.WebApplicationException;
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ParamConverter.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ParamConverter.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ParamConverter.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ParamConverter.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,44 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+public interface ParamConverter<T> {
+
+
+ @Target({ElementType.TYPE})
+ @Retention(RetentionPolicy.RUNTIME)
+ @Documented
+ public static @interface Lazy {
+ }
+
+
+ T fromString(String value);
+
+
+ String toString(T value);
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ParamConverterProvider.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ParamConverterProvider.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ParamConverterProvider.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ParamConverterProvider.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,31 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+
+public interface ParamConverterProvider {
+
+
+ <T> ParamConverter<T> getConverter(Class<T> rawType, Type genericType, Annotation annotations[]);
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/Provider.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/Provider.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/Provider.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/Provider.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,34 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface Provider {
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/Providers.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/Providers.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/Providers.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/Providers.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,41 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import javax.ws.rs.core.MediaType;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+
+public interface Providers {
+
+
+ <T> MessageBodyReader<T> getMessageBodyReader(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType);
+
+
+ <T> MessageBodyWriter<T> getMessageBodyWriter(Class<T> type, Type genericType, Annotation[] annotations, MediaType mediaType);
+
+
+ <T extends Throwable> ExceptionMapper<T> getExceptionMapper(Class<T> type);
+
+
+ <T> ContextResolver<T> getContextResolver(Class<T> contextType, MediaType mediaType);
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ReaderInterceptor.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ReaderInterceptor.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ReaderInterceptor.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ReaderInterceptor.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,28 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+
+public interface ReaderInterceptor {
+
+
+ Object aroundReadFrom(ReaderInterceptorContext context) throws java.io.IOException, javax.ws.rs.WebApplicationException;
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ReaderInterceptorContext.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ReaderInterceptorContext.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ReaderInterceptorContext.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/ReaderInterceptorContext.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,42 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.IOException;
+import java.io.InputStream;
+
+
+public interface ReaderInterceptorContext extends InterceptorContext {
+
+
+ Object proceed() throws IOException, WebApplicationException;
+
+
+ InputStream getInputStream();
+
+
+ void setInputStream(InputStream is);
+
+
+ MultivaluedMap<String, String> getHeaders();
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegate.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegate.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegate.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegate.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,106 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Link;
+import javax.ws.rs.core.Response.ResponseBuilder;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.Variant.VariantListBuilder;
+import java.lang.reflect.ReflectPermission;
+
+
+public abstract class RuntimeDelegate {
+ public static final String JAXRS_RUNTIME_DELEGATE_PROPERTY = "javax.ws.rs.ext.RuntimeDelegate";
+
+ private static final Object LOCK = new Object();
+ private static ReflectPermission suppressAccessChecksPermission = new ReflectPermission("suppressAccessChecks");
+ private static volatile RuntimeDelegate cachedDelegate;
+
+ protected RuntimeDelegate() {
+ // no-op
+ }
+
+ public static RuntimeDelegate getInstance() {
+ RuntimeDelegate result = cachedDelegate;
+ if (result == null) {
+ synchronized (LOCK) {
+ result = cachedDelegate;
+ if (result == null) {
+ cachedDelegate = result = findDelegate();
+ }
+ }
+ }
+ return result;
+ }
+
+
+ private static RuntimeDelegate findDelegate() {
+ try {
+ final Object delegate = RuntimeDelegateFinder.find(JAXRS_RUNTIME_DELEGATE_PROPERTY);
+ if (!RuntimeDelegate.class.isInstance(delegate)) {
+ throw new LinkageError(delegate + " not an instance of RuntimeDelegate");
+ }
+ return RuntimeDelegate.class.cast(delegate);
+ } catch (Exception ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+
+
+ public static void setInstance(final RuntimeDelegate rd) {
+ final SecurityManager security = System.getSecurityManager();
+ if (security != null) {
+ security.checkPermission(suppressAccessChecksPermission);
+ }
+ synchronized (LOCK) {
+ RuntimeDelegate.cachedDelegate = rd;
+ }
+ }
+
+
+ public abstract UriBuilder createUriBuilder();
+
+
+ public abstract ResponseBuilder createResponseBuilder();
+
+
+ public abstract VariantListBuilder createVariantListBuilder();
+
+
+ public abstract <T> T createEndpoint(Application application, Class<T> endpointType) throws IllegalArgumentException, UnsupportedOperationException;
+
+
+ public abstract <T> HeaderDelegate<T> createHeaderDelegate(Class<T> type) throws IllegalArgumentException;
+
+
+ public static interface HeaderDelegate<T> {
+
+
+ public T fromString(String value);
+
+
+ public String toString(T value);
+ }
+
+
+ public abstract Link.Builder createLinkBuilder();
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegateFinder.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegateFinder.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegateFinder.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegateFinder.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,123 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import org.apache.geronimo.osgi.locator.ProviderLocator;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+// same as ClientFinder mainly but we want it to be hidden (package scoped)
+final class RuntimeDelegateFinder {
+ private static final Logger LOGGER = Logger.getLogger(RuntimeDelegateFinder.class.getName());
+ private static final String FACTORY_ID = RuntimeDelegateFinder.class.getName();
+ private static final String SERVICE_ID = "META-INF/services/" + FACTORY_ID;
+
+ static Object find(final String defaultClazz) throws ClassNotFoundException {
+ final ClassLoader classLoader = getContextClassLoader();
+
+ try {
+ final Object delegate = ProviderLocator.getService(FACTORY_ID, RuntimeDelegateFinder.class, classLoader);
+ if (delegate != null) {
+ return delegate;
+ }
+
+ InputStream is;
+ if (classLoader == null) {
+ is = ClassLoader.getSystemResourceAsStream(SERVICE_ID);
+ } else {
+ is = classLoader.getResourceAsStream(SERVICE_ID);
+ }
+
+ if (is != null) {
+ final BufferedReader rd = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+ final String factoryClassName = rd.readLine();
+ rd.close();
+ if (factoryClassName != null && !"".equals(factoryClassName)) {
+ return newInstance(factoryClassName, classLoader);
+ }
+ }
+ } catch (final Exception ex) {
+ LOGGER.finest(ex.getMessage());
+ }
+
+ try {
+ final File f = new File(System.getProperty("java.home") + File.separator + "lib" + File.separator + "jaxrs.properties");
+ if (f.exists()) {
+ final Properties props = new Properties();
+ props.load(new FileInputStream(f));
+ final String factoryClassName = props.getProperty(FACTORY_ID);
+ return newInstance(factoryClassName, classLoader);
+ }
+ } catch (final Exception ex) {
+ LOGGER.finest(ex.getMessage());
+ }
+
+ try {
+ final String systemProp = System.getProperty(FACTORY_ID);
+ if (systemProp != null) {
+ return newInstance(systemProp, classLoader);
+ }
+ } catch (final SecurityException se) {
+ LOGGER.finest(se.getMessage());
+ }
+
+ if (defaultClazz == null) {
+ throw new ClassNotFoundException(FACTORY_ID + " not found", null);
+ }
+
+ return newInstance(defaultClazz, classLoader);
+ }
+
+ static ClassLoader getContextClassLoader() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+
+ private static Object newInstance(final String className, final ClassLoader classLoader) throws ClassNotFoundException {
+ try {
+ Class spiClass;
+ if (classLoader == null) {
+ spiClass = Class.forName(className);
+ } else {
+ try {
+ spiClass = Class.forName(className, false, classLoader);
+ } catch (final ClassNotFoundException ex) {
+ LOGGER.finest(ex.getMessage());
+ spiClass = Class.forName(className);
+ }
+ }
+ return spiClass.newInstance();
+ } catch (final ClassNotFoundException x) {
+ throw x;
+ } catch (final Exception x) {
+ throw new ClassNotFoundException(x.getMessage(), x);
+ }
+ }
+
+ private RuntimeDelegateFinder() {
+ // no-op
+ }
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/WriterInterceptor.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/WriterInterceptor.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/WriterInterceptor.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/WriterInterceptor.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,28 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+
+public interface WriterInterceptor {
+
+
+ void aroundWriteTo(WriterInterceptorContext context) throws java.io.IOException, javax.ws.rs.WebApplicationException;
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/WriterInterceptorContext.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/WriterInterceptorContext.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/WriterInterceptorContext.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/WriterInterceptorContext.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,48 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+package javax.ws.rs.ext;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MultivaluedMap;
+import java.io.IOException;
+import java.io.OutputStream;
+
+
+public interface WriterInterceptorContext extends InterceptorContext {
+
+
+ void proceed() throws IOException, WebApplicationException;
+
+
+ Object getEntity();
+
+
+ void setEntity(Object entity);
+
+
+ OutputStream getOutputStream();
+
+
+ public void setOutputStream(OutputStream os);
+
+
+ MultivaluedMap<String, Object> getHeaders();
+}
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/package-info.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/package-info.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/package-info.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/ext/package-info.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,22 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+
+package javax.ws.rs.ext;
Added: geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/package-info.java
URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/package-info.java?rev=1612628&view=auto
==============================================================================
--- geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/package-info.java (added)
+++ geronimo/specs/trunk/geronimo-jaxrs_2.0_spec/src/main/java/javax/ws/rs/package-info.java Tue Jul 22 17:50:24 2014
@@ -0,0 +1,22 @@
+/*
+ * #%L
+ * Apache Geronimo JAX-RS Spec 2.0
+ * %%
+ * Copyright (C) 2003 - 2014 The Apache Software Foundation
+ * %%
+ * Licensed 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.
+ * #L%
+ */
+
+
+package javax.ws.rs;