From 04aaff205a6198ef0043c50e3991bf6d41d3e8c0 Mon Sep 17 00:00:00 2001 From: Spring Operator Date: Wed, 20 Mar 2019 16:36:30 -0500 Subject: [PATCH] URL Cleanup This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener). # HTTP URLs that Could Not Be Fixed These URLs were unable to be fixed. Please review them to see if they can be manually resolved. * [ ] http://longdomainname.com/api (404) with 3 occurrences could not be migrated: ([https](https://longdomainname.com/api) result SSLException). # Fixed URLs ## Fixed But Review Recommended These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended. * [ ] http://api.myservice.com/v1 (UnknownHostException) with 3 occurrences migrated to: https://api.myservice.com/v1 ([https](https://api.myservice.com/v1) result UnknownHostException). * [ ] http://mylongdomain.com/api (UnknownHostException) with 2 occurrences migrated to: https://mylongdomain.com/api ([https](https://mylongdomain.com/api) result UnknownHostException). * [ ] http://xml.apache.org/xslt (404) with 1 occurrences migrated to: https://xml.apache.org/xslt ([https](https://xml.apache.org/xslt) result 404). ## Fixed Success These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended. * [ ] http://github.com/springsource/spring-shell with 2 occurrences migrated to: https://github.com/springsource/spring-shell ([https](https://github.com/springsource/spring-shell) result 200). # Ignored These URLs were intentionally ignored. * http://localhost:8080 with 5 occurrences * http://localhost:8080/address with 1 occurrences * http://localhost:8080/family with 1 occurrences * http://localhost:8080/person with 19 occurrences * http://localhost:8080/person/ with 1 occurrences * http://localhost:8080/person/1 with 3 occurrences * http://localhost:8080/person/1/addresses with 1 occurrences * http://localhost:8080/person/1/profiles with 1 occurrences * http://localhost:8080/person/2 with 1 occurrences * http://localhost:8080/person/8 with 3 occurrences * http://localhost:8080/person/8/addresses with 1 occurrences * http://localhost:8080/person/8/profiles with 1 occurrences * http://localhost:8080/person/search with 1 occurrences * http://localhost:8080/profile with 1 occurrences * http://localhost:8080:/ with 1 occurrences --- README.md | 14 +++++++------- .../data/rest/shell/formatter/XmlFormatter.java | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 503e336..a85c83d 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Download the binary .tar.gz package: # Getting Started -This project is a command-line shell that aims to make writing REST-based applications easier. It is based on [spring-shell](http://github.com/springsource/spring-shell) and integrated with [Spring HATEOAS](https://github.com/springsource/spring-hateoas) in such a way that REST resources that output JSON compliant with Spring HATEOAS can be discovered by the shell and interactions with the REST resources become much easier than by manipulating the URLs in bash using a tool like `curl`. +This project is a command-line shell that aims to make writing REST-based applications easier. It is based on [spring-shell](https://github.com/springsource/spring-shell) and integrated with [Spring HATEOAS](https://github.com/springsource/spring-hateoas) in such a way that REST resources that output JSON compliant with Spring HATEOAS can be discovered by the shell and interactions with the REST resources become much easier than by manipulating the URLs in bash using a tool like `curl`. The rest-shell provides a number of useful commands for discovering and interacting with REST resources. For example `discover` will discover what resources are available and print out an easily-readable table of rels and URIs that relate to those resources. Once these resources have been discovered, the `rel` of those URIs can be used in place of the URI itself in most operations, thus cutting down on the amount of typing needed to issue HTTP requests to your REST resources. @@ -132,7 +132,7 @@ It's not always desirable to output the results of an HTTP request to the screen ### Sending complex JSON -Because the `rest-shell` uses the [spring-shell](http://github.com/springsource/spring-shell) underneath, there are limitations on the format of the JSON data you can enter directly into the command line. If your JSON is too complex for the simplistic limitations of the shell `--data` parameter, you can simply load the JSON from a file or from all the files in a directory. +Because the `rest-shell` uses the [spring-shell](https://github.com/springsource/spring-shell) underneath, there are limitations on the format of the JSON data you can enter directly into the command line. If your JSON is too complex for the simplistic limitations of the shell `--data` parameter, you can simply load the JSON from a file or from all the files in a directory. When doing a `post` or `put`, you can optionally pass the `--from` parameter. The value of this parameter should either be a file or a directory. If the value is a directory, the shell will read each file that ends with `.json` and make a POST or PUT with the contents of that file. If the parameter is a file, then the `rest-shell` will simpy load that file and POST/PUT that data in that individual file. @@ -177,25 +177,25 @@ The variables are accessible from SpEL expressions which are valid in a number o Since the rest-shell is aware of environment variables and system properties, you can incorporate external parameters into your interaction with the shell. For example, to externally define a baseUri, you could set a system property before invoking the shell. The shell will incorporate anything defined in the `JAVA_OPTS` environment variable, so you could parameterize your interaction with a REST service. - JAVA_OPTS="-DbaseUri=http://mylongdomain.com/api" rest-shell + JAVA_OPTS="-DbaseUri=https://mylongdomain.com/api" rest-shell http://localhost:8080:> discover #{env.baseUri} rel href ================================================================= ... resources for this URL - http://mylongdomain.com/api:> + https://mylongdomain.com/api:> ### Per-user shell initialization The rest-shell supports a "dotrc" type of initialization by reading in all files found in the `$HOME/.rest-shell/` directory and assuming they have shell commands in them. The rest-shell will execute these commands on startup. This makes it easy to set variables for commonly-used URIs or possibly set a `baseUri`. - echo "var set --name svcuri --value http://api.myservice.com/v1" > ~/.rest-shell/00-vars + echo "var set --name svcuri --value https://api.myservice.com/v1" > ~/.rest-shell/00-vars echo "discover #{svcuri}" > ~/.rest-shell/01-baseUri > rest-shell INFO: No resources found... - INFO: Base URI set to 'http://api.myservice.com/v1' + INFO: Base URI set to 'https://api.myservice.com/v1' ___ ___ __ _____ __ _ _ _ _ __ | _ \ __/' _/_ _/' _/| || | / / | \ \ @@ -204,7 +204,7 @@ The rest-shell supports a "dotrc" type of initialization by reading in all files 1.2.0.RELEASE Welcome to the REST shell. For assistance hit TAB or type "help". - http://api.myservice.com/v1:> + https://api.myservice.com/v1:> ### SSL Certificate Validation diff --git a/src/main/java/org/springframework/data/rest/shell/formatter/XmlFormatter.java b/src/main/java/org/springframework/data/rest/shell/formatter/XmlFormatter.java index e373376..c1186c9 100755 --- a/src/main/java/org/springframework/data/rest/shell/formatter/XmlFormatter.java +++ b/src/main/java/org/springframework/data/rest/shell/formatter/XmlFormatter.java @@ -28,7 +28,7 @@ public String format(String nonFormattedString) { Transformer serializer = SAXTransformerFactory.newInstance().newTransformer(); serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); serializer.setOutputProperty(OutputKeys.INDENT, "yes"); - serializer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); + serializer.setOutputProperty("{https://xml.apache.org/xslt}indent-amount", "2"); Source xmlSource = new SAXSource(new InputSource(new ByteArrayInputStream(nonFormattedString.getBytes()))); StreamResult res = new StreamResult(new ByteArrayOutputStream());