http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-server/src/main/java/org/apache/juneau/server/labels/NameDescription.java ---------------------------------------------------------------------- diff --git a/juneau-server/src/main/java/org/apache/juneau/server/labels/NameDescription.java b/juneau-server/src/main/java/org/apache/juneau/server/labels/NameDescription.java deleted file mode 100755 index 72f1d6b..0000000 --- a/juneau-server/src/main/java/org/apache/juneau/server/labels/NameDescription.java +++ /dev/null @@ -1,72 +0,0 @@ -// *************************************************************************************************************************** -// * 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 org.apache.juneau.server.labels; - -import org.apache.juneau.annotation.*; - -/** - * Simple bean with {@code name} and {@code description} properties. - * <p> - * Primarily used for constructing tables with name/description columns on REST OPTIONS requests. - */ -@Bean(properties="name,description") -public class NameDescription { - - private Object name; - private Object description; - - /** No-arg constructor. Used for JUnit testing of OPTIONS pages. */ - public NameDescription() {} - - /** - * Constructor. - * @param name A name. - * @param description A description. - */ - public NameDescription(Object name, Object description) { - this.name = name; - this.description = description; - } - - /** - * Returns the name field on this label. - * @return The name. - */ - public Object getName() { - return name; - } - - /** - * Sets the name field on this label to a new value. - * @param name The new name. - */ - public void setName(Object name) { - this.name = name; - } - - /** - * Returns the description field on this label. - * @return The description. - */ - public Object getDescription() { - return description; - } - - /** - * Sets the description field on this label to a new value. - * @param description The new description. - */ - public void setDescription(Object description) { - this.description = description; - } -}
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceDescription.java ---------------------------------------------------------------------- diff --git a/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceDescription.java b/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceDescription.java deleted file mode 100755 index 81767be..0000000 --- a/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceDescription.java +++ /dev/null @@ -1,106 +0,0 @@ -// *************************************************************************************************************************** -// * 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 org.apache.juneau.server.labels; - -import org.apache.juneau.dto.*; -import org.apache.juneau.server.*; - -/** - * Shortcut label for child resources. Typically used in router resources. - * - * <h6 class='topic'>Example:</h6> - * <p class='bcode'> - * <jc>// Instead of this...</jc> - * <jk>new</jk> NameDescription(<jk>new</jk> Link(<js>"httpTool"</js>, uri + <js>"/httpTool"</js>), <js>"HTTP request test client"</js>); - * - * <jc>// ...use this simpler equivalent...</jc> - * <jk>new</jk> ResourceLink(uri, <js>"httpTool"</js>, <js>"HTTP request test client"</js>); - * </p> - */ -public final class ResourceDescription extends NameDescription implements Comparable<ResourceDescription> { - - /** - * Constructor. - * - * @param rootUrl The root URI of the child resource (e.g. the URI of the parent resource). - * Must not end with <js>'/'</js>. - * Must be URL-Encoded. - * @param name The name of the child resource. - * This will be URL-encoded and appended onto the root URL to create the hyperlink for the resource. - * @param description The description of the child resource. - */ - public ResourceDescription(String rootUrl, String name, String description) { - super(new Link(name, (rootUrl.equals("/") || rootUrl.isEmpty() ? "/" : rootUrl + "/") + RestUtils.encode(name)), description); - } - - /** - * Constructor for resources that are children of a REST resource. - * - * @param req The HTTP request. - * @param childPath The childPath The path of the child resource relative to the servlet. - * @param description The description of the child resource. - */ - public ResourceDescription(RestRequest req, String childPath, String description) { - super(new Link(calcName(childPath), calcHref(req, childPath)), description); - } - - private static String calcName(String childPath) { - return RestUtils.decode(childPath.indexOf('/') == -1 ? childPath : childPath.substring(childPath.lastIndexOf('/')+1)); - } - - private static String calcHref(RestRequest req, String childPath) { - return req.getServletURIBuilder().append('/').append(childPath).toString(); - } - - /** - * Constructor. - * - * @param name The name of the child resource. - * @param description The description of the child resource. - */ - public ResourceDescription(String name, String description) { - super(new Link(name, name), description); - } - - /** No-arg constructor. Used for JUnit testing of OPTIONS pages. */ - public ResourceDescription() {} - - @Override /* NameDescription */ - public Link getName() { - return (Link)super.getName(); - } - - /** - * Overridden setter. - * - * @param name The new name. - */ - public void setName(Link name) { - super.setName(name); - } - - @Override /* Comparable */ - public int compareTo(ResourceDescription o) { - return getName().compareTo(o.getName()); - } - - @Override /* Object */ - public boolean equals(Object o) { - return (o instanceof ResourceDescription) && ((ResourceDescription)o).getName().equals(getName()); - } - - @Override /* Object */ - public int hashCode() { - return getName().hashCode(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceLink.java ---------------------------------------------------------------------- diff --git a/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceLink.java b/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceLink.java deleted file mode 100755 index 909a0ef..0000000 --- a/juneau-server/src/main/java/org/apache/juneau/server/labels/ResourceLink.java +++ /dev/null @@ -1,66 +0,0 @@ -// *************************************************************************************************************************** -// * 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 org.apache.juneau.server.labels; - -import java.text.*; - -import org.apache.juneau.dto.*; -import org.apache.juneau.server.*; - -/** - * A simple link to a child of a parent resource. - */ -public class ResourceLink extends Link { - - /** - * Constructor. - * - * @param req The HTTP request from the parent resource. - * @param childPath The child resource path. - * @param args Optional {@link MessageFormat}-style arguments in the child path. - */ - public ResourceLink(RestRequest req, String childPath, Object...args) { - super(getName(getPath(childPath,args)), getHref(req, getPath(childPath,args))); - } - - /** - * Constructor. - * - * @param label The label for the link. - * @param req The HTTP request from the parent resource. - * @param childPath The child resource path. - * @param args Optional {@link MessageFormat}-style arguments in the child path. - */ - public ResourceLink(String label, RestRequest req, String childPath, Object...args) { - super(label, getHref(req, getPath(childPath,args))); - } - - private static String getName(String childPath) { - String s = childPath; - if (childPath.indexOf('/') == -1) - s = childPath; - else - s = childPath.substring(childPath.lastIndexOf('/')+1); - return RestUtils.decode(s); - } - - private static String getHref(RestRequest req, String childPath) { - return req.getServletURIBuilder().append('/').append(childPath).toString(); - } - - private static String getPath(String childPath, Object...args) { - if (args.length > 0) - childPath = MessageFormat.format(childPath, args); - return childPath; - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-server/src/main/java/org/apache/juneau/server/labels/package.html ---------------------------------------------------------------------- diff --git a/juneau-server/src/main/java/org/apache/juneau/server/labels/package.html b/juneau-server/src/main/java/org/apache/juneau/server/labels/package.html deleted file mode 100755 index 4e03390..0000000 --- a/juneau-server/src/main/java/org/apache/juneau/server/labels/package.html +++ /dev/null @@ -1,41 +0,0 @@ -<!DOCTYPE HTML> -<!-- -/*************************************************************************************************************************** - * 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. - * - ***************************************************************************************************************************/ - --> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <style type="text/css"> - /* For viewing in Page Designer */ - @IMPORT url("../../../../javadoc.css"); - - /* For viewing in REST interface */ - @IMPORT url("../htdocs/javadoc.css"); - body { - margin: 20px; - } - </style> - <script> - /* Replace all @code and @link tags. */ - window.onload = function() { - document.body.innerHTML = document.body.innerHTML.replace(/\{\@code ([^\}]+)\}/g, '<code>$1</code>'); - document.body.innerHTML = document.body.innerHTML.replace(/\{\@link (([^\}]+)\.)?([^\.\}]+)\}/g, '<code>$3</code>'); - } - </script> -</head> -<body> -<p>Various REST interface label classes</p> -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-server/src/main/java/org/apache/juneau/server/matchers/MultipartFormDataMatcher.java ---------------------------------------------------------------------- diff --git a/juneau-server/src/main/java/org/apache/juneau/server/matchers/MultipartFormDataMatcher.java b/juneau-server/src/main/java/org/apache/juneau/server/matchers/MultipartFormDataMatcher.java deleted file mode 100755 index ea0c812..0000000 --- a/juneau-server/src/main/java/org/apache/juneau/server/matchers/MultipartFormDataMatcher.java +++ /dev/null @@ -1,26 +0,0 @@ -// *************************************************************************************************************************** -// * 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 org.apache.juneau.server.matchers; - -import org.apache.juneau.server.*; - -/** - * Predefined matcher for matching requests with content type <js>"multipart/form-data"</js>. - */ -public class MultipartFormDataMatcher extends RestMatcher { - @Override /* RestMatcher */ - public boolean matches(RestRequest req) { - String contentType = req.getContentType(); - return contentType != null && contentType.startsWith("multipart/form-data"); //$NON-NLS-1$ - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-server/src/main/java/org/apache/juneau/server/matchers/UrlEncodedFormMatcher.java ---------------------------------------------------------------------- diff --git a/juneau-server/src/main/java/org/apache/juneau/server/matchers/UrlEncodedFormMatcher.java b/juneau-server/src/main/java/org/apache/juneau/server/matchers/UrlEncodedFormMatcher.java deleted file mode 100755 index 7dfd4e6..0000000 --- a/juneau-server/src/main/java/org/apache/juneau/server/matchers/UrlEncodedFormMatcher.java +++ /dev/null @@ -1,26 +0,0 @@ -// *************************************************************************************************************************** -// * 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 org.apache.juneau.server.matchers; - -import org.apache.juneau.server.*; - -/** - * Predefined matcher for matching requests with content type <js>"application/x-www-form-urlencoded"</js>. - */ -public class UrlEncodedFormMatcher extends RestMatcher { - @Override /* RestMatcher */ - public boolean matches(RestRequest req) { - String contentType = req.getContentType(); - return contentType != null && contentType.equals("application/x-www-form-urlencoded"); //$NON-NLS-1$ - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-server/src/main/java/org/apache/juneau/server/matchers/package.html ---------------------------------------------------------------------- diff --git a/juneau-server/src/main/java/org/apache/juneau/server/matchers/package.html b/juneau-server/src/main/java/org/apache/juneau/server/matchers/package.html deleted file mode 100755 index 7eacf3a..0000000 --- a/juneau-server/src/main/java/org/apache/juneau/server/matchers/package.html +++ /dev/null @@ -1,34 +0,0 @@ -<!DOCTYPE HTML> -<!-- -/*************************************************************************************************************************** - * 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. - * - ***************************************************************************************************************************/ - --> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <style type="text/css"> - /* For viewing in Page Designer */ - @IMPORT url("../../../../../javadoc.css"); - - /* For viewing in REST interface */ - @IMPORT url("../htdocs/javadoc.css"); - body { - margin: 20px; - } - </style> -</head> -<body> -<p>Predefined Matchers</p> -</body> -</html> \ No newline at end of file