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
@Test | |
public void addTodo() throws Exception { | |
final Todo formObject = new Todo(); | |
formObject.setTitle("my title"); | |
formObject.setDescription("some description"); | |
mockMvc.perform(post("/todo/add") | |
.contentType(MediaType.APPLICATION_FORM_URLENCODED) | |
.with(new RequestPostProcessor() { | |
@Override |
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
ls -l | awk '{print $9}' |
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
import org.junit.Before; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import static org.mockito.Mockito.*; | |
import static org.mockito.MockitoAnnotations.*; | |
@RunWith(MockitoJUnitRunner.class) | |
public class MyAppTest { | |
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://www.baeldung.com/rest-with-spring-series/ |
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 abstract class AuthenticationUtil { | |
public static String getUserName() { | |
if (isAnonymous()) { | |
return "anonymous"; | |
} | |
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); | |
return authentication == null ? null : authentication.getName(); | |
} |
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 handleIt() throws IOException { | |
final HttpMethodBase method = getMethod(request); | |
addRequestHeaders(method, request); | |
method.setQueryString(request.getQueryString()); | |
spoofHostHeader(method); | |
try { | |
final int statusCode = client.executeMethod(method); | |
response.setStatus(statusCode); | |
addResponseHeaders(method, response); |
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
HttpServletRequest request = (HttpServletRequest) servletRequest; | |
HttpServletResponse response = (HttpServletResponse) servletResponse; | |
if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With")) { | |
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); | |
return; | |
} |
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
<?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:p="http://www.springframework.org/schema/p" | |
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> | |
</beans> |
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
$(function () { | |
$.getJSON('https://apps.ingenuity.com/irs/data/public/samplereports?jsoncallback=?') | |
.done(function (samples) { | |
var ul = $('<ul>'); | |
$.each(samples, function (index, sample) { | |
$("<li>") | |
.append( | |
$("<a>") | |
.attr('href', 'https://apps.ingenuity.com/ireport/data/report?reportid=' + sample.reportId) | |
.attr('target', '_blank') |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<web-app xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee | |
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" | |
version="2.5"> | |
</web-app> |