br.com.caelum.vraptor.proxy.Proxifier Java Examples

The following examples show how to use br.com.caelum.vraptor.proxy.Proxifier. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LinkToHandlerTest.java    From vraptor4 with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldAvoidFrozenClassIfTwoVRaptorInstancesAreLoaded() throws Throwable {
	ServletContext context0 = Mockito.mock(ServletContext.class);
	ServletContext context1 = Mockito.mock(ServletContext.class);

	when(context0.getContextPath()).thenReturn("");
	when(context1.getContextPath()).thenReturn("/another");

	ReflectionProvider reflectionProvider = new DefaultReflectionProvider();
	Proxifier proxifier = new JavassistProxifier();

	LinkToHandler handler0 = new LinkToHandler(context0, router, proxifier, reflectionProvider);
	LinkToHandler handler1 = new LinkToHandler(context1, router, proxifier, reflectionProvider);

	Object object0 = handler0.get(new DefaultBeanClass(TestController.class));
	assertThat(object0.getClass().getName(), containsString("$linkTo_$$"));

	Object object1 = handler1.get(new DefaultBeanClass(TestController.class));
	assertThat(object1.getClass().getName(), containsString("$linkTo$another_$$"));
}
 
Example #2
Source File: DefaultValidatorTest.java    From vraptor4 with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() {
	ResourceBundle bundle = new SafeResourceBundle(ResourceBundle.getBundle("messages"));

	ValidatorFactory validatorFactory = javax.validation.Validation.buildDefaultValidatorFactory();
	javax.validation.Validator bvalidator = validatorFactory.getValidator();
	MessageInterpolator interpolator = validatorFactory.getMessageInterpolator();

	Proxifier proxifier = new JavassistProxifier();
	Messages messages = new Messages();

	validator = new DefaultValidator(result, new DefaultValidationViewsFactory(result, proxifier, new DefaultReflectionProvider()), 
			outjector, proxifier, bundle, bvalidator, interpolator, Locale.ENGLISH, messages);
	when(result.use(LogicResult.class)).thenReturn(logicResult);
	when(result.use(PageResult.class)).thenReturn(pageResult);
	when(logicResult.forwardTo(MyComponent.class)).thenReturn(instance);
	when(pageResult.of(MyComponent.class)).thenReturn(instance);
}
 
Example #3
Source File: DefaultValidator.java    From vraptor4 with Apache License 2.0 5 votes vote down vote up
@Inject
public DefaultValidator(Result result, ValidationViewsFactory factory, Outjector outjector, Proxifier proxifier, 
		ResourceBundle bundle, javax.validation.Validator bvalidator, MessageInterpolator interpolator, Locale locale,
		Messages messages) {
	this.result = result;
	this.viewsFactory = factory;
	this.outjector = outjector;
	this.proxifier = proxifier;
	this.bundle = bundle;
	this.bvalidator = bvalidator;
	this.interpolator = interpolator;
	this.locale = locale;
	this.messages = messages;
}
 
Example #4
Source File: MockSerializationResult.java    From vraptor4 with Apache License 2.0 5 votes vote down vote up
public MockSerializationResult(Proxifier proxifier, XStreamBuilder xstreambuilder, GsonSerializerBuilder gsonBuilder,
		Environment environment, ReflectionProvider reflectionProvider) {
	super(proxifier);
	this.environment = environment;
	this.reflectionProvider = reflectionProvider;
	this.response = new MockHttpServletResponse();
	this.extractor = new DefaultTypeNameExtractor();
	this.xstreambuilder = xstreambuilder;
	this.gsonBuilder = gsonBuilder;
}
 
Example #5
Source File: DefaultRouter.java    From vraptor4 with Apache License 2.0 5 votes vote down vote up
@Inject
public DefaultRouter(Proxifier proxifier, TypeFinder finder, Converters converters,
		ParameterNameProvider nameProvider, Evaluator evaluator, EncodingHandler encodingHandler,
		CacheStore<Invocation, Route> cache) {
	this.proxifier = proxifier;
	this.finder = finder;
	this.converters = converters;
	this.nameProvider = nameProvider;
	this.evaluator = evaluator;
	this.encodingHandler = encodingHandler;
	this.cache = cache;
}
 
Example #6
Source File: DefaultRouteBuilder.java    From vraptor4 with Apache License 2.0 5 votes vote down vote up
public DefaultRouteBuilder(Proxifier proxifier, TypeFinder finder, Converters converters, ParameterNameProvider nameProvider, 
		Evaluator evaluator, String uri, EncodingHandler encodingHandler) {
	this.proxifier = proxifier;
	this.finder = finder;
	this.converters = converters;
	this.nameProvider = nameProvider;
	this.evaluator = evaluator;
	this.originalUri = uri;
	this.encodingHandler = encodingHandler;
}
 
