Skip to content

Instantly share code, notes, and snippets.

View odrotbohm's full-sized avatar
👨‍💻
@ home

Oliver Drotbohm odrotbohm

👨‍💻
@ home
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:j2ee="http://www.springframework.org/schema/j2ee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/j2ee http://www.springframework.org/schema/j2ee/spring-j2ee-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
Sampling process 47331 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Growl (pid 47331) every 1 millisecond
Process: Growl [47331]
Path: /Applications/Growl.app/Contents/MacOS/Growl
Load Address: 0x109dcb000
Identifier: com.Growl.GrowlHelperApp
Version: 1.3.1 (1.3.1)
Code Type: X86-64 (Native)
Parent Process: launchd [169]
/*
* Copyright 2002-2011 the original author or authors.
*
* Licensed 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
MockHttpServletRequest httpServletRequest = new MockHttpServletRequest("GET", "http://localhost:8080/foo/bar?foo=bar");
String string = ServletUriComponentsBuilder.fromRequest(httpServletRequest).path("/something").build().toUriString();
assertThat(string, is("http://localhost:8080/foo/bar/something?foo=bar"));
java.lang.AssertionError:
Expected: is "http://localhost:8080/foo/bar/something?foo=bar"
got: "http://localhost/http://localhost:8080/foo/bar?foo=bar/something"
public class UriBuilder {
private UriComponents builder;
private UriBuilder(UriComponentsBuilder builder) {
this.builder = builder.build();
}
public static UriBuilder uriFor(Class<?> controller) {
[INFO] org.springframework.data:spring-data-mongodb:jar:1.1.0.BUILD-SNAPSHOT
[INFO] +- org.springframework:spring-tx:jar:3.2.0.BUILD-SNAPSHOT:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-context:jar:3.2.0.BUILD-SNAPSHOT:compile
[INFO] | +- org.springframework:spring-instrument:jar:3.2.0.BUILD-SNAPSHOT:compile
[INFO] | \- org.springframework:spring-aop:jar:3.2.0.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework:spring-beans:jar:3.2.0.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework:spring-core:jar:3.2.0.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework:spring-expression:jar:3.2.0.BUILD-SNAPSHOT:compile
[INFO] +- org.springframework.data:spring-data-commons-core:jar:1.3.0.BUILD-SNAPSHOT:compile
@odrotbohm
odrotbohm / QVenue.java
Created April 2, 2012 12:13
QVenue.java
package org.springframework.data.jpa.domain.sample;
import static com.mysema.query.types.PathMetadataFactory.*;
import com.mysema.query.types.*;
import com.mysema.query.types.path.*;
import javax.annotation.Generated;
// Mit @IdClass
@Entity
@IdClass(MyPK.class)
public class MyEntity {
@Id String first;
@Id String second;
}
public class MyPk {
@odrotbohm
odrotbohm / gist:2375222
Created April 13, 2012 08:59
Using RestTempalte with Basic authentication
HttpClient client = new HttpClient();
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("your_user","your_password");
client.getState().setCredentials(new AuthScope("thehost", 9090, AuthScope.ANY_REALM), credentials);
ClientHttpRequestFactory requestFactory= new HttpComponentsClientHttpRequestFactory(client);
RestOperations operations new RestTemplate(requestFactory);
@Controller
@RequestMapping("/persons")
class PersonController {
private final PersonRepository repository;
@Autowired
public PersonController(PersonRepository repository) {
Assert.notNull(repository);
this.repository = repository;