Return-Path: X-Original-To: apmail-felix-commits-archive@www.apache.org Delivered-To: apmail-felix-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B569CFE53 for ; Wed, 28 May 2014 14:32:23 +0000 (UTC) Received: (qmail 51948 invoked by uid 500); 28 May 2014 14:32:23 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 51899 invoked by uid 500); 28 May 2014 14:32:23 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 51892 invoked by uid 99); 28 May 2014 14:32:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 May 2014 14:32:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,NORMAL_HTTP_TO_IP X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 May 2014 14:32:15 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5AB13238889B; Wed, 28 May 2014 14:31:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1598025 [1/2] - in /felix/sandbox/http-rfc189/api/src/main/java/org/osgi: ./ annotation/ annotation/versioning/ dto/ service/ service/http/ service/http/context/ service/http/runtime/ service/http/runtime/dto/ service/http/whiteboard/ Date: Wed, 28 May 2014 14:31:48 -0000 To: commits@felix.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140528143149.5AB13238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cziegeler Date: Wed May 28 14:31:46 2014 New Revision: 1598025 URL: http://svn.apache.org/r1598025 Log: FELIX-3060 : Add current API from RFC-189 Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ConsumerType.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ProviderType.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/Version.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/package-info.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/packageinfo felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/DTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/package-info.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/packageinfo felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/ServletContextHelper.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/package-info.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/packageinfo felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntime.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/BaseServletDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/DTOConstants.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ErrorPageDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedFilterDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedListenerDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedResourceDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FilterDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ListenerDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/RequestInfoDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ResourceDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/RuntimeDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ServletContextDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ServletDTO.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/package-info.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/packageinfo felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/package-info.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/packageinfo felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/whiteboard/ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/whiteboard/HttpWhiteboardConstants.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/whiteboard/package-info.java (with props) felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/whiteboard/packageinfo Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ConsumerType.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ConsumerType.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ConsumerType.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ConsumerType.java Wed May 28 14:31:46 2014 @@ -0,0 +1,56 @@ +/* + * Copyright (c) OSGi Alliance (2013, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.annotation.versioning; + +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; + +/** + * A type implemented by the Consumer Role. + * + *

+ * A non-binary compatible change to a consumer type normally requires + * incrementing the major version of the type's package. This change will + * require all providers and all consumers to be updated to handle the change + * since consumers implement the consumer type and all providers must understand + * the change in the consumer type. + * + *

+ * A type can be marked {@link ConsumerType} or {@link ProviderType} but not + * both. A type is assumed to be {@link ConsumerType} if it is not marked either + * {@link ConsumerType} or {@link ProviderType}. + * + *