Example #7
Source File: DefaultLogicResult.java    From vraptor4 with Apache License 2.0 5 votes vote down vote up
@Inject
public DefaultLogicResult(Proxifier proxifier, Router router, MutableRequest request, HttpServletResponse response,
		Container container, PathResolver resolver, TypeNameExtractor extractor, FlashScope flash, MethodInfo methodInfo) {
	this.proxifier = proxifier;
	this.response = unproxifyIfPossible(response);
	this.request = unproxifyIfPossible(request);
	this.router = router;
	this.container = container;
	this.resolver = resolver;
	this.extractor = extractor;
	this.flash = flash;
	this.methodInfo = methodInfo;
}
 
Example #8
Source File: LinkToHandler.java    From vraptor4 with Apache License 2.0 5 votes vote down vote up
@Inject
public LinkToHandler(ServletContext context, Router router, Proxifier proxifier, ReflectionProvider reflectionProvider) {
	this.context = context;
	this.router = router;
	this.proxifier = proxifier;
	this.reflectionProvider = reflectionProvider;
}
 
Example #9
Source File: DefaultPageResult.java    From vraptor4 with Apache License 2.0 5 votes vote down vote up
@Inject
public DefaultPageResult(MutableRequest req, MutableResponse res, MethodInfo methodInfo,
		PathResolver resolver, Proxifier proxifier) {
	this.request = unproxifyIfPossible(req);
	this.response = unproxifyIfPossible(res);
	this.methodInfo = methodInfo;
	this.proxifier = proxifier;
	this.resolver = resolver;
}
 
Example #10
Source File: DefaultStatus.java    From vraptor4 with Apache License 2.0 5 votes vote down vote up
@Inject
public DefaultStatus(HttpServletResponse response, Result result, Configuration config,
		Proxifier proxifier, Router router) {
	this.response = response;
	this.result = result;
	this.config = config;
	this.proxifier = proxifier;
	this.router = router;
}
 
Example #11
Source File: CejugValidator.java    From hurraa with GNU General Public License v2.0 5 votes vote down vote up
@Inject
public CejugValidator(Result result, ValidationViewsFactory factory, Outjector outjector, Proxifier proxifier,
		ResourceBundle bundle, Validator validator, MessageInterpolator interpolator, Locale locale) {
	super(result, factory, outjector, proxifier, bundle,  validator, interpolator, locale);
	this.result = result;
	this.viewsFactory = factory;
	this.outjector = outjector;
	this.proxifier = proxifier;
}
 
Example #12
Source File: DefaultValidationViewsFactory.java    From vraptor4 with Apache License 2.0 4 votes vote down vote up
@Inject
public DefaultValidationViewsFactory(Result result, Proxifier proxifier, ReflectionProvider reflectionProvider) {
	this.result = result;
	this.proxifier = proxifier;
	this.reflectionProvider = reflectionProvider;
}
 
Example #13
Source File: MockResult.java    From vraptor4 with Apache License 2.0 4 votes vote down vote up
public MockResult(Proxifier proxifier) {
	this.proxifier = proxifier;
}
 
Example #14
Source File: ExceptionRecorder.java    From vraptor4 with Apache License 2.0 4 votes vote down vote up
public ExceptionRecorder(Proxifier proxifier, ReflectionProvider reflectionProvider) {
	this.proxifier = proxifier;
	this.reflectionProvider = reflectionProvider;
}
 
Example #15
Source File: DefaultExceptionMapper.java    From vraptor4 with Apache License 2.0 4 votes vote down vote up
@Inject
public DefaultExceptionMapper(Proxifier proxifier, ReflectionProvider reflectionProvider) {
	this.proxifier = proxifier;
	this.reflectionProvider = reflectionProvider;
	this.exceptions = new LinkedHashMap<>();
}
 
Example #16
Source File: ExceptionRecorderTest.java    From vraptor4 with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() {
	MockitoAnnotations.initMocks(this);
	Proxifier proxifier = new JavassistProxifier();
	mapper = new DefaultExceptionMapper(proxifier, new DefaultReflectionProvider());
}
 
Example #17
Source File: MockSerializationResult.java    From vraptor4 with Apache License 2.0 2 votes vote down vote up
/**
 * @deprecated Prefer using {@link MockSerializationResult#MockSerializationResult(Proxifier, XStreamBuilder, GsonSerializerBuilder, Environment, ReflectionProvider)}
 * that provides a {@link Environment}.
 */
public MockSerializationResult(Proxifier proxifier, XStreamBuilder xstreambuilder, GsonSerializerBuilder gsonBuilder, ReflectionProvider reflectionProvider) {
	this(proxifier, xstreambuilder, gsonBuilder, new NullEnvironment(), reflectionProvider);
}