javax.mvc.MvcContext Java Examples

The following examples show how to use javax.mvc.MvcContext. 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: UriTemplateParserTest.java    From krazo with Apache License 2.0 5 votes vote down vote up
@Before
public void onBefore() {
    uriTemplateParser = new UriTemplateParser();
    MvcContext mvcContext = createMock(MvcContext.class);
    expect(mvcContext.getBasePath()).andReturn(BASE_PATH).anyTimes();
    replay(mvcContext);
    uriTemplateParser.mvcContext = mvcContext;
}
 
Example #2
Source File: UriTemplateParserTest.java    From ozark with Apache License 2.0 5 votes vote down vote up
@Before
public void onBefore() {
    uriTemplateParser = new UriTemplateParser();
    MvcContext mvcContext = createMock(MvcContext.class);
    expect(mvcContext.getBasePath()).andReturn(BASE_PATH).anyTimes();
    replay(mvcContext);
    uriTemplateParser.mvcContext = mvcContext;
}
 
Example #3
Source File: WebContextProducer.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@PortletRequestScoped
@Produces
public IWebContext getWebContext(BeanManager beanManager, VariableValidator variableValidator,
	MvcContext mvcContext, Models models, PortletRequest portletRequest, MimeResponse mimeResponse,
	ServletContext servletContext) {

	return new CDIPortletWebContext(beanManager, variableValidator, models,
			(String) portletRequest.getAttribute(PortletRequest.LIFECYCLE_PHASE),
			new HttpServletRequestAdapter(portletRequest), new HttpServletResponseAdapter(mimeResponse),
			servletContext, mvcContext.getLocale());
}
 
Example #4
Source File: WebContextProducer.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@Scope(proxyMode = ScopedProxyMode.INTERFACES, value = "portletRequest")
@Bean
public IWebContext getWebContext(MvcContext mvcContext, Models models, PortletRequest portletRequest,
	MimeResponse mimeResponse, ServletContext servletContext) {

	return new SpringPortletWebContext(applicationContext, models,
			(String) portletRequest.getAttribute(PortletRequest.LIFECYCLE_PHASE),
			new HttpServletRequestAdapter(portletRequest), new HttpServletResponseAdapter(mimeResponse),
			servletContext, mvcContext.getLocale(), mvcContext.getConfig());
}
 
Example #5
Source File: TemplateEngineSupplierProducer.java    From portals-pluto with Apache License 2.0 5 votes vote down vote up
@Override
public String get() {
	MvcContext mvcContext = beanFactory.getBean(MvcContext.class);

	javax.ws.rs.core.Configuration configuration = mvcContext.getConfig();

	String templateLocation = (String) configuration.getProperty(ViewEngine.VIEW_FOLDER);

	if (templateLocation == null) {
		templateLocation = ViewEngine.DEFAULT_VIEW_FOLDER;
	}

	return templateLocation;
}
 
Example #6
Source File: TemplateEngineSupplierProducer.java    From portals-pluto with Apache License 2.0 4 votes vote down vote up
@ApplicationScoped
@Produces
public TemplateEngineSupplier getTemplateEngineSupplier(PortletConfig portletConfig, ServletContext servletContext,
														MvcContext mvcContext) {

	TemplateEngine templateEngine = new TemplateEngine();

	templateEngine.setMessageResolver(new PortletMessageResolver(portletConfig));

	Configuration configuration = mvcContext.getConfig();

	String templateLocation = (String) configuration.getProperty(ViewEngine.VIEW_FOLDER);

	if (templateLocation == null) {
		templateLocation = ViewEngine.DEFAULT_VIEW_FOLDER;
	}

	templateEngine.setTemplateResolver(new PortletTemplateResolver(servletContext,
			new CDITemplateLocationSupplier(templateLocation)));

	return new DefaultTemplateEngineSupplier(templateEngine);
}