spring-attic / rest-shell Goto Github PK
View Code? Open in Web Editor NEWCommand-line shell for interacting with Spring HATEOAS-compliant REST resources
License: Apache License 2.0
Command-line shell for interacting with Spring HATEOAS-compliant REST resources
License: Apache License 2.0
I hope this is something that I am just doing wrong. I have tried setting the baseUrl several differant ways but can never get it to connect properly. All I get is:
Command failed org.springframework.web.client.ResourceAccessException: I/O error: Connection refused; nested exception is java.net.ConnectException: Connection refused
I set the auth basice user and password but it still doesnt seem to work. I know that the username and password is correct as it works with my python scripts.
Am I missing something?
OS - 10.10.3
JDK 1.8.0_45
Installed via Brew
Sorry first this is not an actual problem, I am interested to know are there any guideline on the Url formats being used in this project, especially on the singular vs plural form of nouns
e.g.
Why http://localhost:8080/person/1
instead of http://localhost:8080/people/1
Why http://localhost:8080/person/8/addresses
but not http://localhost:8080/person/8/address
if you intended to use singular
Thanks.
Shouldn't this dependency be public without special authentication?
Could not resolve velocity-tools:velocity-tools-view:1.4.
Required by:
org.springframework:spring-webmvc:3.2.6.BUILD-SNAPSHOT
Could not GET 'http://repo.springsource.org/libs-release/velocity-tools/velocity-tools-view/1.4/velocity-tools-view-1.4.pom'.
repo.springsource.org
jerry
Currently, executing the delete
command requires the --rel
argument to be specified. This means that you cannot do the following to delete a resource and verify that it is deleted.
follow foo
delete
get
The delete
command should be allowed to run from any URI without the --rel
argument specified and should simply execute an HTTP DELETE
on the current URI. The --rel
behavior should be preserved as-is.
Just for convenience it would be cool if one could simply type history
instead of history list
. If you do plain history
you get a Command 'history' not found (for assistance press TAB)
which is not exactly the case (you're just missing a parameter.
At commit 6fbcda4, it would appear that the files in ~/.rest-shell/
are being read a bit too early.
[bhale-desktop (no branch)]: echo "ssl validate --enabled false" > ~/.rest-shell/vas-setup
[bhale-desktop (no branch)]: rest-shell
Nov 06, 2012 5:04:30 PM org.springframework.shell.core.SimpleParser commandNotFound
WARNING: Command 'ssl validate --enabled false' not found (for assistance press TAB)
Nov 06, 2012 5:04:30 PM org.springframework.shell.core.SimpleParser commandNotFound
WARNING: Command 'ssl validate --enabled false' not found (for assistance press TAB)
___ ___ __ _____ __ _ _ _ _ __
| _ \ __/' _/_ _/' _/| || | / / | \ \
| v / _|`._`. | | `._`.| >< | / / / > >
|_|_\___|___/ |_| |___/|_||_| |_/_/ /_/
1.1.5.BUILD-SNAPSHOT
Welcome to the REST shell. For assistance hit TAB or type "help".
http://localhost:8080:>
Currently, if the server requires basic authentication credentials, it is up to the user to work out the proper hash and add it as a header to all requests. Calculating this hash is a pain.
Create a way (probably a command) for the user to specify a simple username and password and have the proper header added to all subsequent requests.
A post to issue #4 after it was closed noticed that there are Java 7 APIs (rather than just language constructors) still being used.
Something like Animal Sniffer should be integrated into the build to ensure that only Java 6 APIs are used
Last login: Tue Dec 3 07:59:29 on ttys000
jscanlon ~$ brew install rest-shell
==> Downloading https://github.com/downloads/SpringSource/rest-shell/rest-shell-
curl: (22) The requested URL returned error: 404 Not Found
Error: Download failed: https://github.com/downloads/SpringSource/rest-shell/rest-shell-1.2.1.RELEASE.tar.gz
jscanlon ~$
I am able to get all resources by id, but when I try to use search, I got HTTP 404 Not Found error.
Here is the command based on your example:
http://localhost:8080/spring-data-rest-webmvc/people:> get search/name?name=John+Doe
GET http://localhost:8080/spring-data-rest-webmvc/people/search/name%3Fname=John+Doe
< 404 NOT_FOUND
< Server: Apache-Coyote/1.1
< Content-Type: text/html
< Content-Length: 0
< Date: Wed, 17 Oct 2012 04:26:00 GMT
<
Am I doing something wrong?
I got response fine when accessing through web browser:
http://localhost:8080/spring-data-rest-webmvc/people/search/name?name=John+Doe
Currently, REST Shell requires Java 7 in order to compile and run, however, Java 6 is still very widely used by developers. It appears that other than using the diamond operator and String
s in switch
statements, there is no other use of Java 7 features, and not having those features shouldn't significantly affect the code.
Please update the source code to be Java 6 compatible.
Making installation as easy as brew install rest-shell
would be great. Has this been considered?
When I execute "rest-shell" the app (or something) launches.. but comes up as "Spring Shell".
No idea what I may have missed.
It seems rest-shell does not support follow for spring-data-rest-2.0.1
http://localhost:8080:> discover
rel href
===========================================================
messages http://localhost:8080/messages{?page,size,sort}
http://localhost:8080:> follow messages
Command failed java.lang.IllegalArgumentException: Illegal character in path at index 30: http://localhost:8080/messages{?page,size,sort}
http://localhost:8080:>
Currently, if connecting to an HTTPS server, SSL certificate validation is always performed. Configuration of the truststore, especially if you are connecting to a automatically generated, and often changing SSL certificate is a huge pain.
Create a way (configuration or command) for users to disable SSL certificate validation so that they can connect to an HTTPS server without configuring a trust store.
Several features in Rest-shell doesn't work when Spring HATEOAS is configured to use the HAL media type
@EnableHypermediaSupport(type = HypermediaType.HAL)
public class AppConfig() {...}
Do you plan to add HAL support to rest-shell?
Features not working : discover, list
I downloaded the latest code and ran the gradle build command on my Windows laptop. When I navigate to the build/install/rest-shell-1.2.2.RELEASE/bin directory and execute the rest-shell.bat script it starts up a 'Spring Shell' rather than a 'REST Shell'. Did I do something wrong or will this not work on Windows?
Thanks in advance for any assistance.
Can we provide pluggable formatter and provide out of the box formatter such as xml, json to parse and display readable format to the user.
# without formatter
http://host:port > get persons
{[person {..}, person {..} ] }
# with formatter
http://host:port > set formatter json
http://host:port > get persons
{
[
person {..},
person {..}
]
}
Does rest-shell support a backslash \
for continuing typing on the next line?
If it doesn't, how can I achieve that?
Spring projects, and especially those with org.springframework
package structures should be housed under the SpringSource organization.
This project should be moved to the SpringSource organization.
once I run rest-shell, I enter a command, any command, for example help, and it just hangs there indefinitely. When I finally hit Ctl+C it prints the help menu and then ends. This is the same for all commands. Im running a Windows 7 machine with cygwin latest.
Let me know what other information you need.
Since mvc 3.2 supports PATCH, it would be nice to be able to submit a patch request just like a put/post/etc... Basically a copy of put, but using PATCH method.
Major change is modifying code to use HttpComponentsClientHttpRequestFactory instead of SimpleClientHttpRequestFactory
DELETE
can return a 202
with a Location
header. The --follow
option should exist on the DELETE
command to handle this.
Currently the --follow
flag's behavior assumes that the Location returned is relative (if it is not qualified with http://
). In other words, a POST
to http://localhost:8080/foo
that returns Location: /foo/1
will result in the shell pointing at http://localhost:8080/foo/foo/1
.
The --follow
implementation should inspect whether the value of Location
is relative or absolute and update the URI appropriately in both cases.
Note that by spec, this value should never be interpreted as a relative URL. However, Wikipedia seems to indicate that most browsers do so.
I created a fresh clone and run ./gradlew installApp which failed. Run again with --debug and it seems like a bad dependency:
16:22:57.995 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.api.internal.artifacts.ivyservice.ModuleVersionNotFoundException: Could not find group:org.springframework.shell, module:spring-shell, version:1.0.1.BUILD-SNAPSHOT.
Currently, when running put --data "{}"
, the shell returns Command failed java.lang.NullPointerException
. Looking into .rest-shell.log
, nothing is listed. Looking into spring-shell.log
the only thing that shows up is // [failed] put --data "{}"
.
Sorry I can't be more help, but let me know if you'd like me to do any additional troubleshooting for you.
When I start latest (1.2.1, from 2012) rest-shell and enter commands:
baseUri http://localhost:9091/api
headers set --name Accept --value application/hal+json
than list
command will end with error:
Command failed org.springframework.web.client.HttpServerErrorException: 500 null
Server side (spring boot with current versions of all things) will log:
2020-02-13 14:32:21.810 DEBUG 2421 --- [nio-9091-exec-2] o.a.c.authenticator.AuthenticatorBase : Security checking request GET /api//
2020-02-13 14:32:21.810 DEBUG 2421 --- [nio-9091-exec-2] org.apache.catalina.realm.RealmBase : No applicable constraints defined
2020-02-13 14:32:21.810 DEBUG 2421 --- [nio-9091-exec-2] o.a.c.authenticator.AuthenticatorBase : Not subject to any constraint
2020-02-13 14:32:21.811 ERROR 2421 --- [nio-9091-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL contained a potentially malicious String "//"
at org.springframework.security.web.firewall.StrictHttpFirewall.rejectedBlacklistedUrls(StrictHttpFirewall.java:369) ~[spring-security-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
at org.springframework.security.web.firewall.StrictHttpFirewall.getFirewalledRequest(StrictHttpFirewall.java:336) ~[spring-security-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:194) ~[spring-security-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) ~[spring-security-web-5.2.1.RELEASE.jar:5.2.1.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:108) ~[spring-boot-actuator-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
at java.base/java.lang.Thread.run(Thread.java:830) ~[na:na]
Notice, that list
command does issue get on server with suffix like //
and this uri does not pass security check.
PS: discover
command does not generally work. get
without parameters can be helpful through.
SIde question: Is there some more recent project with similar functionality? I mean some cli with help in navigating RESTfull service built using spring-data-rest (hateoas) on latest springboot?
Doing a standard clone and build I got an error. Shouldn't this dependency be public without special authentication?
rest-shell jbayer$ ./gradlew installApp
:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all dependencies for configuration ':compile'.
> Could not find group:org.springframework.shell, module:spring-shell, version:1.0.1.BUILD-SNAPSHOT.
Required by:
org.springframework.data.rest.shell:rest-shell:1.2.2.RELEASE
> Could not resolve group:commons-codec, module:commons-codec, version:1.7.
Required by:
org.springframework.data.rest.shell:rest-shell:1.2.2.RELEASE
> Could not GET 'http://repo.springsource.org/libs-release/commons-codec/commons-codec/1.7/commons-codec-1.7.pom'. Received status code 401 from server: Unauthorized
http://localhost:8080/oba/api/processes:> put 712 --from process_data.json
You should specify option (--data, --follow, --output) for this command
I think this is partly because "data" is a required argument
Keyword: data
Help: The JSON data to use as the resource.
Mandatory: true
Default if specified: '__NULL__'
Default if unspecified: '__NULL__'
I'm using version 1.2.1.RELEASE
I had to update springShellVersion = "1.0.0.RELEASE"
kparikh-mbpro:rest-shell kparikh$ ./gradlew --info installApp
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file '/Users/kparikh/git/rest-shell/build.gradle'.
Included projects: [root project 'rest-shell']
Evaluating root project 'rest-shell' using build file '/Users/kparikh/git/rest-shell/build.gradle'.
All projects evaluated.
Selected primary task 'installApp'
Tasks to be executed: [task ':compileJava', task ':processResources', task ':classes', task ':jar', task ':startScripts', task ':installApp']
:compileJava
Resource missing. [HTTP GET: http://repo.springsource.org/libs-release/org/springframework/shell/spring-shell/1.0.1.BUILD-SNAPSHOT/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo.springsource.org/libs-release/org/springframework/shell/spring-shell/1.0.1.BUILD-SNAPSHOT/spring-shell-1.0.1.BUILD-SNAPSHOT.pom]
Resource missing. [HTTP GET: http://repo.springsource.org/libs-release/org/springframework/shell/spring-shell/1.0.1.BUILD-SNAPSHOT/maven-metadata.xml]
Resource missing. [HTTP HEAD: http://repo.springsource.org/libs-release/org/springframework/shell/spring-shell/1.0.1.BUILD-SNAPSHOT/spring-shell-1.0.1.BUILD-SNAPSHOT.jar]
Resource missing. [HTTP GET: http://spring-roo-repository.springsource.org/release/org/springframework/shell/spring-shell/1.0.1.BUILD-SNAPSHOT/maven-metadata.xml]
Resource missing. [HTTP GET: http://spring-roo-repository.springsource.org/release/org/springframework/shell/spring-shell/1.0.1.BUILD-SNAPSHOT/spring-shell-1.0.1.BUILD-SNAPSHOT.pom]
Resource missing. [HTTP GET: http://spring-roo-repository.springsource.org/release/org/springframework/shell/spring-shell/1.0.1.BUILD-SNAPSHOT/maven-metadata.xml]
Resource missing. [HTTP HEAD: http://spring-roo-repository.springsource.org/release/org/springframework/shell/spring-shell/1.0.1.BUILD-SNAPSHOT/spring-shell-1.0.1.BUILD-SNAPSHOT.jar]
:: loading settings :: url = jar:file:/Users/kparikh/.gradle/wrapper/dists/gradle-1.3-bin/6duudkdtsf89ftu9dh8bpgenv0/gradle-1.3/lib/ivy-2.2.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
FAILURE: Build failed with an exception.
What went wrong:
Could not resolve all dependencies for configuration ':compile'.
Could not find group:org.springframework.shell, module:spring-shell, version:1.0.1.BUILD-SNAPSHOT.
Required by:
org.springframework.data.rest.shell:rest-shell:1.2.2.BUILD-SNAPSHOT
Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.
BUILD FAILED
Total time: 5.21 secs
Hi I tried to pass this request and failed,
post test --data "{id: '11', name: [{'test', 'test1', 'test2'}]}"
post test --data "{id: '11', name: {'test', 'test1', 'test2'}}"
and I tried passing many combinations all in vain. How to pass a json array inside another json array in request
Hi,
I am very new to springs, when I post a url to findByEmail as url --params "{email: '[email protected]'}", that @ symbol changes to encoded form while get http request and cant fetch from DB, when I use in browser its fetching details properly. Is there any way to pass email address. Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.