This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public void configureMessageConverters(List<HttpMessageConverter<?>> messageConverters) { | |
| StringHttpMessageConverter stringConverter = new StringHttpMessageConverter(); | |
| stringConverter.setWriteAcceptCharset(false); | |
| messageConverters.add(new ByteArrayHttpMessageConverter()); | |
| messageConverters.add(stringConverter); | |
| messageConverters.add(new ResourceHttpMessageConverter()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Joshuas-MacBook-Pro:~ jlong$ rest-shell | |
| ___ ___ __ _____ __ _ _ _ _ __ | |
| | _ \ __/' _/_ _/' _/| || | / / | \ \ | |
| | v / _|`._`. | | `._`.| >< | / / / > > | |
| |_|_\___|___/ |_| |___/|_||_| |_/_/ /_/ | |
| 1.2.0.RELEASE | |
| Welcome to the REST shell. For assistance hit TAB or type "help". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://localhost:8080:> baseUri http://localhost:8080/api/ | |
| Base URI set to 'http://localhost:8080/api' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://localhost:8080/api//users:> get /users/72 --output output-for-72.txt | |
| >> output-for-72.txt | |
| http://localhost:8080/api//users:> ! cat output-for-72.txt | |
| command is:cat output-for-72.txt | |
| > GET http://localhost:8080/api//users/72 | |
| < 200 OK | |
| < Server: Apache-Coyote/1.1 | |
| < Content-Type: application/xml | |
| < Transfer-Encoding: chunked |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://localhost:8080/api//users:> headers set --name Accept --value application/json | |
| { | |
| "Accept" : "application/json" | |
| } | |
| http://localhost:8080/api//users:> get /users/72 | |
| > GET http://localhost:8080/api//users/72 | |
| > Accept: application/json | |
| < 200 OK | |
| < Server: Apache-Coyote/1.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://localhost:8080/api:> get /users/72 | |
| > GET http://localhost:8080/api//users/72 | |
| < 200 OK | |
| < Server: Apache-Coyote/1.1 | |
| < Content-Type: application/xml | |
| < Transfer-Encoding: chunked | |
| < Date: Fri, 15 Mar 2013 22:54:34 GMT | |
| < | |
| <?xml version="1.0" encoding="UTF-8" standalone="yes"?><user username="[email protected]" signupDate="2013-03-12T16:07:26.993-07:00" profilePhotoImported="true" password="password" lastName="Smith" importedFromServiceProvider="false" id="72" firstName="Jane" enabled="true"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Joshuas-MacBook-Pro:~ jlong$ curl --header "Accept: application/json" http://localhost:8080/api/users/72 | |
| {"id":72,"customers":null,"importedFromServiceProvider":false,"firstName":"Jane","lastName":"Smith","username":"[email protected]","password":"password","profilePhotoImported":true,"profilePhotoExt":null,"enabled":true,"signupDate":1363129646993} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public CrmUserDetails loadUserByUsername(String username) throws UsernameNotFoundException { | |
| User user = loginByUsername(username); | |
| if (null == user) | |
| return null; | |
| return new CrmUserDetails(user); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class CrmUserDetails implements UserDetails { | |
| public static final String SCOPE_READ = "read"; | |
| public static final String SCOPE_WRITE = "write"; | |
| public static final String ROLE_USER = "ROLE_USER"; | |
| private Collection<String> roles; | |
| private Collection<GrantedAuthority> grantedAuthorities; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.springsource.examples.spring31.web.config; | |
| import org.springframework.context.annotation.Configuration; | |
| import org.springframework.context.annotation.ImportResource; | |
| /** | |
| * class for all the security aware parts of the system like form-based login and OAuth | |
| * | |
| * @author Josh long | |
| */ |