+ * This annotation is not retained at runtime. It is for use by tools to + * understand the semantic version of a package. When a bundle implements a + * consumer type from an imported package, then the bundle's import range for + * that package must require the exact major version and a minor version greater + * than or equal to the package's version. + * + * @see Semantic Versioning + * @author $Id$ + */ +@Documented +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.TYPE) +public @interface ConsumerType { + // marker annotation +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ConsumerType.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ConsumerType.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ProviderType.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ProviderType.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ProviderType.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ProviderType.java Wed May 28 14:31:46 2014 @@ -0,0 +1,55 @@ +/* + * Copyright (c) OSGi Alliance (2013, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.annotation.versioning; + +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; + +/** + * A type implemented by the Provider Role. + * + *

+ * A non-binary compatible change to a provider type normally requires + * incrementing the minor version of the type's package. This change will + * require all providers to be updated to handle the change, but consumers of + * that package will not require changes since they only use, and do not + * implement, the provider type. + * + *

+ * A type can be marked {@link ConsumerType} or {@link ProviderType} but not + * both. A type is assumed to be {@link ConsumerType} if it is not marked either + * {@link ConsumerType} or {@link ProviderType}. + * + *

+ * This annotation is not retained at runtime. It is for use by tools to + * understand the semantic version of a package. When a bundle implements a + * provider type from an imported package, then the bundle's import range for + * that package must require the package's exact major and minor version. + * + * @see Semantic Versioning + * @author $Id$ + */ +@Documented +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.TYPE) +public @interface ProviderType { + // marker annotation +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ProviderType.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/ProviderType.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/Version.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/Version.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/Version.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/Version.java Wed May 28 14:31:46 2014 @@ -0,0 +1,47 @@ +/* + * Copyright (c) OSGi Alliance (2013). All Rights Reserved. + * + * 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. + */ + +package org.osgi.annotation.versioning; + +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; + +/** + * Specify the version of a package. + * + *

+ * This annotation is not retained at runtime. It is for use by tools to + * generate bundle manifests or otherwise process the version of a package. + * + * @see Semantic Versioning + * @author $Id$ + */ +@Documented +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.PACKAGE) +public @interface Version { + /** + * The version of the annotated package. + * + *

+ * The version must be a valid OSGi version string. + */ + String value(); +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/Version.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/Version.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/package-info.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/package-info.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/package-info.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/package-info.java Wed May 28 14:31:46 2014 @@ -0,0 +1,30 @@ +/* + * Copyright (c) OSGi Alliance (2013). All Rights Reserved. + * + * 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. + */ + +/** + * OSGi Versioning Annotations Package Version 1.0. + * + *

+ * This package is not used at runtime. + * + * @see Semantic Versioning + * @version 1.0 + * @author $Id$ + */ +@Version("1.0") +package org.osgi.annotation.versioning; + Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/package-info.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/package-info.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/packageinfo URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/packageinfo?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/packageinfo (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/annotation/versioning/packageinfo Wed May 28 14:31:46 2014 @@ -0,0 +1 @@ +version 1.0 Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/DTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/DTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/DTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/DTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,273 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.dto; + +import java.lang.reflect.Array; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Super type for Data Transfer Objects. + * + *

+ * A Data Transfer Object (DTO) is easily serializable having only public fields + * of primitive types and their wrapper classes, Strings, and DTOs. List, Set, + * Map and array aggregates may also be used. The aggregates must only hold + * objects of the listed types or aggregates. + * + *

+ * The object graph from a Data Transfer Object must be a tree to simplify + * serialization and deserialization. + * + * @author $Id$ + * @NotThreadSafe + */ +public abstract class DTO { + + /** + * Return a string representation of this DTO suitable for use when + * debugging. + * + *

+ * The format of the string representation is not specified and subject to + * change. + * + * @return A string representation of this DTO suitable for use when + * debugging. + */ + @Override + public String toString() { + return appendValue(new StringBuilder(), new IdentityHashMap(), "#", this).toString(); + } + + /** + * Append the specified DTO's string representation to the specified + * StringBuilder. + * + * @param result StringBuilder to which the string representation is + * appended. + * @param objectRefs References to "seen" objects. + * @param refpath The reference path of the specified DTO. + * @param dto The DTO whose string representation is to be appended. + * @return The specified StringBuilder. + */ + private static StringBuilder appendDTO(final StringBuilder result, final Map objectRefs, final String refpath, final DTO dto) { + result.append("{"); + String delim = ""; + for (Field field : dto.getClass().getFields()) { + if (Modifier.isStatic(field.getModifiers())) { + continue; + } + result.append(delim); + final String name = field.getName(); + appendString(result, name); + result.append(":"); + Object value = null; + try { + value = field.get(dto); + } catch (IllegalAccessException e) { + // use null value; + } + appendValue(result, objectRefs, refpath + "/" + name, value); + delim = ", "; + } + result.append("}"); + return result; + } + + /** + * Append the specified value's string representation to the specified + * StringBuilder. + * + *

+ * This method handles cycles in the object graph, using path-based + * references, even though the specification requires the object graph from + * a DTO to be a tree. + * + * @param result StringBuilder to which the string representation is + * appended. + * @param objectRefs References to "seen" objects. + * @param refpath The reference path of the specified value. + * @param value The object whose string representation is to be appended. + * @return The specified StringBuilder. + */ + private static StringBuilder appendValue(final StringBuilder result, final Map objectRefs, final String refpath, final Object value) { + if (value == null) { + return result.append("null"); + } + // Simple Java types + if (value instanceof String || value instanceof Character) { + return appendString(result, compress(value.toString())); + } + if (value instanceof Number || value instanceof Boolean) { + return result.append(value.toString()); + } + + // Complex types + final String path = objectRefs.get(value); + if (path != null) { + result.append("{\"$ref\":"); + appendString(result, path); + result.append("}"); + return result; + } + objectRefs.put(value, refpath); + + if (value instanceof DTO) { + return appendDTO(result, objectRefs, refpath, (DTO) value); + } + if (value instanceof Map) { + return appendMap(result, objectRefs, refpath, (Map) value); + } + if (value instanceof List || value instanceof Set) { + return appendIterable(result, objectRefs, refpath, (Iterable) value); + } + if (value.getClass().isArray()) { + return appendArray(result, objectRefs, refpath, value); + } + return appendString(result, compress(value.toString())); + } + + /** + * Append the specified array's string representation to the specified + * StringBuilder. + * + * @param result StringBuilder to which the string representation is + * appended. + * @param objectRefs References to "seen" objects. + * @param refpath The reference path of the specified array. + * @param array The array whose string representation is to be appended. + * @return The specified StringBuilder. + */ + private static StringBuilder appendArray(final StringBuilder result, final Map objectRefs, final String refpath, final Object array) { + result.append("["); + final int length = Array.getLength(array); + for (int i = 0; i < length; i++) { + if (i > 0) { + result.append(","); + } + appendValue(result, objectRefs, refpath + "/" + i, Array.get(array, i)); + } + result.append("]"); + return result; + } + + /** + * Append the specified iterable's string representation to the specified + * StringBuilder. + * + * @param result StringBuilder to which the string representation is + * appended. + * @param objectRefs References to "seen" objects. + * @param refpath The reference path of the specified list. + * @param iterable The iterable whose string representation is to be + * appended. + * @return The specified StringBuilder. + */ + private static StringBuilder appendIterable(final StringBuilder result, final Map objectRefs, final String refpath, final Iterable iterable) { + result.append("["); + int i = 0; + for (Object item : iterable) { + if (i > 0) { + result.append(","); + } + appendValue(result, objectRefs, refpath + "/" + i, item); + i++; + } + result.append("]"); + return result; + } + + /** + * Append the specified map's string representation to the specified + * StringBuilder. + * + * @param result StringBuilder to which the string representation is + * appended. + * @param objectRefs References to "seen" objects. + * @param refpath The reference path of the specified map. + * @param map The map whose string representation is to be appended. + * @return The specified StringBuilder. + */ + private static StringBuilder appendMap(final StringBuilder result, final Map objectRefs, final String refpath, final Map map) { + result.append("{"); + String delim = ""; + for (Map.Entry entry : map.entrySet()) { + result.append(delim); + final String name = String.valueOf(entry.getKey()); + appendString(result, name); + result.append(":"); + final Object value = entry.getValue(); + appendValue(result, objectRefs, refpath + "/" + name, value); + delim = ", "; + } + result.append("}"); + return result; + } + + /** + * Append the specified string to the specified StringBuilder. + * + * @param result StringBuilder to which the string is appended. + * @param string The string to be appended. + * @return The specified StringBuilder. + */ + private static StringBuilder appendString(final StringBuilder result, final CharSequence string) { + result.append("\""); + int i = result.length(); + result.append(string); + while (i < result.length()) { // escape if necessary + char c = result.charAt(i); + if ((c == '"') || (c == '\\')) { + result.insert(i, '\\'); + i = i + 2; + continue; + } + if (c < 0x20) { + result.insert(i + 1, Integer.toHexString(c | 0x10000)); + result.replace(i, i + 2, "\\u"); + i = i + 6; + continue; + } + i++; + } + result.append("\""); + return result; + } + + /** + * Compress, in length, the specified string. + * + * @param in The string to potentially compress. + * @return The string compressed, if necessary. + */ + private static CharSequence compress(final CharSequence in) { + final int length = in.length(); + if (length <= 21) { + return in; + } + StringBuilder result = new StringBuilder(21); + result.append(in, 0, 9); + result.append("..."); + result.append(in, length - 9, length); + return result; + } +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/DTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/DTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/package-info.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/package-info.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/package-info.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/package-info.java Wed May 28 14:31:46 2014 @@ -0,0 +1,42 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2013). All Rights Reserved. + * + * 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. + */ + +/** + * OSGi Data Transfer Object Package Version 1.0. + * + *

+ * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

+ * Example import for consumers using the API in this package: + *

+ * {@code Import-Package: org.osgi.dto; version="[1.0,2.0)"} + *

+ * Example import for providers implementing the API in this package: + *

+ * {@code Import-Package: org.osgi.dto; version="[1.0,1.1)"} + * + * @author $Id$ + */ + +@Version("1.0") +package org.osgi.dto; + +import org.osgi.annotation.versioning.Version; + Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/package-info.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/package-info.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/packageinfo URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/packageinfo?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/packageinfo (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/dto/packageinfo Wed May 28 14:31:46 2014 @@ -0,0 +1 @@ +version 1.0 Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/ServletContextHelper.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/ServletContextHelper.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/ServletContextHelper.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/ServletContextHelper.java Wed May 28 14:31:46 2014 @@ -0,0 +1,285 @@ +/* + * Copyright (c) OSGi Alliance (2000, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.context; + +import java.io.IOException; +import java.net.URL; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Set; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.osgi.annotation.versioning.ConsumerType; +import org.osgi.framework.Bundle; + +/** + * Helper service for the servlet context used by whiteboard services for HTTP + * requests. + * + *

+ * This service defines methods that the Http Whiteboard Service implementation may call to + * get information for a request when dealing with whiteboard services. + * + *

+ * Servlets, servlet filters, resources, and listeners services may be + * {@link org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_NAME + * associated} with an {@code ServletContextHelper} service. Those whiteboard + * services that are associated using the same {@code ServletContextHelper} + * object will share the same {@code ServletContext} object. + * + *

+ * If no {@code ServletContextHelper} service is associated, a default + * {@code ServletContextHelper} is used. The behavior of the methods on the + * default {@code ServletContextHelper} is defined as follows: + *

    + *
  • {@code getMimeType} - Does not define any customized MIME types for the + * {@code Content-Type} header in the response, and always returns {@code null}. + *
  • + *
  • {@code handleSecurity} - Performs implementation-defined authentication + * on the request.
  • + *
  • {@code getResource} - Assumes the named resource is in the bundle of the + * whiteboard service. This method calls the whiteboard service bundle's + * {@code Bundle.getResource} method, and returns the appropriate URL to access + * the resource. On a Java runtime environment that supports permissions, the + * Http Whiteboard Service needs to be granted + * {@code org.osgi.framework.AdminPermission[*,RESOURCE]}.
  • + *
  • {@code getResourcePaths} - Assumes that the resources are in the bundle + * of the whiteboard service. This method calls {@code Bundle.findEntries} + * method, and returnes the found entries. On a Java runtime environment that + * supports permissions, the Http Whiteboard Service needs to be granted + * {@code org.osgi.framework.AdminPermission[*,RESOURCE]}.
  • + *
  • {@code getRealPath} - This method returns {@code null}. + *
+ * + * It is possible to register own {@code ServletContextHelper} services with a + * {@link org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_NAME + * service property}. + * + *

+ * A context can be registered with the + * {@link org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_PATH + * service property} to define a path under which all services registered with + * this context are reachable. + * + * @ThreadSafe + * @author $Id$ + * @see org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_NAME + * @see org.osgi.service.http.whiteboard.HttpWhiteboardConstants#HTTP_WHITEBOARD_CONTEXT_PATH + */ +@ConsumerType +public abstract class ServletContextHelper { + /** + * {@code HttpServletRequest} attribute specifying the name of the + * authenticated user. The value of the attribute can be retrieved by + * {@code HttpServletRequest.getRemoteUser}. This attribute name is + * {@code org.osgi.service.http.authentication.remote.user}. + */ + public static final String REMOTE_USER = "org.osgi.service.http.authentication.remote.user"; + /** + * {@code HttpServletRequest} attribute specifying the scheme used in + * authentication. The value of the attribute can be retrieved by + * {@code HttpServletRequest.getAuthType}. This attribute name is + * {@code org.osgi.service.http.authentication.type}. + */ + public static final String AUTHENTICATION_TYPE = "org.osgi.service.http.authentication.type"; + /** + * {@code HttpServletRequest} attribute specifying the {@code Authorization} + * object obtained from the {@code org.osgi.service.useradmin.UserAdmin} + * service. The value of the attribute can be retrieved by + * {@code HttpServletRequest.getAttribute(HttpContext.AUTHORIZATION)}. This + * attribute name is {@code org.osgi.service.useradmin.authorization}. + */ + public static final String AUTHORIZATION = "org.osgi.service.useradmin.authorization"; + + /** Bundle associated with this context. */ + private final Bundle bundle; + + /** + * Default constructor + */ + public ServletContextHelper() { + // default constructor + this(null); + } + + /** + * Construct a new context helper and set the bundle associated with this + * context. + * + * @param b The bundle + */ + public ServletContextHelper(final Bundle b) { + this.bundle = b; + } + + /** + * Handles security for the specified request. + * + *

+ * The Http Whiteboard Service calls this method prior to servicing the specified + * request. This method controls whether the request is processed in the + * normal manner or an error is returned. + * + *

+ * If the request requires authentication and the Authorization header in + * the request is missing or not acceptable, then this method should set the + * WWW-Authenticate header in the response object, set the status in the + * response object to Unauthorized(401) and return {@code false}. See also + * RFC 2617: HTTP Authentication: Basic and Digest Access Authentication + * (available at http://www.ietf.org/rfc/rfc2617.txt). + * + *

+ * If the request requires a secure connection and the {@code getScheme} + * method in the request does not return 'https' or some other acceptable + * secure protocol, then this method should set the status in the response + * object to Forbidden(403) and return {@code false}. + * + *

+ * When this method returns {@code false}, the Http Whiteboard Service will send the + * response back to the client, thereby completing the request. When this + * method returns {@code true}, the Http Whitboard Service will proceed with servicing + * the request. + * + *

+ * If the specified request has been authenticated, this method must set the + * {@link #AUTHENTICATION_TYPE} request attribute to the type of + * authentication used, and the {@link #REMOTE_USER} request attribute to + * the remote user (request attributes are set using the + * {@code setAttribute} method on the request). If this method does not + * perform any authentication, it must not set these attributes. + * + *

+ * If the authenticated user is also authorized to access certain resources, + * this method must set the {@link #AUTHORIZATION} request attribute to the + * {@code Authorization} object obtained from the + * {@code org.osgi.service.useradmin.UserAdmin} service. + * + *

+ * The servlet responsible for servicing the specified request determines + * the authentication type and remote user by calling the + * {@code getAuthType} and {@code getRemoteUser} methods, respectively, on + * the request. + * + * @param request The HTTP request. + * @param response The HTTP response. + * @return {@code true} if the request should be serviced, {@code false} if + * the request should not be serviced and Http Whiteboard Service will send the + * response back to the client. + * @throws java.io.IOException may be thrown by this method. If this occurs, + * the Http Whiteboard Service will terminate the request and close the socket. + */ + public boolean handleSecurity(final HttpServletRequest request, final HttpServletResponse response) + throws IOException { + return true; + } + + /** + * Maps a resource name to a URL. + * + *

+ * Called by the Http Whiteboard Service to map the specified resource name to a URL. + * For servlets, Http Whiteboard Service will call this method to support the + * {@code ServletContext} methods {@code getResource} and + * {@code getResourceAsStream}. For resource servlets, Http Whiteboard Service will + * call this method to locate the named resource. + * + *

+ * The context can control from where resources come. For example, the + * resource can be mapped to a file in the bundle's persistent storage area + * via {@code bundleContext.getDataFile(name).toURL()} or to a resource in + * the context's bundle via {@code getClass().getResource(name)} + * + * @param name The name of the requested resource. + * @return A URL that Http Whiteboard Service can use to read the resource or + * {@code null} if the resource does not exist. + */ + public URL getResource(String name) { + final Bundle localBundle = this.bundle; + if (name != null && localBundle != null) { + if (name.startsWith("/")) { + name = name.substring(1); + } + + return this.bundle.getResource(name); + } + return null; + } + + /** + * Maps a name to a MIME type. + * + *

+ * Called by the Http Whiteboard Service to determine the MIME type for the + * specified name. For whiteboard services, the Http Whiteboard Service will + * call this method to support the {@code ServletContext} method + * {@code getMimeType}. For resource servlets, the Http Whiteboard Service + * will call this method to determine the MIME type for the + * {@code Content-Type} header in the response. + * + * @param name The name for which to determine the MIME type. + * @return The MIME type (e.g. text/html) of the specified name or + * {@code null} to indicate that the Http Service should determine + * the MIME type itself. + */ + public String getMimeType(final String name) { + return null; + } + + /** + * Returns a directory-like listing of all the paths to resources within the + * web application whose longest sub-path matches the supplied path + * argument. + * + *

+ * Called by the Http Whiteboard Service to support the {@code ServletContext} method + * {@code getResourcePaths} for whiteboard services. + * + * @param path the partial path used to match the resources, which must + * start with a / + * @return a Set containing the directory listing, or null if there are no + * resources in the web application whose path begins with the + * supplied path. + */ + public Set getResourcePaths(final String path) { + final Bundle localBundle = this.bundle; + if (path != null && localBundle != null) { + final Enumeration e = localBundle.findEntries(path, null, false); + if (e != null) { + final Set result = new HashSet(); + while (e.hasMoreElements()) { + result.add(e.nextElement().toExternalForm()); + } + return result; + } + } + return null; + } + + /** + * Gets the real path corresponding to the given virtual path. + * + *

+ * Called by the Http Whiteboard Service to support the {@code ServletContext} method + * {@code getRealPath} for whiteboard services. + * + * @param path the virtual path to be translated to a real path + * @return the real path, or null if the translation cannot be performed + */ + public String getRealPath(final String path) { + return null; + } +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/ServletContextHelper.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/ServletContextHelper.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/package-info.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/package-info.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/package-info.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/package-info.java Wed May 28 14:31:46 2014 @@ -0,0 +1,42 @@ +/* + * Copyright (c) OSGi Alliance (2010, 2014). All Rights Reserved. + * + * 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. + */ + +/** + * Http Service Context Package Version 1.0. + * + *

+ * Bundles wishing to use this package must list the package in the + * Import-Package header of the bundle's manifest. This package has two types of + * users: the consumers that use the API in this package and the providers that + * implement the API in this package. + * + *

+ * Example import for consumers using the API in this package: + *

+ * {@code Import-Package: org.osgi.service.http.context; version="[1.0,2.0)"} + *

+ * Example import for providers implementing the API in this package: + *

+ * {@code Import-Package: org.osgi.service.http.context; version="[1.0,1.1)"} + * + * @author $Id$ + */ + +@Version("1.0") +package org.osgi.service.http.context; + +import org.osgi.annotation.versioning.Version; + Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/package-info.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/package-info.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/packageinfo URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/packageinfo?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/packageinfo (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/context/packageinfo Wed May 28 14:31:46 2014 @@ -0,0 +1 @@ +version 1.0 Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntime.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntime.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntime.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntime.java Wed May 28 14:31:46 2014 @@ -0,0 +1,55 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime; + +import org.osgi.annotation.versioning.ProviderType; +import org.osgi.service.http.runtime.dto.RequestInfoDTO; +import org.osgi.service.http.runtime.dto.RuntimeDTO; + +/** + * The {@code HttpServiceRuntime} service represents the runtime information of + * a Http (Whiteboard) Service implementation. + * + *

+ * It provides access to DTOs representing the current state of the service. + *

+ * The {@code HttpServiceRuntime} service must at least be registered with the + * {@link HttpServiceRuntimeConstants#HTTP_SERVICE_ENDPOINT_ATTRIBUTE} + * attribute. + * + * @ThreadSafe + * @author $Id$ + */ +@ProviderType +public interface HttpServiceRuntime { + + /** + * Return the runtime DTO representing the current state. + * @return The runtime DTO + */ + public RuntimeDTO getRuntimeDTO(); + + /** + * Return a request info DTO containing the services + * involved with processing a request for the given + * path. + * @param path The request path, relative to the root of the + * Http (Whiteboard) Service. + * @return A request info DTO + */ + public RequestInfoDTO calculateRequestInfoDTO(String path); +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntime.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntime.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java Wed May 28 14:31:46 2014 @@ -0,0 +1,50 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime; + + +/** + * Defines standard names for Http Runtime Service constants. + * + * @author $Id$ + */ +public final class HttpServiceRuntimeConstants { + private HttpServiceRuntimeConstants() { + // non-instantiable + } + + /** + * Http service runtime registration property specifying the endpoints upon + * which the Http service runtime is listening. + * + *

+ * An endpoint value is a URL or a relative path, to which the Http service + * runtime is listening. For example, {@code http://192.168.1.10:8080/} or + * {@code /myapp/}. A relative path may be used if the scheme and authority + * parts of the URL are not known, e.g. in a bridged Http Service + * implementation. If the Http Service implementation is serving the root context and + * neither scheme nor authority is known, the value of the property is "/". + * Both, a URL and a relative path, must end with a slash. + *

+ * An Http Service Runtime can be listening on multiple endpoints. + * + *

+ * The value of this attribute must be of type {@code String}, + * {@code String[]}, or {@code Collection}. + */ + public static final String HTTP_SERVICE_ENDPOINT_ATTRIBUTE = "osgi.http.endpoint"; +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/HttpServiceRuntimeConstants.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/BaseServletDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/BaseServletDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/BaseServletDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/BaseServletDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,68 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +import java.util.Map; +import org.osgi.dto.DTO; + +/** + * Represents common information about a {@code javax.servlet.Servlet} service. + * + * @NotThreadSafe + * @author $Id$ + */ +public abstract class BaseServletDTO extends DTO { + /** + * The name of the servlet. + */ + public String name; + + /** + * The information string from the servlet. + *

+ * This is the value returned by the {@code Servlet.getServletInfo()} + * method. + */ + public String servletInfo; + + /** + * Specifies whether the servlet supports asynchronous processing. + */ + public boolean asyncSupported; + + /** + * The servlet initialization parameters as provided during registration + * of the servlet. Additional parameters like the Http Service Runtime + * attributes are not included. + */ + public Map initParams; + + /** + * The service id of the {@code ServletContext} for the servlet. + */ + public long servletContextId; + + /** + * Service property identifying the servlet. In the case of a servlet registered + * in the service registry and picked up by a whiteboard implementation, this value + * is not negative and corresponds to the service id in the registry. + * If the servlet has not been registered in the service registry, the value + * is negative and a unique negative value is generated by the Http Service Runtime + * in this case. + */ + public long serviceId; +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/BaseServletDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/BaseServletDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/DTOConstants.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/DTOConstants.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/DTOConstants.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/DTOConstants.java Wed May 28 14:31:46 2014 @@ -0,0 +1,72 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +/** + * Defines standard constants for the DTOs. + */ +public final class DTOConstants { + private DTOConstants() { + // non-instantiable + } + + /** + * Failure reason is unknown + *

+ * The value of {@code FAILURE_REASON_UNKNOWN} is 0. + */ + public static final int FAILURE_REASON_UNKNOWN = 0; + + /** + * No matching servlet context + *

+ * The value of {@code FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING} is 1. + **/ + public static final int FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING = 1; + + /** + * Matching servlet context, but servlet context is not used due to a + * problem with the context. + *

+ * The value of {@code FAILURE_REASON_SERVLET_CONTEXT_FAILURE} is 2. + */ + public static final int FAILURE_REASON_SERVLET_CONTEXT_FAILURE = 2; + + /** + * Service is shadowed by another service, e.g. a service with the same + * registration properties but a higher service ranking. + *

+ * The value of {@code FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE} is 3. + */ + public static final int FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE = 3; + + /** + * An exception occurred during initializing of the service. This reason can + * only happen for servlets and servlet filters. + *

+ * The value of {@code FAILURE_REASON_EXCEPTION_ON_INIT} is 4. + */ + public static final int FAILURE_REASON_EXCEPTION_ON_INIT = 4; + + /** + * The service is registered in the servlet registry but getting the service + * fails as it returns {@code null}. + *

+ * The value of {@code FAILURE_REASON_SERVICE_NOT_GETTABLE} is 5. + */ + public static final int FAILURE_REASON_SERVICE_NOT_GETTABLE = 5; +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/DTOConstants.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/DTOConstants.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ErrorPageDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ErrorPageDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ErrorPageDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ErrorPageDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,38 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +/** + * Represents a {@code javax.servlet.Servlet} servlet for handling errors and + * currently being used by a servlet context. + * + * @NotThreadSafe + * @author $Id$ + */ +public class ErrorPageDTO extends BaseServletDTO { + /** + * The exceptions the error page is used for. This array might be + * empty. + */ + public String[] exceptions; + + /** + * The error codes the error page is used for. This array might be + * empty. + */ + public long[] errorCodes; +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ErrorPageDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ErrorPageDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,44 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +/** + * Represents a {@code javax.servlet.Servlet} service registered as an error + * page but currently not being used for a servlet context due to a problem. + *

+ * As the servlet represented by this DTO is not used due to a failure, the + * field {@link FailedErrorPageDTO#servletContextId} always returns {@code 0} + * and does not point to an existing servlet context. + * + * @NotThreadSafe + * @author $Id$ + */ +public class FailedErrorPageDTO extends ErrorPageDTO { + + /** + * The reason why the servlet represented by this DTO is not used. + * + * @see DTOConstants#FAILURE_REASON_UNKNOWN + * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT + * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING + * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE + * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE + * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE + */ + public int failureReason; + +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedErrorPageDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedFilterDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedFilterDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedFilterDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedFilterDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,44 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +/** + * Represents a servlet {@code Filter} filter which is currently not being + * used for a servlet context due to a problem. + *

+ * As the service represented by this DTO is not used due to a failure, the + * field {@link FailedFilterDTO#servletContextId} always returns {@code 0} and + * does not point to an existing servlet context. + * + * @NotThreadSafe + * @author $Id$ + */ +public class FailedFilterDTO extends FilterDTO { + + /** + * The reason why the filter represented by this DTO is not used. + * + * @see DTOConstants#FAILURE_REASON_UNKNOWN + * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT + * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING + * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE + * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE + * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE + */ + public int failureReason; + +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedFilterDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedFilterDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedListenerDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedListenerDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedListenerDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedListenerDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,44 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +/** + * Represents a listener service which is currently not being + * used for a servlet context due to a problem. + *

+ * As the listener represented by this DTO is not used due to a failure, the + * field {@link FailedErrorPageDTO#servletContextId} always returns {@code 0} + * and does not point to an existing servlet context. + * + * @NotThreadSafe + * @author $Id$ + */ +public class FailedListenerDTO extends ListenerDTO { + + /** + * The reason why the listener represented by this DTO is not used. + * + * @see DTOConstants#FAILURE_REASON_UNKNOWN + * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT + * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING + * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE + * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE + * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE + */ + public int failureReason; + +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedListenerDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedListenerDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedResourceDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedResourceDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedResourceDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedResourceDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,44 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +/** + * Represents a resource definition which is currently not being + * used for a servlet context due to a problem. + *

+ * As the service represented by this DTO is not used due to a failure, the + * field {@link FailedResourceDTO#servletContextId} always returns {@code 0} and + * does not point to an existing servlet context. + * + * @NotThreadSafe + * @author $Id$ + */ +public class FailedResourceDTO extends ResourceDTO { + + /** + * The reason why the resource represented by this DTO is not used. + * + * @see DTOConstants#FAILURE_REASON_UNKNOWN + * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT + * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING + * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE + * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE + * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE + */ + public int failureReason; + +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedResourceDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedResourceDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,52 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +/** + * Represents a {@code javax.servlet.ServletContext} servlet context that is + * currently not used due to some problem. + * + * The following fields return an empty array for a + * {@code FailedServletContextDTO}: + *

    + *
  • {@link ServletContextDTO#servletDTOs}
  • + *
  • {@link ServletContextDTO#resourceDTOs}
  • + *
  • {@link ServletContextDTO#filterDTOs}
  • + *
  • {@link ServletContextDTO#errorPageDTOs}
  • + *
  • {@link ServletContextDTO#listenerDTOs}
  • + *
+ *

+ * The method {@link ServletContextDTO#attributes} returns an empty map for a + * {@code FailedServletContextDTO}. + * + * @NotThreadSafe + * @author $Id$ + */ +public class FailedServletContextDTO extends ServletContextDTO { + + /** + * The reason why the servlet context represented by this DTO is not used. + * + * @see DTOConstants#FAILURE_REASON_UNKNOWN + * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT + * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING + * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE + * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE + * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE + */ + public int failureReason; +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletContextDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,43 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +/** + * Represents a {@code javax.servlet.Servlet} servlet which is currently not + * being used for a servlet context due to a problem. + *

+ * As the servlet represented by this DTO is not used due to a failure, the + * field {@link FailedErrorPageDTO#servletContextId} always returns {@code 0} + * and does not point to an existing servlet context. + * + * @NotThreadSafe + * @author $Id$ + */ +public class FailedServletDTO extends ServletDTO { + + /** + * The reason why the servlet represented by this DTO is not used. + * + * @see DTOConstants#FAILURE_REASON_UNKNOWN + * @see DTOConstants#FAILURE_REASON_EXCEPTION_ON_INIT + * @see DTOConstants#FAILURE_REASON_NO_SERVLET_CONTEXT_MATCHING + * @see DTOConstants#FAILURE_REASON_SERVICE_NOT_GETTABLE + * @see DTOConstants#FAILURE_REASON_SERVLET_CONTEXT_FAILURE + * @see DTOConstants#FAILURE_REASON_SHADOWED_BY_OTHER_SERVICE + */ + public int failureReason; +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FailedServletDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FilterDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FilterDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FilterDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FilterDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,97 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +import java.util.Map; +import org.osgi.dto.DTO; + +/** + * Represents a servlet {@code javax.servlet.Filter} filter currently being used + * for a servlet context. + * + * @NotThreadSafe + * @author $Id$ + */ +public class FilterDTO extends DTO { + /** + * The name of the servlet filter. + */ + public String name; + + /** + * The request mappings for the servlet filter. + * + *

+ * The specified patterns are used to determine whether a request is + * mapped to the servlet filter. + */ + public String[] patterns; + + /** + * The servlet names for the servlet filter. + * + *

+ * The specified names are used to determine the servlets whose requests + * are mapped to the servlet filter. + */ + public String[] servletNames; + + /** + * The request mappings for the servlet filter. + * + *

+ * The specified regular expressions are used to determine whether a request + * is mapped to the servlet filter. + */ + public String[] regexps; + + /** + * Specifies whether the servlet filter supports asynchronous processing. + */ + public boolean asyncSupported; + + /** + * The dispatcher associations for the servlet filter. + * + *

+ * The specified names are used to determine in what occasions the servlet + * filter is called + */ + public String[] dispatcher; + + /** + * The filter initialization parameters as provided during registration + * of the filter. Additional parameters like the Http Service Runtime + * attributes are not included. + */ + public Map initParams; + + /** + * Service property identifying the filter. In the case of a filter registered + * in the service registry and picked up by a whiteboard implementation, this value + * is not negative and corresponds to the service id in the registry. + * If the filter has not been registered in the service registry, the value + * is negative and a unique negative value is generated by the Http Service Runtime + * in this case. + */ + public long serviceId; + + /** + * The service id of the {@code ServletContext} for the servlet filter. + */ + public long servletContextId; +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FilterDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/FilterDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ListenerDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ListenerDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ListenerDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ListenerDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,48 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +import org.osgi.dto.DTO; + +/** + * Represents a listener currently being used for a servlet context. + * + * @NotThreadSafe + * @author $Id$ + */ +public class ListenerDTO extends DTO { + + /** + * The fully qualified type names the listener. + */ + public String[] types; + + /** + * Service property identifying the listener. In the case of a listener + * registered in the service registry and picked up by a whiteboard + * implementation, this value is not negative and corresponds to the service + * id in the registry. If the listener has not been registered in the + * service registry, the value is negative and a unique negative value is + * generated by the Http Service Runtime in this case. + */ + public long serviceId; + + /** + * The service id of the {@code ServletContext} for the listener. + */ + public long servletContextId; +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ListenerDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ListenerDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/RequestInfoDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/RequestInfoDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/RequestInfoDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/RequestInfoDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,60 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +import org.osgi.dto.DTO; + +/** + * Represents the services used to process a specific request. + * + * @NotThreadSafe + * @author $Id$ + */ +public class RequestInfoDTO extends DTO { + /** + * The path of the request relative to the root. + */ + public String path; + + /** + * The service id of the {@code ServletContext} for this request. + */ + public long servletContextId; + + /** + * The filters processing this request. + */ + public FilterDTO[] filterDTOs; + + /** + * The servlet processing this request. + * If the request is processed by a servlet, this field + * points to the DTO of the servlet. If the request is + * processed by another type of component like a resource, this + * field is null. + */ + public ServletDTO servletDTO; + + /** + * The resource processing this request. + * If the request is processed by a resource, this field + * points to the DTO of the resource. If the request is + * processed by another type of component like a servlet, this + * field is null. + */ + public ResourceDTO resourceDTO; +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/RequestInfoDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/RequestInfoDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url Added: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ResourceDTO.java URL: http://svn.apache.org/viewvc/felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ResourceDTO.java?rev=1598025&view=auto ============================================================================== --- felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ResourceDTO.java (added) +++ felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ResourceDTO.java Wed May 28 14:31:46 2014 @@ -0,0 +1,56 @@ +/* + * Copyright (c) OSGi Alliance (2012, 2014). All Rights Reserved. + * + * 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. + */ + +package org.osgi.service.http.runtime.dto; + +import org.osgi.dto.DTO; + +/** + * Represents a resource definition currently being used for a servlet context. + * + * @NotThreadSafe + * @author $Id$ + */ +public class ResourceDTO extends DTO { + /** + * The request mappings for the resource. + * + *

+ * The specified patterns are used to determine whether a request is + * mapped to the resource. + */ + public String[] patterns; + + /** + * The prefix of the resource. + */ + public String prefix; + + /** + * Service property identifying the resource. In the case of a resource registered + * in the service registry and picked up by a whiteboard implementation, this value + * is not negative and corresponds to the service id in the registry. + * If the resource has not been registered in the service registry, the value + * is negative and a unique negative value is generated by the Http Service Runtime + * in this case. + */ + public long serviceId; + + /** + * The service id of the {@code ServletContext} for the resource. + */ + public long servletContextId; +} Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ResourceDTO.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: felix/sandbox/http-rfc189/api/src/main/java/org/osgi/service/http/runtime/dto/ResourceDTO.java ------------------------------------------------------------------------------ svn:keywords = author date id revision rev url