http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java index 70c7b73..b92f3c3 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TempDirResource.java @@ -13,7 +13,6 @@ package org.apache.juneau.examples.rest; import static org.apache.juneau.dto.html5.HtmlBuilder.*; -import static org.apache.juneau.html.HtmlDocSerializerContext.*; import java.io.*; @@ -29,13 +28,14 @@ import org.apache.juneau.utils.*; */ @RestResource( path="/tempDir", - messages="nls/TempDirResource", + title="Temp Directory View Service", + description="View and download files in the '$S{java.io.tmpdir}' directory.", + pageLinks="{up:'$R{requestParentURI}',options:'?method=OPTIONS',upload:'upload',source:'$C{Source/gitHub}/org/apache/juneau/examples/rest/TempDirResource.java'}", properties={ @Property(name="rootDir", value="$S{java.io.tmpdir}"), @Property(name="allowViews", value="true"), @Property(name="allowDeletes", value="true"), - @Property(name="allowPuts", value="false"), - @Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',options:'$R{servletURI}?method=OPTIONS',upload:'upload',source:'$C{Source/gitHub}/org/apache/juneau/examples/rest/TempDirResource.java'}"), + @Property(name="allowPuts", value="false") }, stylesheet="styles/devops.css" )
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java index 282fa04..bd53404 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/TumblrParserResource.java @@ -12,8 +12,6 @@ // *************************************************************************************************************************** package org.apache.juneau.examples.rest; -import static org.apache.juneau.html.HtmlDocSerializerContext.*; - import org.apache.juneau.*; import org.apache.juneau.dto.Link; import org.apache.juneau.dto.html5.*; @@ -24,21 +22,19 @@ import org.apache.juneau.rest.client.*; @RestResource( path="/tumblrParser", messages="nls/TumblrParserResource", - properties={ - @Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',options:'?method=OPTIONS',source:'$C{Source/gitHub}/org/apache/juneau/examples/rest/TumblrParserResource.java'}"), - @Property(name=HTMLDOC_title, value="Tumblr parser service"), - @Property(name=HTMLDOC_description, value="Specify a URL to a Tumblr blog and parse the results.") - } + title="Tumblr parser service", + description="Specify a URL to a Tumblr blog and parse the results.", + pageLinks="{up:'$R{requestParentURI}',options:'?method=OPTIONS',source:'$C{Source/gitHub}/org/apache/juneau/examples/rest/TumblrParserResource.java'}" ) public class TumblrParserResource extends Resource { private static final long serialVersionUID = 1L; - @RestMethod(name="GET", path="/") + @RestMethod(name="GET", path="/", summary="Get the instructions page") public String getInstructions() throws Exception { return "Append the Tumblr blog name to the URL above (e.g. /juneau/sample/tumblrParser/mytumblrblog)"; } - @RestMethod(name="GET", path="/{blogName}") + @RestMethod(name="GET", path="/{blogName}", summary="Parse the specified blog") public ObjectList parseBlog(@Path String blogName) throws Exception { ObjectList l = new ObjectList(); RestClient rc = new RestClientBuilder().build(); http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java index 3f548b0..ec13b5e 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/UrlEncodedFormResource.java @@ -13,7 +13,6 @@ package org.apache.juneau.examples.rest; import static org.apache.juneau.dto.html5.HtmlBuilder.*; -import static org.apache.juneau.html.HtmlDocSerializerContext.*; import java.util.*; @@ -31,11 +30,9 @@ import org.apache.juneau.transforms.*; @RestResource( path="/urlEncodedForm", messages="nls/UrlEncodedFormResource", - properties={ - @Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',source:'$C{Source/gitHub}/org/apache/juneau/examples/rest/UrlEncodedFormResource.java'}"), - @Property(name=HTMLDOC_title, value="Tumblr parser service"), - @Property(name=HTMLDOC_description, value="Specify a URL to a Tumblr blog and parse the results.") - } + title="Tumblr parser service", + description="Specify a URL to a Tumblr blog and parse the results.", + pageLinks="{up:'$R{requestParentURI}',source:'$C{Source/gitHub}/org/apache/juneau/examples/rest/UrlEncodedFormResource.java'}" ) public class UrlEncodedFormResource extends Resource { private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java index 4a49a60..ab9ef57 100644 --- a/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java +++ b/juneau-examples-rest/src/main/java/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java @@ -41,13 +41,13 @@ import org.apache.juneau.utils.*; @RestResource( path="/addressBook", messages="nls/AddressBookResource", + pageLinks="{up:'$R{requestParentURI}',options:'?method=OPTIONS',source:'$C{Source/gitHub}/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java'}", properties={ @Property(name=REST_allowMethodParam, value="*"), @Property(name=HTML_uriAnchorText, value=TO_STRING), @Property(name=SERIALIZER_quoteChar, value="'"), @Property(name=RDF_rdfxml_tab, value="5"), @Property(name=RDF_addRootProperty, value="true"), - @Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',options:'$R{servletURI}?method=OPTIONS',source:'$C{Source/gitHub}/org/apache/juneau/examples/rest/addressbook/AddressBookResource.java'}"), // Resolve all relative URIs so that they're relative to this servlet! @Property(name=SERIALIZER_relativeUriBase, value="$R{servletURI}"), }, http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/AtomFeedResource.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/AtomFeedResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/AtomFeedResource.properties deleted file mode 100644 index 7ff4a44..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/AtomFeedResource.properties +++ /dev/null @@ -1,21 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# AtomFeedResource labels -#-------------------------------------------------------------------------------- -title = Sample ATOM feed resource -description = Sample resource that shows how to render ATOM feeds -getFeed = Get the sample ATOM feed -setFeed = Overwrite the sample ATOM feed -doOptions = Show resource options http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/CodeFormatterResource.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/CodeFormatterResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/CodeFormatterResource.properties deleted file mode 100644 index ac2f236..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/CodeFormatterResource.properties +++ /dev/null @@ -1,18 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# CodeFormatterResource labels -#-------------------------------------------------------------------------------- -title = Code Formatter -description = Utility for generating HTML code-formatted source code http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/HelloWorldResource.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/HelloWorldResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/HelloWorldResource.properties deleted file mode 100644 index 7c8f03d..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/HelloWorldResource.properties +++ /dev/null @@ -1,19 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# HelloWorldResource labels -#-------------------------------------------------------------------------------- -title = Hello World sample resource -description = Simplest possible resource -sayHello = Responds with "Hello world!" http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/JsonSchemaResource.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/JsonSchemaResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/JsonSchemaResource.properties deleted file mode 100644 index 1a486a9..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/JsonSchemaResource.properties +++ /dev/null @@ -1,20 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# JsonSchemaResource labels -#-------------------------------------------------------------------------------- -title = Sample resource that shows how to generate JSON-Schema documents -getSchema = Get the JSON-Schema document -setSchema = Overwrite the JSON-Schema document -doOptions = Show resource options http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/PhotosResource.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/PhotosResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/PhotosResource.properties deleted file mode 100644 index 93f7f7d..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/PhotosResource.properties +++ /dev/null @@ -1,24 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# PhotosResource labels -#-------------------------------------------------------------------------------- -title = Sample resource that allows images to be uploaded and retrieved. -getAllPhotos = Show the list of all currently loaded photos -getPhoto = Get a photo by ID -addPhoto = Add a photo -setPhoto = Overwrite a photo by ID -deletePhoto = Delete a photo by ID -doOptions = Show resource options - http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RequestEchoResource.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RequestEchoResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RequestEchoResource.properties deleted file mode 100644 index db7641c..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RequestEchoResource.properties +++ /dev/null @@ -1,19 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# RequestEchoResource labels -#-------------------------------------------------------------------------------- -title = Echos the current HttpServletRequest object back to the browser. -doGet = Serializes the incoming HttpServletRequest object. - http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RootResources.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RootResources.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RootResources.properties deleted file mode 100644 index 301057d..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/RootResources.properties +++ /dev/null @@ -1,18 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# RootResources labels -#-------------------------------------------------------------------------------- -title = Root resources -description = This is an example of a router resource that is used to access other resources. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SampleRemoteableServlet.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SampleRemoteableServlet.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SampleRemoteableServlet.properties deleted file mode 100644 index 48fd5ce..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SampleRemoteableServlet.properties +++ /dev/null @@ -1,17 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# SampleRemoteableServlet labels -#-------------------------------------------------------------------------------- -title = Sample resource that demonstrates the remotable API http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SourceResource.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SourceResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SourceResource.properties deleted file mode 100644 index 363f00a..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SourceResource.properties +++ /dev/null @@ -1,19 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# SourceResource labels -#-------------------------------------------------------------------------------- -title = Servlet for viewing source code on classes whose Java files are present on the classpath. -getSource = View source on the specified classes. - http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SqlQueryResource.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SqlQueryResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SqlQueryResource.properties deleted file mode 100644 index 527ca93..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/SqlQueryResource.properties +++ /dev/null @@ -1,19 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# SqlQueryResource labels -#-------------------------------------------------------------------------------- -title = Sample resource that shows how to serialize SQL ResultSets -doGet = Display the query entry page -doPost = Execute one or more queries http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TempDirResource.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TempDirResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TempDirResource.properties deleted file mode 100644 index 94c009e..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TempDirResource.properties +++ /dev/null @@ -1,18 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# TempDirResource labels -#-------------------------------------------------------------------------------- -title = Temp Directory View Service -description = View and download files in the '$S{java.io.tmpdir}' directory. http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TumblrParserResource.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TumblrParserResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TumblrParserResource.properties deleted file mode 100644 index 28a3e72..0000000 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/TumblrParserResource.properties +++ /dev/null @@ -1,19 +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. * -# *************************************************************************************************************************** - -#-------------------------------------------------------------------------------- -# SqlQueryResource labels -#-------------------------------------------------------------------------------- -title = Tumblr blog parser service -getInstructions = Get the instructions page -parseBlog = Parse the specified blog http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/UrlEncodedFormResource.properties ---------------------------------------------------------------------- diff --git a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/UrlEncodedFormResource.properties b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/UrlEncodedFormResource.properties index c7015c3..22575ae 100644 --- a/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/UrlEncodedFormResource.properties +++ b/juneau-examples-rest/src/main/resources/org/apache/juneau/examples/rest/nls/UrlEncodedFormResource.properties @@ -14,8 +14,6 @@ #-------------------------------------------------------------------------------- # UrlEncodedFormResource labels #-------------------------------------------------------------------------------- -title = URL-Encoded Form Post Example -description = Shows how URL-Encoded form input can be loaded into POJOs. POJO is simply echoed back. aString = A String: aNumber = A Number: aDate = A Date: http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-microservice/src/main/java/org/apache/juneau/microservice/Resource.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/Resource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/Resource.java index 6102193..bd57ece 100755 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/Resource.java +++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/Resource.java @@ -40,7 +40,7 @@ import org.apache.juneau.svl.vars.*; @SuppressWarnings("serial") @RestResource( properties={ - @Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',options:'$R{servletURI}?method=OPTIONS'}") + @Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',options:'?method=OPTIONS'}") }, config="$S{juneau.configFile}", stylesheet="$C{REST/stylesheet,styles/juneau.css}" http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceGroup.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceGroup.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceGroup.java index 440bd28..e02234b 100755 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceGroup.java +++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceGroup.java @@ -12,8 +12,6 @@ // *************************************************************************************************************************** package org.apache.juneau.microservice; -import static org.apache.juneau.html.HtmlDocSerializerContext.*; - import org.apache.juneau.rest.*; import org.apache.juneau.rest.annotation.*; import org.apache.juneau.svl.vars.*; @@ -40,9 +38,7 @@ import org.apache.juneau.svl.vars.*; */ @SuppressWarnings("serial") @RestResource( - properties={ - @Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',options:'$R{servletURI}?method=OPTIONS'}"), - }, + pageLinks="{up:'$R{requestParentURI}',options:'?method=OPTIONS'}", config="$S{juneau.configFile}", stylesheet="$C{REST/stylesheet,styles/juneau.css}" ) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceJena.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceJena.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceJena.java index 9c40804..2eafb12 100755 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceJena.java +++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/ResourceJena.java @@ -12,8 +12,6 @@ // *************************************************************************************************************************** package org.apache.juneau.microservice; -import static org.apache.juneau.html.HtmlDocSerializerContext.*; - import org.apache.juneau.rest.annotation.*; import org.apache.juneau.rest.jena.*; @@ -22,9 +20,7 @@ import org.apache.juneau.rest.jena.*; */ @SuppressWarnings("serial") @RestResource( - properties={ - @Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',options:'$R{servletURI}?method=OPTIONS'}") - }, + pageLinks="{up:'$R{requestParentURI}',options:'?method=OPTIONS'}", config="$S{juneau.configFile}", stylesheet="$C{REST/stylesheet,styles/juneau.css}" ) http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html b/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html index f77d119..dcdf2c5 100755 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html +++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/package.html @@ -166,7 +166,7 @@ title=<js>"Juneau Microservice Template"</js>, description=<js>"Template for creating REST microservices"</js>, properties={ - <ja>@Property</ja>(name=<jsf>HTMLDOC_links</jsf>, value=<js>"{options:'$R{servletURI}?method=OPTIONS'}"</js>) + <ja>@Property</ja>(name=<jsf>HTMLDOC_links</jsf>, value=<js>"{options:'?method=OPTIONS'}"</js>) }, children={ HelloWorldResource.<jk>class</jk>, @@ -755,7 +755,7 @@ title=<js>"Juneau Microservice Template"</js>, description=<js>"Template for creating REST microservices"</js>, properties={ - <ja>@Property</ja>(name=<jsf>HTMLDOC_links</jsf>, value=<js>"{options:'$R{servletURI}?method=OPTIONS'}"</js>) + <ja>@Property</ja>(name=<jsf>HTMLDOC_links</jsf>, value=<js>"{options:'?method=OPTIONS'}"</js>) }, children={ HelloWorldResource.<jk>class</jk>, http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java index 5bd0438..3d60bb9 100755 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java +++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/ConfigResource.java @@ -14,7 +14,6 @@ package org.apache.juneau.microservice.resources; import static javax.servlet.http.HttpServletResponse.*; import static org.apache.juneau.dto.html5.HtmlBuilder.*; -import static org.apache.juneau.html.HtmlDocSerializerContext.*; import java.io.*; import java.util.Map; @@ -34,9 +33,7 @@ import org.apache.juneau.rest.annotation.Body; path="/config", title="Configuration", description="Contents of configuration file.", - properties={ - @Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',options:'$R{servletURI}?method=OPTIONS',edit:'$R{servletURI}/edit'}"), - } + pageLinks="{up:'$R{requestParentURI}',options:'?method=OPTIONS',edit:'edit'}" ) public class ConfigResource extends Resource { private static final long serialVersionUID = 1L; http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java index 0922221..556dd98 100755 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java +++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/DirectoryResource.java @@ -57,9 +57,9 @@ import org.apache.juneau.utils.*; title="File System Explorer", description="Contents of $R{attribute.path}", messages="nls/DirectoryResource", + pageLinks="{up:'$R{requestParentURI}',options:'?method=OPTIONS'}", properties={ @Property(name=HTML_uriAnchorText, value=PROPERTY_NAME), - @Property(name=HTMLDOC_links, value="{up:'$R{requestParentURI}',options:'?method=OPTIONS',source:'$R{servletParentURI}/source?classes=(org.apache.juneau.rest.samples.DirectoryResource)'}"), @Property(name=REST_allowMethodParam, value="*"), @Property(name="DirectoryResource.rootDir", value=""), @Property(name="DirectoryResource.allowViews", value="false"), http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java ---------------------------------------------------------------------- diff --git a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java index b2011a4..e39aa7a 100755 --- a/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java +++ b/juneau-microservice/src/main/java/org/apache/juneau/microservice/resources/LogsResource.java @@ -32,6 +32,7 @@ import org.apache.juneau.rest.annotation.*; import org.apache.juneau.rest.annotation.Properties; import org.apache.juneau.rest.converters.*; import org.apache.juneau.transforms.*; +import org.apache.juneau.utils.*; /** * REST resource for viewing and accessing log files. @@ -80,13 +81,14 @@ public class LogsResource extends Resource { * [GET /*] - Get file details or directory listing. * * @param req The HTTP request + * @param res The HTTP response * @param properties The writable properties for setting the descriptions. * @param path The log file path. * @return The log file. * @throws Exception */ @RestMethod(name="GET", path="/*", responses={@Response(200),@Response(404)}) - public Object getFileOrDirectory(RestRequest req, @Properties ObjectMap properties, @PathRemainder String path) throws Exception { + public Object getFileOrDirectory(RestRequest req, RestResponse res, @Properties ObjectMap properties, @PathRemainder String path) throws Exception { File f = getFile(path); @@ -99,11 +101,12 @@ public class LogsResource extends Resource { l.add(new FileResource(fc, fUrl)); } } - properties.put(HTMLDOC_description, "Contents of " + f.getAbsolutePath()); + res.setPageText(new StringMessage("Contents of {0}", f.getAbsolutePath())); + properties.put(HTMLDOC_text, "Contents of " + f.getAbsolutePath()); return l; } - properties.put(HTMLDOC_description, "File details on " + f.getAbsolutePath()); + res.setPageText(new StringMessage("File details on {0}", f.getAbsolutePath())); return new FileResource(f, new URL(req.getTrimmedRequestURL().toString())); } http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/HtmlPropertiesResource.java ---------------------------------------------------------------------- diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/HtmlPropertiesResource.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/HtmlPropertiesResource.java new file mode 100644 index 0000000..648008c --- /dev/null +++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/HtmlPropertiesResource.java @@ -0,0 +1,305 @@ +// *************************************************************************************************************************** +// * 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.rest.test; + +import org.apache.juneau.html.*; +import org.apache.juneau.rest.*; +import org.apache.juneau.rest.annotation.*; + +/** + * JUnit automated testcase resource. + * Tests the various permutations of populating the HTML page titles, text, and links. + */ +@RestResource( + path="/testHtmlProperties", + children={ + HtmlPropertiesResource.Normal.class, + HtmlPropertiesResource.NormalInit.class, + HtmlPropertiesResource.NormalDefaulting.class, + HtmlPropertiesResource.NormalSubclassed1.class, + HtmlPropertiesResource.NormalSubclassed2.class, + HtmlPropertiesResource.LocalizedImplicit.class, + HtmlPropertiesResource.LocalizedExplicit.class + } +) +@SuppressWarnings("serial") +public class HtmlPropertiesResource extends RestServletGroupDefault { + private static final long serialVersionUID = 1L; + + + @RestResource( + path="/Normal", + pageTitle="Normal-title", + pageText="Normal-text", + pageLinks="{link:'Normal-links'}" + ) + public static class Normal extends RestServletDefault { + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX). + //---------------------------------------------------------------------------------------------------- + @RestMethod(name="GET", path="/test1") + public String test1() { + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX), overridden by @RestMethod(pageX) annotations. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test2", pageTitle="Normal.test2-title", pageText="Normal.test2-text", pageLinks="{link:'Normal.test2-links'}") + public String test2() { + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX), overridden by RestResponse.setPageX() methods. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test3") + public String test3(RestResponse res) { + res.setPageTitle("Normal.test3-title"); + res.setPageText("Normal.test3-text"); + res.setPageLinks("{link:'Normal.test3-links'}"); + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX), overridden by RestResponse.setProperty() method. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test4") + public String test4(RestResponse res) { + res.setProperty(HtmlDocSerializerContext.HTMLDOC_title, "Normal.test4-title"); + res.setProperty(HtmlDocSerializerContext.HTMLDOC_text, "Normal.test4-text"); + res.setProperty(HtmlDocSerializerContext.HTMLDOC_links, "{link:'Normal.test4-links'}"); + return "OK"; + } + } + + @RestResource( + path="/NormalInit" + ) + public static class NormalInit extends RestServletDefault { + + @Override + public void init(RestConfig config) throws Exception { + config.setPageTitle("NormalInit-title"); + config.setPageText("NormalInit-text"); + config.setPageLinks("{link:'NormalInit-links'}"); + super.init(config); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from RestConfig.setX() methods. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test1") + public String test1() { + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from RestConfig.setX() methods, overridden by @RestMethod(pageX) annotations. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test2", pageTitle="NormalInit.test2-title", pageText="NormalInit.test2-text", pageLinks="{link:'NormalInit.test2-links'}") + public String test2() { + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from RestConfig.setX() methods, overridden by RestResponse.setPageX() methods. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test3") + public String test3(RestResponse res) { + res.setPageTitle("NormalInit.test3-title"); + res.setPageText("NormalInit.test3-text"); + res.setPageLinks("{link:'NormalInit.test3-links'}"); + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from RestConfig.setX() methods, overridden by RestResponse.setProperty() method. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test4") + public String test4(RestResponse res) { + res.setProperty(HtmlDocSerializerContext.HTMLDOC_title, "NormalInit.test4-title"); + res.setProperty(HtmlDocSerializerContext.HTMLDOC_text, "NormalInit.test4-text"); + res.setProperty(HtmlDocSerializerContext.HTMLDOC_links, "{link:'NormalInit.test4-links'}"); + return "OK"; + } + } + + @RestResource( + path="/NormalDefaulting", + title="NormalDefaulting-title", + description="NormalDefaulting-description" + ) + public static class NormalDefaulting extends RestServletDefault { + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(path/title). + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test1") + public String test1() { + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(path/title), overridden by @RestMethod(pageX) annotations. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test2", summary="NormalDefaulting.test2-summary") + public String test2() { + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(path/title), overridden by RestResponse.setPageX() methods. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test3") + public String test3(RestResponse res) { + res.setPageTitle("NormalDefaulting.test3-title"); + res.setPageText("NormalDefaulting.test3-text"); + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(path/title), overridden by RestResponse.setProperty() method. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test4") + public String test4(RestResponse res) { + res.setProperty(HtmlDocSerializerContext.HTMLDOC_title, "NormalDefaulting.test4-title"); + res.setProperty(HtmlDocSerializerContext.HTMLDOC_text, "NormalDefaulting.test4-text"); + return "OK"; + } + } + + + @RestResource( + path="/NormalSubclassed1" + ) + public static class NormalSubclassed1 extends Normal { + + //---------------------------------------------------------------------------------------------------- + // Values pulled from parent @RestResource(path/title). + //---------------------------------------------------------------------------------------------------- + @Override + @RestMethod(path="/test1") + public String test1() { + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from parent @RestResource(path/title), overridden by @RestMethod(pageX) annotations. + //---------------------------------------------------------------------------------------------------- + @Override + @RestMethod(path="/test2", pageTitle="NormalSubclassed1.test2-title", pageText="NormalSubclassed1.test2-text", pageLinks="{link:'NormalSubclassed1.test2-links'}") + public String test2() { + return "OK"; + } + } + + @RestResource( + path="/NormalSubclassed2", + pageTitle="NormalSubclassed2-title", + pageText="NormalSubclassed2-text", + pageLinks="{link:'NormalSubclassed2-links'}" + ) + public static class NormalSubclassed2 extends Normal { + + //---------------------------------------------------------------------------------------------------- + // Values pulled from parent @RestResource(path/title), overridden by child @RestResource(pageTitle/pageText). + //---------------------------------------------------------------------------------------------------- + @Override + @RestMethod(path="/test1") + public String test1() { + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from parent @RestResource(path/title), overridden by @RestMethod(pageX). + //---------------------------------------------------------------------------------------------------- + @Override + @RestMethod(path="/test2", pageTitle="NormalSubclassed2.test2-title", pageText="NormalSubclassed2.test2-text", pageLinks="{link:'NormalSubclassed2.test2-links'}") + public String test2() { + return "OK"; + } + } + + @RestResource( + path="/LocalizedExplicit", + messages="HtmlPropertiesResource", + pageTitle="$L{pageTitle}", + pageText="$L{pageText}", + pageLinks="$L{pageLinks}" + ) + public static class LocalizedExplicit extends RestServletDefault { + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX) with $L variables. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test1") + public String test1() { + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX) with $L variables, overridden by @RestMethod(pageX) with $L variables. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test2", pageTitle="$L{test2.pageTitle}", pageText="$L{test2.pageText}", pageLinks="$L{test2.pageLinks}") + public String test2() { + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX) with $L variables, overridden by RestResponse.setPageX() with $L variables. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test3") + public String test3(RestResponse res) { + res.setPageTitle("$L{test3.pageTitle}"); + res.setPageText("$L{test3.pageText}"); + res.setPageLinks("$L{test3.pageLinks}"); + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX) with $L variables, overridden by RestResponse.setProperty() with $L variables. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test4") + public String test4(RestResponse res) { + res.setProperty(HtmlDocSerializerContext.HTMLDOC_title, "$L{test4.pageTitle}"); + res.setProperty(HtmlDocSerializerContext.HTMLDOC_text, "$L{test4.pageText}"); + res.setProperty(HtmlDocSerializerContext.HTMLDOC_links, "$L{test4.pageLinks}"); + return "OK"; + } + } + + @RestResource( + path="/LocalizedImplicit", + messages="HtmlPropertiesResource" + ) + public static class LocalizedImplicit extends RestServletDefault { + + //---------------------------------------------------------------------------------------------------- + // Values pulled from resource bundle. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test1") + public String test1() { + return "OK"; + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from resource bundle, overridden by values in resource bundle at method level. + //---------------------------------------------------------------------------------------------------- + @RestMethod(path="/test2") + public String test2() { + return "OK"; + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java ---------------------------------------------------------------------- diff --git a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java index ceeaf48..74834a0 100644 --- a/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java +++ b/juneau-rest-test/src/main/java/org/apache/juneau/rest/test/Root.java @@ -33,6 +33,7 @@ import org.apache.juneau.rest.labels.*; GroupsResource.class, GzipResource.TestGzipOff.class, GzipResource.TestGzipOn.class, + HtmlPropertiesResource.class, InheritanceResource.TestEncoders.class, InheritanceResource.TestTransforms.class, InheritanceResource.TestParsers.class, http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-rest-test/src/main/resources/org/apache/juneau/rest/test/HtmlPropertiesResource.properties ---------------------------------------------------------------------- diff --git a/juneau-rest-test/src/main/resources/org/apache/juneau/rest/test/HtmlPropertiesResource.properties b/juneau-rest-test/src/main/resources/org/apache/juneau/rest/test/HtmlPropertiesResource.properties new file mode 100644 index 0000000..a216564 --- /dev/null +++ b/juneau-rest-test/src/main/resources/org/apache/juneau/rest/test/HtmlPropertiesResource.properties @@ -0,0 +1,37 @@ +# *************************************************************************************************************************** +# * 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. * +# * * +# *************************************************************************************************************************** + +LocalizedExplicit.pageTitle = LocalizedExplicit.nls.pageTitle +LocalizedExplicit.pageText = LocalizedExplicit.nls.pageText +LocalizedExplicit.pageLinks = {link:'LocalizedExplicit.nls.pageLinks'} + +LocalizedExplicit.test2.pageTitle = LocalizedExplicit.test2.nls.pageTitle +LocalizedExplicit.test2.pageText = LocalizedExplicit.test2.nls.pageText +LocalizedExplicit.test2.pageLinks = {link:'LocalizedExplicit.test2.nls.pageLinks'} + +LocalizedExplicit.test3.pageTitle = LocalizedExplicit.test3.nls.pageTitle +LocalizedExplicit.test3.pageText = LocalizedExplicit.test3.nls.pageText +LocalizedExplicit.test3.pageLinks = {link:'LocalizedExplicit.test3.nls.pageLinks'} + +LocalizedExplicit.test4.pageTitle = LocalizedExplicit.test4.nls.pageTitle +LocalizedExplicit.test4.pageText = LocalizedExplicit.test4.nls.pageText +LocalizedExplicit.test4.pageLinks = {link:'LocalizedExplicit.test4.nls.pageLinks'} + +LocalizedImplicit.pageTitle = LocalizedImplicit.nls.pageTitle +LocalizedImplicit.pageText = LocalizedImplicit.nls.pageText +LocalizedImplicit.pageLinks = {link:'LocalizedImplicit.nls.pageLinks'} + +LocalizedImplicit.test2.pageTitle = LocalizedImplicit.test2.nls.pageTitle +LocalizedImplicit.test2.pageText = LocalizedImplicit.test2.nls.pageText +LocalizedImplicit.test2.pageLinks = {link:'LocalizedImplicit.test2.nls.pageLinks'} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/703cadd2/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/HtmlPropertiesTest.java ---------------------------------------------------------------------- diff --git a/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/HtmlPropertiesTest.java b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/HtmlPropertiesTest.java new file mode 100644 index 0000000..410060d --- /dev/null +++ b/juneau-rest-test/src/test/java/org/apache/juneau/rest/test/HtmlPropertiesTest.java @@ -0,0 +1,286 @@ +// *************************************************************************************************************************** +// * 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.rest.test; + +import static org.junit.Assert.*; + +import org.apache.juneau.rest.client.*; +import org.junit.*; + +/** + * Tests HTML page titles, text, and links. + */ +public class HtmlPropertiesTest extends RestTestcase { + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX). + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalTest1() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/Normal/test1").accept("text/html").getResponseAsString(); + assertTrue(s.contains("Normal-title")); + assertTrue(s.contains("Normal-text")); + assertTrue(s.contains("Normal-links")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX), overridden by @RestMethod(pageX) annotations. + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalTest2() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/Normal/test2").accept("text/html").getResponseAsString(); + assertTrue(s.contains("Normal.test2-title")); + assertTrue(s.contains("Normal.test2-text")); + assertTrue(s.contains("Normal.test2-links")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX), overridden by RestResponse.setPageX() methods. + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalTest3() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/Normal/test3").accept("text/html").getResponseAsString(); + assertTrue(s.contains("Normal.test3-title")); + assertTrue(s.contains("Normal.test3-text")); + assertTrue(s.contains("Normal.test3-links")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX), overridden by RestResponse.setProperty() method. + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalTest4() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/Normal/test4").accept("text/html").getResponseAsString(); + assertTrue(s.contains("Normal.test4-title")); + assertTrue(s.contains("Normal.test4-text")); + assertTrue(s.contains("Normal.test4-links")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from RestConfig.setX() methods. + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalInitTest1() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalInit/test1").accept("text/html").getResponseAsString(); + assertTrue(s.contains("NormalInit-title")); + assertTrue(s.contains("NormalInit-text")); + assertTrue(s.contains("NormalInit-links")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from RestConfig.setX() methods, overridden by @RestMethod(pageX) annotations. + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalInitTest2() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalInit/test2").accept("text/html").getResponseAsString(); + assertTrue(s.contains("NormalInit.test2-title")); + assertTrue(s.contains("NormalInit.test2-text")); + assertTrue(s.contains("NormalInit.test2-links")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from RestConfig.setX() methods, overridden by RestResponse.setPageX() methods. + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalInitTest3() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalInit/test3").accept("text/html").getResponseAsString(); + System.err.println(s); + assertTrue(s.contains("NormalInit.test3-title")); + assertTrue(s.contains("NormalInit.test3-text")); + assertTrue(s.contains("NormalInit.test3-links")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from RestConfig.setX() methods, overridden by RestResponse.setProperty() method. + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalInitTest4() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalInit/test4").accept("text/html").getResponseAsString(); + assertTrue(s.contains("NormalInit.test4-title")); + assertTrue(s.contains("NormalInit.test4-text")); + assertTrue(s.contains("NormalInit.test4-links")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(path/title). + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalDefaultingTest1() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalDefaulting/test1").accept("text/html").getResponseAsString(); + assertTrue(s.contains("NormalDefaulting-title")); + assertTrue(s.contains("NormalDefaulting-description")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(path/title), overridden by @RestMethod(pageX) annotations. + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalDefaultingTest2() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalDefaulting/test2").accept("text/html").getResponseAsString(); + assertTrue(s.contains("NormalDefaulting-title")); + assertTrue(s.contains("NormalDefaulting.test2-summary")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(path/title), overridden by RestResponse.setPageX() methods. + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalDefaultingTest3() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalDefaulting/test3").accept("text/html").getResponseAsString(); + assertTrue(s.contains("NormalDefaulting.test3-title")); + assertTrue(s.contains("NormalDefaulting.test3-text")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(path/title), overridden by RestResponse.setProperty() method. + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalDefaultingTest4() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalDefaulting/test4").accept("text/html").getResponseAsString(); + assertTrue(s.contains("NormalDefaulting.test4-title")); + assertTrue(s.contains("NormalDefaulting.test4-text")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from parent @RestResource(path/title). + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalSubclassed1Test1() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalSubclassed1/test1").accept("text/html").getResponseAsString(); + assertTrue(s.contains("Normal-title")); + assertTrue(s.contains("Normal-text")); + assertTrue(s.contains("Normal-links")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from parent @RestResource(path/title), overridden by @RestMethod(pageX) annotations. + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalSubclassed1Test2() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalSubclassed1/test2").accept("text/html").getResponseAsString(); + assertTrue(s.contains("NormalSubclassed1.test2-title")); + assertTrue(s.contains("NormalSubclassed1.test2-text")); + assertTrue(s.contains("NormalSubclassed1.test2-links")); + + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from parent @RestResource(path/title), overridden by child @RestResource(pageTitle/pageText). + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalSubclassed2Test1() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalSubclassed2/test1").accept("text/html").getResponseAsString(); + assertTrue(s.contains("NormalSubclassed2-title")); + assertTrue(s.contains("NormalSubclassed2-text")); + assertTrue(s.contains("NormalSubclassed2-links")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from parent @RestResource(path/title), overridden by @RestMethod(pageX). + //---------------------------------------------------------------------------------------------------- + @Test + public void testNormalSubclassed2Test2() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/NormalSubclassed2/test2").accept("text/html").getResponseAsString(); + assertTrue(s.contains("NormalSubclassed2.test2-title")); + assertTrue(s.contains("NormalSubclassed2.test2-text")); + assertTrue(s.contains("NormalSubclassed2.test2-links")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX) with $L variables. + //---------------------------------------------------------------------------------------------------- + @Test + public void testLocalizedExplicitTest1() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/LocalizedExplicit/test1").accept("text/html").getResponseAsString(); + assertTrue(s.contains("LocalizedExplicit.nls.pageTitle")); + assertTrue(s.contains("LocalizedExplicit.nls.pageText")); + assertTrue(s.contains("LocalizedExplicit.nls.pageLinks")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX) with $L variables, overridden by @RestMethod(pageX) with $L variables. + //---------------------------------------------------------------------------------------------------- + @Test + public void testLocalizedExplicitTest2() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/LocalizedExplicit/test2").accept("text/html").getResponseAsString(); + assertTrue(s.contains("LocalizedExplicit.test2.nls.pageTitle")); + assertTrue(s.contains("LocalizedExplicit.test2.nls.pageText")); + assertTrue(s.contains("LocalizedExplicit.test2.nls.pageLinks")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX) with $L variables, overridden by RestResponse.setPageX() with $L variables. + //---------------------------------------------------------------------------------------------------- + @Test + public void testLocalizedExplicitTest3() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/LocalizedExplicit/test3").accept("text/html").getResponseAsString(); + assertTrue(s.contains("LocalizedExplicit.test3.nls.pageTitle")); + assertTrue(s.contains("LocalizedExplicit.test3.nls.pageText")); + assertTrue(s.contains("LocalizedExplicit.test3.nls.pageLinks")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from @RestResource(pageX) with $L variables, overridden by RestResponse.setProperty() with $L variables. + //---------------------------------------------------------------------------------------------------- + @Test + public void testLocalizedExplicitTest4() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/LocalizedExplicit/test4").accept("text/html").getResponseAsString(); + assertTrue(s.contains("LocalizedExplicit.test4.nls.pageTitle")); + assertTrue(s.contains("LocalizedExplicit.test4.nls.pageText")); + assertTrue(s.contains("LocalizedExplicit.test4.nls.pageLinks")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from resource bundle. + //---------------------------------------------------------------------------------------------------- + @Test + public void testLocalizedImplicitTest1() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/LocalizedImplicit/test1").accept("text/html").getResponseAsString(); + assertTrue(s.contains("LocalizedImplicit.nls.pageTitle")); + assertTrue(s.contains("LocalizedImplicit.nls.pageText")); + assertTrue(s.contains("LocalizedImplicit.nls.pageLinks")); + } + + //---------------------------------------------------------------------------------------------------- + // Values pulled from resource bundle, overridden by values in resource bundle at method level. + //---------------------------------------------------------------------------------------------------- + @Test + public void testLocalizedImplicitTest2() throws Exception { + RestClient client = TestMicroservice.DEFAULT_CLIENT; + String s = client.doGet("/testHtmlProperties/LocalizedImplicit/test2").accept("text/html").getResponseAsString(); + assertTrue(s.contains("LocalizedImplicit.test2.nls.pageTitle")); + assertTrue(s.contains("LocalizedImplicit.test2.nls.pageText")); + assertTrue(s.contains("LocalizedImplicit.test2.nls.pageLinks")); + } +}
