http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/java/org/apache/juneau/server/samples/addressbook/AddressBookResource.java ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/java/org/apache/juneau/server/samples/addressbook/AddressBookResource.java b/juneau-samples/src/main/java/org/apache/juneau/server/samples/addressbook/AddressBookResource.java deleted file mode 100755 index b49d17c..0000000 --- a/juneau-samples/src/main/java/org/apache/juneau/server/samples/addressbook/AddressBookResource.java +++ /dev/null @@ -1,320 +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.samples.addressbook; - -import static javax.servlet.http.HttpServletResponse.*; -import static org.apache.juneau.html.HtmlDocSerializerContext.*; -import static org.apache.juneau.jena.RdfCommonContext.*; -import static org.apache.juneau.jena.RdfSerializerContext.*; -import static org.apache.juneau.samples.addressbook.AddressBook.*; -import static org.apache.juneau.server.RestServletContext.*; - -import java.util.*; - -import org.apache.juneau.*; -import org.apache.juneau.dto.*; -import org.apache.juneau.dto.cognos.*; -import org.apache.juneau.dto.swagger.*; -import org.apache.juneau.encoders.*; -import org.apache.juneau.microservice.*; -import org.apache.juneau.samples.addressbook.*; -import org.apache.juneau.server.*; -import org.apache.juneau.server.annotation.*; -import org.apache.juneau.server.converters.*; -import org.apache.juneau.server.samples.*; -import org.apache.juneau.transform.*; -import org.apache.juneau.utils.*; - -/** - * Proof-of-concept resource that shows off the capabilities of working with POJO resources. - * Consists of an in-memory address book repository. - */ -@RestResource( - path="/addressBook", - messages="nls/AddressBookResource", - 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:'$R{servletParentURI}/source?classes=(org.apache.juneau.server.samples.addressbook.AddressBookResource,org.apache.juneau.samples.addressbook.Address,org.apache.juneau.samples.addressbook.AddressBook,org.apache.juneau.samples.addressbook.CreateAddress,org.apache.juneau.samples.addressbook.CreatePerson,org.apache.juneau.samples.addressbook.IAddressBook,org.apache.juneau.samples.addressbook.Person)'}"), - // Resolve all relative URIs so that they're relative to this servlet! - @Property(name=SERIALIZER_relativeUriBase, value="$R{servletURI}"), - }, - stylesheet="styles/devops.css", - encoders=GzipEncoder.class, - contact="{name:'John Smith',email:'[email protected]'}", - license="{name:'Apache 2.0',url:'http://www.apache.org/licenses/LICENSE-2.0.html'}", - version="2.0", - termsOfService="You're on your own.", - tags="[{name:'Java',description:'Java utility',externalDocs:{description:'Home page',url:'http://juneau.apache.org'}}]", - externalDocs="{description:'Home page',url:'http://juneau.apache.org'}" -) -public class AddressBookResource extends ResourceJena { - private static final long serialVersionUID = 1L; - - // The in-memory address book - private AddressBook addressBook; - - @Override /* Servlet */ - public void init() { - - try { - // Create the address book - addressBook = new AddressBook(java.net.URI.create("")); - - // Add some people to our address book by default - addressBook.createPerson( - new CreatePerson( - "Barack Obama", - toCalendar("Aug 4, 1961"), - new CreateAddress("1600 Pennsylvania Ave", "Washington", "DC", 20500, true), - new CreateAddress("5046 S Greenwood Ave", "Chicago", "IL", 60615, false) - ) - ); - addressBook.createPerson( - new CreatePerson( - "George Walker Bush", - toCalendar("Jul 6, 1946"), - new CreateAddress("43 Prairie Chapel Rd", "Crawford", "TX", 76638, true), - new CreateAddress("1600 Pennsylvania Ave", "Washington", "DC", 20500, false) - ) - ); - - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * [GET /] - * Get root page. - */ - @RestMethod(name="GET", path="/", - converters=Queryable.class - ) - public Link[] getRoot() throws Exception { - return new Link[] { - new Link("people", "people"), - new Link("addresses", "addresses") - }; - } - - /** - * [GET /people/*] - * Get all people in the address book. - * Traversable filtering enabled to allow nodes in returned POJO tree to be addressed. - * Introspectable filtering enabled to allow public methods on the returned object to be invoked. - */ - @RestMethod(name="GET", path="/people/*", - converters={Traversable.class,Queryable.class,Introspectable.class} - ) - public AddressBook getAllPeople() throws Exception { - return addressBook; - } - - /** - * [GET /people/{id}/*] - * Get a single person by ID. - * Traversable filtering enabled to allow nodes in returned POJO tree to be addressed. - * Introspectable filtering enabled to allow public methods on the returned object to be invoked. - */ - @RestMethod(name="GET", path="/people/{id}/*", - converters={Traversable.class,Queryable.class,Introspectable.class} - ) - public Person getPerson(@Path int id) throws Exception { - return findPerson(id); - } - - /** - * [GET /addresses/*] - * Get all addresses in the address book. - */ - @RestMethod(name="GET", path="/addresses/*", - converters={Traversable.class,Queryable.class} - ) - public List<Address> getAllAddresses() throws Exception { - return addressBook.getAddresses(); - } - - /** - * [GET /addresses/{id}/*] - * Get a single address by ID. - */ - @RestMethod(name="GET", path="/addresses/{id}/*", - converters={Traversable.class,Queryable.class} - ) - public Address getAddress(@Path int id) throws Exception { - return findAddress(id); - } - - /** - * [POST /people] - * Create a new Person bean. - */ - @RestMethod(name="POST", path="/people", - guards=AdminGuard.class - ) - public Redirect createPerson(@Body CreatePerson cp) throws Exception { - Person p = addressBook.createPerson(cp); - return new Redirect("people/{0}", p.id); - } - - /** - * [POST /people/{id}/addresses] - * Create a new Address bean. - */ - @RestMethod(name="POST", path="/people/{id}/addresses", - guards=AdminGuard.class - ) - public Redirect createAddress(@Path int id, @Body CreateAddress ca) throws Exception { - Person p = findPerson(id); - Address a = p.createAddress(ca); - return new Redirect("addresses/{0}", a.id); - } - - /** - * [DELETE /people/{id}] - * Delete a Person bean. - */ - @RestMethod(name="DELETE", path="/people/{id}", - guards=AdminGuard.class - ) - public String deletePerson(@Path int id) throws Exception { - addressBook.removePerson(id); - return "DELETE successful"; - } - - /** - * [DELETE /addresses/{id}] - * Delete an Address bean. - */ - @RestMethod(name="DELETE", path="/addresses/{id}", - guards=AdminGuard.class - ) - public String deleteAddress(@Path int addressId) throws Exception { - Person p = addressBook.findPersonWithAddress(addressId); - if (p == null) - throw new RestException(SC_NOT_FOUND, "Person not found"); - Address a = findAddress(addressId); - p.addresses.remove(a); - return "DELETE successful"; - } - - /** - * [PUT /people/{id}/*] - * Change property on Person bean. - */ - @RestMethod(name="PUT", path="/people/{id}/*", - guards=AdminGuard.class - ) - public String updatePerson(RestRequest req, @Path int id) throws Exception { - try { - Person p = findPerson(id); - String pathRemainder = req.getPathRemainder(); - PojoRest r = new PojoRest(p); - ClassMeta<?> cm = r.getClassMeta(pathRemainder); - Object in = req.getBody(cm); - r.put(pathRemainder, in); - return "PUT successful"; - } catch (Exception e) { - throw new RestException(SC_BAD_REQUEST, "PUT unsuccessful").initCause(e); - } - } - - /** - * [PUT /addresses/{id}/*] - * Change property on Address bean. - */ - @RestMethod(name="PUT", path="/addresses/{id}/*", - guards=AdminGuard.class - ) - public String updateAddress(RestRequest req, @Path int id) throws Exception { - try { - Address a = findAddress(id); - String pathInfo = req.getPathInfo(); - PojoRest r = new PojoRest(a); - ClassMeta<?> cm = r.getClassMeta(pathInfo); - Object in = req.getBody(cm); - r.put(pathInfo, in); - return "PUT successful"; - } catch (Exception e) { - throw new RestException(SC_BAD_REQUEST, "PUT unsuccessful").initCause(e); - } - } - - /** - * [INIT /] - * Reinitialize this resource. - */ - @RestMethod(name="INIT", path="/", - guards=AdminGuard.class - ) - public String doInit() throws Exception { - init(); - return "OK"; - } - - /** - * [GET /cognos] - * Get data in Cognos/XML format - */ - @RestMethod(name="GET", path="/cognos") - public DataSet getCognosData() throws Exception { - - // The Cognos metadata - Column[] items = { - new Column("name", "xs:String", 255), - new Column("age", "xs:int"), - new Column("numAddresses", "xs:int") - .addPojoSwap( - new PojoSwap<Person,Integer>() { - @Override /* PojoSwap */ - public Integer swap(BeanSession session, Person p) { - return p.addresses.size(); - } - } - ) - }; - - return new DataSet(items, addressBook, this.getBeanContext().createSession()); - } - - /** - * [OPTIONS /*] - * View resource options - */ - @Override /* RestServletJenaDefault */ - @RestMethod(name="OPTIONS", path="/*") - public Swagger getOptions(RestRequest req) { - return req.getSwagger(); - } - - /** Convenience method - Find a person by ID */ - private Person findPerson(int id) throws RestException { - Person p = addressBook.findPerson(id); - if (p == null) - throw new RestException(SC_NOT_FOUND, "Person not found"); - return p; - } - - /** Convenience method - Find an address by ID */ - private Address findAddress(int id) throws RestException { - Address a = addressBook.findAddress(id); - if (a == null) - throw new RestException(SC_NOT_FOUND, "Address not found"); - return a; - } -} -
http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/java/org/apache/juneau/server/samples/addressbook/ClientTest.java ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/java/org/apache/juneau/server/samples/addressbook/ClientTest.java b/juneau-samples/src/main/java/org/apache/juneau/server/samples/addressbook/ClientTest.java deleted file mode 100755 index 183afd2..0000000 --- a/juneau-samples/src/main/java/org/apache/juneau/server/samples/addressbook/ClientTest.java +++ /dev/null @@ -1,107 +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.samples.addressbook; - -import java.text.*; -import java.util.*; - -import org.apache.juneau.client.*; -import org.apache.juneau.json.*; -import org.apache.juneau.samples.addressbook.*; -import org.apache.juneau.xml.*; - -/** - * Sample client code for interacting with AddressBookResource - */ -public class ClientTest { - - public static void main(String[] args) { - - try { - System.out.println("Running client test..."); - - // Create a client to handle XML requests and responses. - RestClient client = new RestClient(JsonSerializer.DEFAULT, JsonParser.DEFAULT); - RestClient xmlClient = new RestClient(XmlSerializer.DEFAULT_NS, XmlParser.DEFAULT); - try { - String root = "http://localhost:10000/addressBook"; - - // Get the current contents of the address book - AddressBook ab = client.doGet(root + "/people").getResponse(AddressBook.class); - System.out.println("Number of entries = " + ab.getPeople().size()); - - // Same, but use XML as the protocol both ways - ab = xmlClient.doGet(root + "/people").getResponse(AddressBook.class); - System.out.println("Number of entries = " + ab.getPeople().size()); - - - // Delete the existing entries - for (Person p : ab.getPeople()) { - String r = client.doDelete(p.uri).getResponse(String.class); - System.out.println("Deleted person " + p.name + ", response = " + r); - } - - // Make sure they're gone - ab = client.doGet(root + "/people").getResponse(AddressBook.class); - System.out.println("Number of entries = " + ab.getPeople().size()); - - // Add 1st person again - CreatePerson cp = new CreatePerson( - "Barack Obama", - toCalendar("Aug 4, 1961"), - new CreateAddress("1600 Pennsylvania Ave", "Washington", "DC", 20500, true), - new CreateAddress("5046 S Greenwood Ave", "Chicago", "IL", 60615, false) - ); - Person p = client.doPost(root + "/people", cp).getResponse(Person.class); - System.out.println("Created person " + p.name + ", uri = " + p.uri); - - // Add 2nd person again, but add addresses separately - cp = new CreatePerson( - "George Walker Bush", - toCalendar("Jul 6, 1946") - ); - p = client.doPost(root + "/people", cp).getResponse(Person.class); - System.out.println("Created person " + p.name + ", uri = " + p.uri); - - // Add addresses to 2nd person - CreateAddress ca = new CreateAddress("43 Prairie Chapel Rd", "Crawford", "TX", 76638, true); - Address a = client.doPost(p.uri + "/addresses", ca).getResponse(Address.class); - System.out.println("Created address " + a.uri); - - ca = new CreateAddress("1600 Pennsylvania Ave", "Washington", "DC", 20500, false); - a = client.doPost(p.uri + "/addresses", ca).getResponse(Address.class); - System.out.println("Created address " + a.uri); - - // Find 1st person, and change name - Person[] pp = client.doGet(root + "/people?q=(name='Barack+Obama')").getResponse(Person[].class); - String r = client.doPut(pp[0].uri + "/name", "Barack Hussein Obama").getResponse(String.class); - System.out.println("Changed name, response = " + r); - p = client.doGet(pp[0].uri).getResponse(Person.class); - System.out.println("New name = " + p.name); - } finally { - client.closeQuietly(); - xmlClient.closeQuietly(); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } - - // Utility method - public static Calendar toCalendar(String birthDate) throws Exception { - Calendar c = new GregorianCalendar(); - c.setTime(DateFormat.getDateInstance(DateFormat.MEDIUM).parse(birthDate)); - return c; - } -} http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/CodeFormatterResource.html ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/CodeFormatterResource.html b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/CodeFormatterResource.html new file mode 100644 index 0000000..90441cf --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/CodeFormatterResource.html @@ -0,0 +1,68 @@ +<!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> + <style type='text/css'> + @import '$R{servletURI}/style.css'; + </style> + <script> + // Quick and dirty function to allow tabs in textarea. + function checkTab(e) { + if (e.keyCode == 9) { + var t = e.target; + var ss = t.selectionStart, se = t.selectionEnd; + t.value = t.value.slice(0,ss).concat('\t').concat(t.value.slice(ss,t.value.length)); + e.preventDefault(); + } + } + // Load results from IFrame into this document. + function loadResults(buff) { + var doc = buff.contentDocument || buff.contentWindow.document; + var buffBody = doc.getElementById('data'); + if (buffBody != null) { + document.getElementById('results').innerHTML = buffBody.innerHTML; + } + } + </script> +</head> +<body> + <h3 class='title'>Code Formatter</h3> + <div class='data'> + <form id='form' action='codeFormatter' method='POST' target='buff'> + <table> + <tr> + <th>Language: </th> + <td> + <select name='lang'> + <option value='java'>Java</option> + <option value='xml'>XML</option> + </select> + </td> + <td><button type='submit'>Submit</button><button type='reset'>Reset</button></td> + </tr> + <tr> + <td colspan='3'><textarea name='code' style='min-width:800px;min-height:400px;font-family:Courier;font-size:9pt;' onkeydown='checkTab(event)'></textarea></td> + </tr> + </table> + </form> + <div id='results' class='monospace'> + </div> + </div> + <iframe name='buff' style='display:none' onload="parent.loadResults(this)"></iframe> +</body> +</html> + http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/SqlQueryResource.html ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/SqlQueryResource.html b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/SqlQueryResource.html new file mode 100644 index 0000000..1119400 --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/SqlQueryResource.html @@ -0,0 +1,66 @@ +<!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> + <style type='text/css'> + @import '$R{servletURI}/style.css'; + </style> + <script> + // Quick and dirty function to allow tabs in textarea. + function checkTab(e) { + if (e.keyCode == 9) { + var t = e.target; + var ss = t.selectionStart, se = t.selectionEnd; + t.value = t.value.slice(0,ss).concat('\t').concat(t.value.slice(ss,t.value.length)); + e.preventDefault(); + } + } + // Load results from IFrame into this document. + function loadResults(b) { + var doc = b.contentDocument || b.contentWindow.document; + var data = doc.getElementById('data') || doc.getElementsByTagName('body')[0]; + document.getElementById('results').innerHTML = data.innerHTML; + } + </script> +</head> +<body> + <h3 class='title'>SQL Query API</h3> + <div class='data'> + <form action='sqlQuery' method='POST' target='buf'> + <table> + <tr> + <th>Position (1-10000):</th> + <td><input name='pos' type='number' value='1'></td> + <th>Limit (1-10000):</th> + <td><input name='limit' type='number' value='100'></td> + <td><button type='submit'>Submit</button><button type='reset'>Reset</button></td> + </tr> + <tr> + <td colspan="5"> + <textarea name='sql' style='width:100%;height:200px;font-family:Courier;font-size:9pt;' onkeydown='checkTab(event)'></textarea> + </td> + </tr> + </table> + </form> + <br> + <div id='results'> + </div> + </div> + <iframe name='buf' style='display:none' onload="parent.loadResults(this)"></iframe> +</body> +</html> + http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/TempDirUploadPage.html ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/TempDirUploadPage.html b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/TempDirUploadPage.html new file mode 100644 index 0000000..947f8bf --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/TempDirUploadPage.html @@ -0,0 +1,34 @@ +<!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'> + @import '$R{servletURI}/style.css'; + </style> +</head> +<body> + <h3 class='title'>$R{servletTitle}</h3> + <h5 class="description">$R{servletDescription}</h5> + <div class='data'> + <form id='form' action='$R{servletURI}/upload' method='POST' target='buff' enctype="multipart/form-data"> + <input name="contents" type="file"><button type="submit">Submit</button> + </form> + </div> +</body> +</html> + http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/UrlEncodedForm.html ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/UrlEncodedForm.html b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/UrlEncodedForm.html new file mode 100644 index 0000000..0c2d039 --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/UrlEncodedForm.html @@ -0,0 +1,62 @@ +<!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'> + @import '$R{servletURI}/style.css'; + </style> + <script type="text/javascript"> + // Load results from IFrame into this document. + function loadResults(buff) { + var doc = buff.contentDocument || buff.contentWindow.document; + var buffBody = doc.getElementById('data'); + document.getElementById('results').innerHTML = buffBody.innerHTML; + } + </script> +</head> +<body> + <h3 class='title'>$R{servletTitle}</h3> + <h5 class="description">$R{servletDescription}</h5> + <div class='data'> + <form id='form' action='$R{servletURI}' method='POST' target='buff'> + <table> + <tr> + <th>$L{aString}</th> + <td><input name="aString" type="text"></td> + </tr> + <tr> + <th>$L{aNumber}</th> + <td><input name="aNumber" type="number"></td> + </tr> + <tr> + <th>$L{aDate}</th> + <td><input name="aDate" type="datetime"> (ISO8601, e.g. "<code>2001-07-04T15:30:45Z</code>")</td> + </tr> + <tr> + <td colspan='2' align='right'><button type="submit">$L{submit}</button></td> + </tr> + </table> + </form> + <br> + <div id='results'> + </div> + </div> + <iframe name='buff' style='display:none' onload="parent.loadResults(this)"></iframe> +</body> +</html> + http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/addressbook/nls/AddressBookResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/addressbook/nls/AddressBookResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/addressbook/nls/AddressBookResource.properties new file mode 100644 index 0000000..61aec3e --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/addressbook/nls/AddressBookResource.properties @@ -0,0 +1,89 @@ +# *************************************************************************************************************************** +# * 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. * +# *************************************************************************************************************************** + +title = AddressBook sample resource +description = Proof-of-concept resource that shows off the capabilities of working with POJO resources + +getRoot.summary = Get root page +getRoot.description = Jumping off page for top-level Person and Address beans. + +doInit.summary = Reinitialize this resource +doInit.description = Resets the address book to the original contents. +doInit.res.200.description = Returns the string "OK" + +getAllPeople.summary = Get all people in the address book +getAllPeople.res.200.description = Returns a serialized List<Person> +getAllPeople.res.200.examples = {'text/json':"[\n\t{\n\t\turi:'http://hostname/addressBook/person/1',\n\t\taddressBookUri:'http://localhost/addressBook',\n\t\tid:1,\n\t\tname:'John Smith',\n\t\tbirthDate:'Jan 1, 2000',\n\t\taddresses:[\n\t\t\t{\n\t\t\t\turi:'http://localhost/addressBook/addresses/1',\n\t\t\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\t\t\tid:1,\n\t\t\t\tstreet:'101 Main St',\n\t\t\t\tcity:'Anywhere',\n\t\t\t\tstate:'NY',\n\t\t\t\tzip:12345,\n\t\t\t\tisCurrent:true\n\t\t\t}\n\t\t]\n\t}\n]"} + +getPerson.summary = Get a single person by ID +getPerson.req.path.id.description = Person ID +getPerson.req.path.id.type = integer +getPerson.res.200.description = Returns a serialized Person bean +getPerson.res.200.examples = {'text/json':"{\n\turi:'http://hostname/addressBook/person/1',\n\taddressBookUri:'http://localhost/addressBook',\n\tid:1,\n\tname:'John Smith',\n\tbirthDate:'Jan 1, 2000',\n\taddresses:[\n\t\t{\n\t\t\turi:'http://localhost/addressBook/addresses/1',\n\t\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\t\tid:1,\n\t\t\tstreet:'101 Main St',\n\t\t\tcity:'Anywhere',\n\t\t\tstate:'NY',\n\t\t\tzip:12345,\n\t\t\tisCurrent:true\n\t\t}\n\t]\n\}"} +getPerson.res.404.description = Person ID not found + +getAllAddresses.summary = Get all addresses in the address book +getAllAddresses.res.200.description = Returns a serialized List<Address> +getAllAddresses.res.200.examples = {'text/json':"[\n\t{\n\t\turi:'http://localhost/addressBook/addresses/1',\n\t\tpersonUri:'http://localhost/addressBook/people/1',\n\t\tid:1,\n\t\tstreet:'101 Main St',\n\t\tcity:'Anywhere',\n\t\tstate:'NY',\n\t\tzip:12345,\n\t\tisCurrent:true\n\t}\n]"} + +getAddress.summary = Get a single address by ID +getAddress.req.path.id.description = Address ID +getAddress.req.path.id.type = integer +getAddress.res.200.description = Returns a serialized Address bean +getAddress.res.200.examples = {'text/json':"{\n\turi:'http://localhost/addressBook/addresses/1',\n\tpersonUri:'http://localhost/addressBook/people/1',\n\tid:1,\n\tstreet:'101 Main St',\n\tcity:'Anywhere',\n\tstate:'NY',\n\tzip:12345,\n\tisCurrent:true\n}"} +getAddress.res.404.description = Address ID not found + +createPerson.summary = Create a new Person bean +createPerson.req.body.description = Serialized CreatePerson bean +createPerson.req.body.schema = {example:"{\n\tname:'John Smith',\n\tbirthDate:'Jan 1, 2000',\n\taddresses:[\n\t\t{\n\t\t\tstreet:'101 Main St',\n\t\t\tcity:'Anywhere',\n\t\t\tstate:'NY',\n\t\t\tzip:12345,\n\t\t\tisCurrent:true\n\t\t}\n\t]\n\}"} +createPerson.res.307.header.Location.description = URL of new person + +createAddress.summary = Create a new Address bean +createAddress.req.path.id.description = Person ID +createAddress.req.path.id.type = integer +createAddress.req.body.schema = {example:"{\n\tstreet:'101 Main St',\n\tcity:'Anywhere',\n\tstate:'NY',\n\tzip:12345,\n\tisCurrent:true\n}"} +createAddress.res.307.header.Location.description = URL of new address + +deletePerson.summary = Delete a Person bean +deletePerson.req.path.id.description = Person ID +deletePerson.req.path.id.type = integer +deletePerson.res.200.description = Returns the string "DELETE successful" +deletePerson.res.404.description = Person ID not found + +deleteAddress.summary = Delete an Address bean +deleteAddress.req.path.id.description = Address ID +deleteAddress.res.200.description = Returns the string "DELETE successful" +deleteAddress.res.404.description = Address ID not found + +updatePerson.summary = Change property on Person bean +updatePerson.req.path.id.description = Person ID +updatePerson.req.path.id.type = integer +updatePerson.req.body.description = Any object matching the field +updatePerson.res.200.description = Returns the string "PUT successful" +updatePerson.res.400.description = Invalid object type used +updatePerson.res.404.description = Person ID not found + +updateAddress.summary = Change property on Address bean +updateAddress.req.path.id.description = Address ID +updateAddress.req.path.id.type = integer +updateAddress.req.body.description = Any object matching the field +updateAddress.res.200.description = Returns the string "PUT successful" +updateAddress.res.400.description = Invalid object type used +updateAddress.res.404.description = Address ID not found + +getOptions.summary = View resource options + +getCognosData.summary = Get data in Cognos/XML format +getCognosData.res.200.description = Returns a serialized DataSet + +otherNotes = GZip support enabled. Public methods can be invoked by using the &Method URL parameter. 'text/cognos+xml' support available under root resource only \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/averycutecat.jpg ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/averycutecat.jpg b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/averycutecat.jpg new file mode 100644 index 0000000..9760674 Binary files /dev/null and b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/averycutecat.jpg differ http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/htdocs/code-highlighting.css ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/htdocs/code-highlighting.css b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/htdocs/code-highlighting.css new file mode 100644 index 0000000..a016a6c --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/htdocs/code-highlighting.css @@ -0,0 +1,136 @@ +/*************************************************************************************************************************** + * 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. * + ***************************************************************************************************************************/ +code, +tt, +pre, +dt code { + font-size: 9pt; +} + +/*--- Bordered code ---*/ +p.bcode { + font-size: 9pt; + white-space: pre; + border: 1px solid black; + margin: 10px 20px; + padding: 10px; + border-radius: 10px; + overflow: hidden; + font-family: monospace; + background-color: #f8f8f8; + border-color: #cccccc; + -moz-tab-size: 3; + tab-size: 3; + -o-tab-size: 3; +} + +.fixedWidth { + max-width: 800px; +} + +/* Override padding bottom in javadoc comments. */ +.blockList p.bcode { + padding-bottom: 0px !important; +} + +/*--- Unbordered code ---*/ +p.code { + font-size: 9pt; + white-space: pre; + font-family: monospace; + padding-bottom: 15px; + margin: -15px; +} + +td.code { + font-size: 9pt; + white-space: pre; + font-family: monospace; +} + +table.code { + font-size: 9pt; + white-space: pre; + font-family: monospace; +} + +/*--- Java code effects ---*/ +jc,jd,jt,jk,js,jf,jsf,jsm,ja { + font-size: 9pt; + white-space: pre; + font-family: monospace; +} +/* Comment */ +jc { + color: green; +} +/* Javadoc comment */ +jd { + color: #3f5fbf; +} +/* Javadoc tag */ +jt { + color: #7f9fbf; + font-weight: bold; +} +/* Primitive */ +jk { + color: #7f0055; + font-weight: bold; +} +/* String */ +js { + color: blue; +} +/* Field */ +jf { + color: blue; +} +/* Static field */ +jsf { + color: blue; + font-style: italic; +} +/* Static method */ +jsm { + font-style: italic; +} +/* Annotation */ +ja { + color: grey; +} + +/*--- XML code effects ---*/ +xt,xa,xc,xs { + font-size: 9pt; + white-space: pre; + font-family: monospace; +} + +xt { + color: DarkCyan; +} + +xa { + color: purple; +} + +xc { + color: mediumblue; +} + +xs { + color: blue; + font-style: italic; +} + http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/AtomFeedResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/AtomFeedResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/AtomFeedResource.properties new file mode 100644 index 0000000..7ff4a44 --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/AtomFeedResource.properties @@ -0,0 +1,21 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/CodeFormatterResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/CodeFormatterResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/CodeFormatterResource.properties new file mode 100644 index 0000000..ac2f236 --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/CodeFormatterResource.properties @@ -0,0 +1,18 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/HelloWorldResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/HelloWorldResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/HelloWorldResource.properties new file mode 100644 index 0000000..7c8f03d --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/HelloWorldResource.properties @@ -0,0 +1,19 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/JsonSchemaResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/JsonSchemaResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/JsonSchemaResource.properties new file mode 100644 index 0000000..1a486a9 --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/JsonSchemaResource.properties @@ -0,0 +1,20 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/MethodExampleResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/MethodExampleResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/MethodExampleResource.properties new file mode 100644 index 0000000..be0bcf1 --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/MethodExampleResource.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. * +# *************************************************************************************************************************** + +#-------------------------------------------------------------------------------- +# MethodExampleResource labels +#-------------------------------------------------------------------------------- +title = A simple REST method example resource +doGetExample.summary = Sample GET method +doGetExample1.summary = Sample GET using annotations +doGetExample1.req.path.a1.description = Sample variable +doGetExample1.req.path.a2.description = Sample variable +doGetExample1.req.path.a3.description = Sample variable +doGetExample1.req.query.p1.description = Sample parameter +doGetExample1.req.query.p2.description = Sample parameter +doGetExample1.req.query.p3.description = Sample parameter +doGetExample1.req.header.Accept-Language.description = Sample header +doGetExample1.req.header.DNT.description = Sample header +doGetExample2.summary = Sample GET using Java APIs +doGetExample2.req.path.a1.description = Sample variable +doGetExample2.req.path.a2.description = Sample variable +doGetExample2.req.path.a3.description = Sample variable +doGetExample2.req.query.p1.description = Sample parameter +doGetExample2.req.query.p2.description = Sample parameter +doGetExample2.req.query.p3.description = Sample parameter +doGetExample2.req.header.Accept-Language.description = Sample header +doGetExample2.req.header.DNT.description = Sample header +getOptions.summary = Get these options http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/PhotosResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/PhotosResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/PhotosResource.properties new file mode 100644 index 0000000..93f7f7d --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/PhotosResource.properties @@ -0,0 +1,24 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RequestEchoResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RequestEchoResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RequestEchoResource.properties new file mode 100644 index 0000000..db7641c --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RequestEchoResource.properties @@ -0,0 +1,19 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RootResources.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RootResources.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RootResources.properties new file mode 100644 index 0000000..301057d --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/RootResources.properties @@ -0,0 +1,18 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SampleRemoteableServlet.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SampleRemoteableServlet.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SampleRemoteableServlet.properties new file mode 100644 index 0000000..48fd5ce --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SampleRemoteableServlet.properties @@ -0,0 +1,17 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SourceResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SourceResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SourceResource.properties new file mode 100644 index 0000000..363f00a --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SourceResource.properties @@ -0,0 +1,19 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SqlQueryResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SqlQueryResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SqlQueryResource.properties new file mode 100644 index 0000000..527ca93 --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/SqlQueryResource.properties @@ -0,0 +1,19 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TempDirResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TempDirResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TempDirResource.properties new file mode 100644 index 0000000..94c009e --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TempDirResource.properties @@ -0,0 +1,18 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TumblrParserResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TumblrParserResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TumblrParserResource.properties new file mode 100644 index 0000000..28a3e72 --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/TumblrParserResource.properties @@ -0,0 +1,19 @@ +# *************************************************************************************************************************** +# * 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/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/UrlEncodedFormResource.properties ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/UrlEncodedFormResource.properties b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/UrlEncodedFormResource.properties new file mode 100644 index 0000000..c7015c3 --- /dev/null +++ b/juneau-samples/src/main/resources/org/apache/juneau/rest/samples/nls/UrlEncodedFormResource.properties @@ -0,0 +1,22 @@ +# *************************************************************************************************************************** +# * 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. * +# *************************************************************************************************************************** + +#-------------------------------------------------------------------------------- +# 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: +submit = submit \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/server/samples/CodeFormatterResource.html ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/server/samples/CodeFormatterResource.html b/juneau-samples/src/main/resources/org/apache/juneau/server/samples/CodeFormatterResource.html deleted file mode 100755 index 90441cf..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/server/samples/CodeFormatterResource.html +++ /dev/null @@ -1,68 +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> - <style type='text/css'> - @import '$R{servletURI}/style.css'; - </style> - <script> - // Quick and dirty function to allow tabs in textarea. - function checkTab(e) { - if (e.keyCode == 9) { - var t = e.target; - var ss = t.selectionStart, se = t.selectionEnd; - t.value = t.value.slice(0,ss).concat('\t').concat(t.value.slice(ss,t.value.length)); - e.preventDefault(); - } - } - // Load results from IFrame into this document. - function loadResults(buff) { - var doc = buff.contentDocument || buff.contentWindow.document; - var buffBody = doc.getElementById('data'); - if (buffBody != null) { - document.getElementById('results').innerHTML = buffBody.innerHTML; - } - } - </script> -</head> -<body> - <h3 class='title'>Code Formatter</h3> - <div class='data'> - <form id='form' action='codeFormatter' method='POST' target='buff'> - <table> - <tr> - <th>Language: </th> - <td> - <select name='lang'> - <option value='java'>Java</option> - <option value='xml'>XML</option> - </select> - </td> - <td><button type='submit'>Submit</button><button type='reset'>Reset</button></td> - </tr> - <tr> - <td colspan='3'><textarea name='code' style='min-width:800px;min-height:400px;font-family:Courier;font-size:9pt;' onkeydown='checkTab(event)'></textarea></td> - </tr> - </table> - </form> - <div id='results' class='monospace'> - </div> - </div> - <iframe name='buff' style='display:none' onload="parent.loadResults(this)"></iframe> -</body> -</html> - http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/server/samples/SqlQueryResource.html ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/server/samples/SqlQueryResource.html b/juneau-samples/src/main/resources/org/apache/juneau/server/samples/SqlQueryResource.html deleted file mode 100755 index 1119400..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/server/samples/SqlQueryResource.html +++ /dev/null @@ -1,66 +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> - <style type='text/css'> - @import '$R{servletURI}/style.css'; - </style> - <script> - // Quick and dirty function to allow tabs in textarea. - function checkTab(e) { - if (e.keyCode == 9) { - var t = e.target; - var ss = t.selectionStart, se = t.selectionEnd; - t.value = t.value.slice(0,ss).concat('\t').concat(t.value.slice(ss,t.value.length)); - e.preventDefault(); - } - } - // Load results from IFrame into this document. - function loadResults(b) { - var doc = b.contentDocument || b.contentWindow.document; - var data = doc.getElementById('data') || doc.getElementsByTagName('body')[0]; - document.getElementById('results').innerHTML = data.innerHTML; - } - </script> -</head> -<body> - <h3 class='title'>SQL Query API</h3> - <div class='data'> - <form action='sqlQuery' method='POST' target='buf'> - <table> - <tr> - <th>Position (1-10000):</th> - <td><input name='pos' type='number' value='1'></td> - <th>Limit (1-10000):</th> - <td><input name='limit' type='number' value='100'></td> - <td><button type='submit'>Submit</button><button type='reset'>Reset</button></td> - </tr> - <tr> - <td colspan="5"> - <textarea name='sql' style='width:100%;height:200px;font-family:Courier;font-size:9pt;' onkeydown='checkTab(event)'></textarea> - </td> - </tr> - </table> - </form> - <br> - <div id='results'> - </div> - </div> - <iframe name='buf' style='display:none' onload="parent.loadResults(this)"></iframe> -</body> -</html> - http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/91a388d0/juneau-samples/src/main/resources/org/apache/juneau/server/samples/TempDirUploadPage.html ---------------------------------------------------------------------- diff --git a/juneau-samples/src/main/resources/org/apache/juneau/server/samples/TempDirUploadPage.html b/juneau-samples/src/main/resources/org/apache/juneau/server/samples/TempDirUploadPage.html deleted file mode 100755 index 947f8bf..0000000 --- a/juneau-samples/src/main/resources/org/apache/juneau/server/samples/TempDirUploadPage.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'> - @import '$R{servletURI}/style.css'; - </style> -</head> -<body> - <h3 class='title'>$R{servletTitle}</h3> - <h5 class="description">$R{servletDescription}</h5> - <div class='data'> - <form id='form' action='$R{servletURI}/upload' method='POST' target='buff' enctype="multipart/form-data"> - <input name="contents" type="file"><button type="submit">Submit</button> - </form> - </div> -</body> -</html> -
