This file contains 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
class CommandInvocableHandlerMethod(private val handlerMethod: HandlerMethod, | |
private val requestCommandFactory: RequestCommandFactory, | |
private val configuration: RequestCommandConfiguration) : ServletInvocableHandlerMethod(handlerMethod) { | |
private lateinit var returnValueHandlers: HandlerMethodReturnValueHandlerComposite | |
@Trace(dispatcher = true) | |
override fun invokeForRequest(request: NativeWebRequest?, mavContainer: ModelAndViewContainer?, vararg providedArgs: Any?): Any { | |
// same as super.invokeForRequest(request, mavContainer, *providedArgs) | |
//but with request passed to do invoke | |
val args = this.getMethodArgumentValuesCallable.invoke(request, mavContainer, providedArgs) |
This file contains 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
var net = require('net'), | |
http = require('http'), | |
Writable = require('stream').Writable, | |
parsers = http.parsers, | |
HTTPParser = process.binding('http_parser').HTTPParser, | |
util = require('util'), | |
EventEmitter = require('events').EventEmitter; | |
function freeParser(parser, req) { | |
if (parser) { |
This file contains 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.springframework.core.task.TaskExecutor | |
import org.springframework.security.core.Authentication | |
import org.springframework.security.core.context.SecurityContext | |
import org.springframework.security.core.context.SecurityContextHolder | |
class SecurityContextHolderAwareTaskExecutor(private val realTaskExecutor: TaskExecutor) : TaskExecutor { | |
override fun execute(task: Runnable) { | |
val context = SecurityContextHolder.getContext() | |
if (context != null) { |
This file contains 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.hamcrest.MatcherAssert | |
import org.hamcrest.Matchers | |
import org.junit.Test | |
import org.mockito.Mockito | |
import javax.inject.Inject | |
import javax.servlet.http.HttpServletRequest | |
interface Database { | |
fun findUser(): User |
This file contains 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.hamcrest.MatcherAssert | |
import org.hamcrest.Matchers | |
import org.junit.Before | |
import org.junit.Test | |
import org.mockito.InjectMocks | |
import org.mockito.Mock | |
import org.mockito.Mockito | |
import org.mockito.MockitoAnnotations | |
import javax.inject.Inject | |
import javax.servlet.http.HttpServletRequest |
This file contains 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
module.exports.request = () => { | |
class IncomingMessage extends require('http').IncomingMessage { | |
} | |
const request = new IncomingMessage(); | |
request.__proto__ = require('express')().request; | |
return request; | |
}; | |
module.exports.response = (request) => { | |
class ServerResponse extends require('http').ServerResponse { | |
} |
This file contains 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 sample.stackanswers; | |
import android.app.Activity | |
import org.junit.Assert | |
import org.junit.Before; | |
import org.junit.Rule | |
import org.junit.Test | |
import org.junit.runner.RunWith; | |
import org.mockito.* | |
import org.mockito.junit.MockitoJUnit |
This file contains 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 class RetrofitTest { | |
@Test | |
public void configure() throws Exception { | |
ObjectMapper mapper = new ObjectMapper(); | |
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); | |
mapper.registerModule(new JodaModule()); | |
Retrofit retrofit = new Retrofit.Builder() |
This file contains 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 class PageAppearanceSection : ConfigurationSection<IPageAppearance> | |
{ | |
} | |
public interface IPageAppearance | |
{ | |
bool RemoteOnly { get; } | |
IFont Font { get; } | |
IColor Color { get; } | |
} |
This file contains 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
using System.Collections.Specialized; | |
using System.Data.Entity; | |
using System.Data.Entity.Infrastructure; | |
using System.Linq; | |
using System.Web; | |
using System.Web.Hosting; | |
using System.Web.Mvc; | |
using System.Web.Routing; | |
namespace TestSamples.VirtualPath |