You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bl...@apache.org on 2010/02/22 06:02:00 UTC

svn commit: r912482 - in /cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs: core/UriBuilder.java core/UriBuilderException.java core/UriInfo.java ext/RuntimeDelegate.java

Author: bluk
Date: Mon Feb 22 05:01:59 2010
New Revision: 912482

URL: http://svn.apache.org/viewvc?rev=912482&view=rev
Log:
Add JAX-RS Uri related classes.

Added:
    cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilder.java   (with props)
    cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilderException.java   (with props)
    cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriInfo.java   (with props)
    cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegate.java   (with props)

Added: cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilder.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilder.java?rev=912482&view=auto
==============================================================================
--- cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilder.java (added)
+++ cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilder.java Mon Feb 22 05:01:59 2010
@@ -0,0 +1,110 @@
+/*
+ * 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 javax.ws.rs.core;
+
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+
+import javax.ws.rs.ext.RuntimeDelegate;
+
+public abstract class UriBuilder {
+    protected UriBuilder() {
+        super();
+    }
+
+    public static UriBuilder fromPath(String value) {
+        return newInstance().replacePath(value);
+    }
+
+    public static UriBuilder fromResource(Class<?> resourceClass) {
+        return newInstance().path(resourceClass);
+    }
+
+    public static UriBuilder fromUri(String value) {
+        try {
+            return fromUri(new URI(value));
+        } catch (NullPointerException e) {
+            throw new IllegalArgumentException(e);
+        } catch (URISyntaxException e) {
+            throw new IllegalArgumentException(e);
+        }
+    }
+
+    public static UriBuilder fromUri(URI uri) {
+        return newInstance().uri(uri);
+    }
+
+    private final static RuntimeDelegate delegate = RuntimeDelegate.getInstance();
+
+    protected static UriBuilder newInstance() {
+        return delegate.createUriBuilder();
+    }
+
+    public abstract java.net.URI build(Object... values);
+
+    public abstract java.net.URI buildFromEncoded(Object... values);
+
+    public abstract java.net.URI buildFromEncodedMap(Map<String, ? extends Object> values);
+
+    public abstract java.net.URI buildFromMap(Map<String, ? extends Object> values);
+
+    @Override
+    public abstract UriBuilder clone();
+
+    public abstract UriBuilder fragment(String value);
+
+    public abstract UriBuilder host(String value);
+
+    public abstract UriBuilder matrixParam(String name, Object... values);
+
+    public abstract UriBuilder path(Class<?> resourceClass);
+
+    public abstract UriBuilder path(Class<?> resourceClass, String resourceMethodName);
+
+    public abstract UriBuilder path(Method resourceMethod);
+
+    public abstract UriBuilder path(String value);
+
+    public abstract UriBuilder port(int port);
+
+    public abstract UriBuilder queryParam(String name, Object... values);
+
+    public abstract UriBuilder replaceMatrix(String value);
+
+    public abstract UriBuilder replaceMatrixParam(String name, Object... values);
+
+    public abstract UriBuilder replacePath(String value);
+
+    public abstract UriBuilder replaceQuery(String value);
+
+    public abstract UriBuilder replaceQueryParam(String name, Object... values);
+
+    public abstract UriBuilder scheme(String value);
+
+    public abstract UriBuilder schemeSpecificPart(String value);
+
+    public abstract UriBuilder segment(String... values);
+
+    public abstract UriBuilder uri(URI value);
+
+    public abstract UriBuilder userInfo(String value);
+}

Propchange: cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilderException.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilderException.java?rev=912482&view=auto
==============================================================================
--- cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilderException.java (added)
+++ cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilderException.java Mon Feb 22 05:01:59 2010
@@ -0,0 +1,41 @@
+/*
+ * 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 javax.ws.rs.core;
+
+public class UriBuilderException extends RuntimeException {
+
+    private static final long serialVersionUID = 956255903370721193L;
+
+    public UriBuilderException() {
+        super();
+    }
+
+    public UriBuilderException(String msg) {
+        super(msg);
+    }
+
+    public UriBuilderException(String msg, Throwable cause) {
+        super(msg, cause);
+    }
+
+    public UriBuilderException(Throwable cause) {
+        super((cause == null ? null : cause.toString()), cause);
+    }
+}

Propchange: cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriBuilderException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriInfo.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriInfo.java?rev=912482&view=auto
==============================================================================
--- cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriInfo.java (added)
+++ cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriInfo.java Mon Feb 22 05:01:59 2010
@@ -0,0 +1,59 @@
+/*
+ * 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 javax.ws.rs.core;
+
+import java.net.URI;
+import java.util.List;
+
+public interface UriInfo {
+    public URI getAbsolutePath();
+
+    public UriBuilder getAbsolutePathBuilder();
+
+    public URI getBaseUri();
+
+    public UriBuilder getBaseUriBuilder();
+
+    public List<Object> getMatchedResources();
+
+    public List<String> getMatchedURIs();
+
+    public List<String> getMatchedURIs(boolean decode);
+
+    public String getPath();
+
+    public String getPath(boolean decode);
+
+    public MultivaluedMap<String, String> getPathParameters();
+
+    public MultivaluedMap<String, String> getPathParameters(boolean decode);
+
+    public List<PathSegment> getPathSegments();
+
+    public List<PathSegment> getPathSegments(boolean decode);
+
+    public MultivaluedMap<String, String> getQueryParameters();
+
+    public MultivaluedMap<String, String> getQueryParameters(boolean decode);
+
+    public URI getRequestUri();
+
+    public UriBuilder getRequestUriBuilder();
+}

Propchange: cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/core/UriInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegate.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegate.java?rev=912482&view=auto
==============================================================================
--- cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegate.java (added)
+++ cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegate.java Mon Feb 22 05:01:59 2010
@@ -0,0 +1,32 @@
+/*
+ * 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 javax.ws.rs.ext;
+
+import javax.ws.rs.core.UriBuilder;
+
+public abstract class RuntimeDelegate {
+
+    public abstract UriBuilder createUriBuilder();
+
+    public static RuntimeDelegate getInstance() {
+        return null;
+    }
+
+}

Propchange: cxf/sandbox/geronimo-jaxrs_1.0_spec/src/main/java/javax/ws/rs/ext/RuntimeDelegate.java
------------------------------------------------------------------------------
    svn:eol-style = native