当前位置: 首页>>代码示例>>Java>>正文


Java WebContext.getHttpServletRequest方法代码示例

本文整理汇总了Java中org.directwebremoting.WebContext.getHttpServletRequest方法的典型用法代码示例。如果您正苦于以下问题:Java WebContext.getHttpServletRequest方法的具体用法?Java WebContext.getHttpServletRequest怎么用?Java WebContext.getHttpServletRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.directwebremoting.WebContext的用法示例。


在下文中一共展示了WebContext.getHttpServletRequest方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateId

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * Generates and returns a new unique id suitable to use for the
 * CSRF session cookie. This method is itself exempted from CSRF checking.
 */
public String generateId()
{
    WebContext webContext = WebContextFactory.get();

    // If the current session already has a set DWRSESSIONID then we return that
    HttpServletRequest request = webContext.getHttpServletRequest();
    HttpSession sess = request.getSession(false);
    if (sess != null && sess.getAttribute(ATTRIBUTE_DWRSESSIONID) != null)
    {
        return (String) sess.getAttribute(ATTRIBUTE_DWRSESSIONID);
    }

    // Otherwise generate a fresh ID
    IdGenerator idGenerator = webContext.getContainer().getBean(IdGenerator.class);
    return idGenerator.generate();
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:21,代码来源:System.java

示例2: convertInbound

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public Object convertInbound(Class paramType, InboundVariable iv, InboundContext inctx)
{
    WebContext webcx = WebContextFactory.get();

    if (HttpServletRequest.class.isAssignableFrom(paramType))
    {
        return webcx.getHttpServletRequest();
    }

    if (HttpServletResponse.class.isAssignableFrom(paramType))
    {
        return webcx.getHttpServletResponse();
    }

    if (ServletConfig.class.isAssignableFrom(paramType))
    {
        return webcx.getServletConfig();
    }

    if (ServletContext.class.isAssignableFrom(paramType))
    {
        return webcx.getServletContext();
    }

    if (HttpSession.class.isAssignableFrom(paramType))
    {
        return webcx.getSession(true);
    }

    return null;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:ServletConverter.java

示例3: renderAsync

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 * @throws Exception sometimes things just don't work out
 */
public String renderAsync() throws Exception {
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest req = ctx.getHttpServletRequest();
    RequestContext rhnCtx = new RequestContext(req);
    User user = rhnCtx.getCurrentUser();
    PageControl pc = new PageControl();
    pc.setStart(1);
    pc.setPageSize(PAGE_SIZE);
    render(user, pc, req);
    HttpServletResponse resp = ctx.getHttpServletResponse();
    return RendererHelper.renderRequest(
            getPageUrl(),
            req,
            resp);
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:20,代码来源:BaseFragmentRenderer.java

示例4: renderAsync

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * Renders Action Chain entries from an Action Chain having a certain sort
 * order number.
 * @param actionChainId Action Chain identifier
 * @param sortOrder sort order number
 * @return a response string
 * @throws ServletException if something goes wrong
 * @throws IOException if something goes wrong
 */
public String renderAsync(Long actionChainId, Integer sortOrder)
    throws ServletException, IOException {
    WebContext webContext = WebContextFactory.get();
    HttpServletRequest request = webContext.getHttpServletRequest();
    User u = new RequestContext(request).getCurrentUser();

    ActionChain actionChain = ActionChainFactory.getActionChain(u, actionChainId);
    request.setAttribute("sortOrder", sortOrder);
    request.setAttribute("entries",
        ActionChainFactory.getActionChainEntries(actionChain, sortOrder));

    HttpServletResponse response = webContext.getHttpServletResponse();
    return RendererHelper.renderRequest(
        "/WEB-INF/pages/common/fragments/schedule/actionchainentries.jsp", request,
        response);
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:26,代码来源:ActionChainEntryRenderer.java

示例5: getProtocolTypes

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public String[] getProtocolTypes()
{
	WebContext webContext = WebContextFactory.get();
	HttpServletRequest request = webContext.getHttpServletRequest();
	try {
		SortedSet<String> types = null;
		types = InitSetup.getInstance().getDefaultAndOtherTypesByLookup(
				request, "protocolTypes", "protocol", "type", "otherType", true);
		types.add("");
		String[] eleArray = new String[types.size()];
		return types.toArray(eleArray);
	} catch (Exception e) {
		logger.error("Problem setting protocol types: \n", e);
		e.printStackTrace();
	}
	return new String[] { "" };
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:18,代码来源:ProtocolManager.java

示例6: getPublicationCategories

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public String[] getPublicationCategories(String searchLocations) {
	WebContext wctx = WebContextFactory.get();
	HttpServletRequest request = wctx.getHttpServletRequest();
	try {
		SortedSet<String> types = InitSetup.getInstance()
				.getDefaultAndOtherTypesByLookup(request,
						"publicationCategories", "publication", "category",
						"otherCategory", true);
		types.add("");
		String[] eleArray = new String[types.size()];
		return types.toArray(eleArray);
	} catch (Exception e) {
		logger.error("Problem getting publication types: \n", e);
		e.printStackTrace();
	}
	return new String[] { "" };
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:18,代码来源:PublicationManager.java

示例7: getPublicationStatuses

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public String[] getPublicationStatuses() {
	WebContext wctx = WebContextFactory.get();
	HttpServletRequest request = wctx.getHttpServletRequest();
	try {
		SortedSet<String> types = InitSetup.getInstance()
				.getDefaultAndOtherTypesByLookup(request,
						"publicationStatuses", "publication", "status", "otherStatus", true);
		types.add("");
		String[] eleArray = new String[types.size()];
		return types.toArray(eleArray);
	} catch (Exception e) {
		logger.error("Problem getting publication statuses: \n", e);
		e.printStackTrace();
	}
	return new String[] { "" };
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:17,代码来源:PublicationManager.java

示例8: convertInbound

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public Object convertInbound(Class<?> paramType, InboundVariable data)
{
    WebContext webcx = WebContextFactory.get();

    if (HttpServletRequest.class.isAssignableFrom(paramType))
    {
        return webcx.getHttpServletRequest();
    }

    if (HttpServletResponse.class.isAssignableFrom(paramType))
    {
        return webcx.getHttpServletResponse();
    }

    if (ServletConfig.class.isAssignableFrom(paramType))
    {
        return webcx.getServletConfig();
    }

    if (ServletContext.class.isAssignableFrom(paramType))
    {
        return webcx.getServletContext();
    }

    if (HttpSession.class.isAssignableFrom(paramType))
    {
        return webcx.getSession(true);
    }

    return null;
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:32,代码来源:ServletConverter.java

示例9: saveOperLog

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public int saveOperLog(String action, String action_desc) {
	try {
		WebContext webContext = WebContextFactory.get();
		HttpServletRequest request = null;
		if(webContext != null)
			request = webContext.getHttpServletRequest();
		return saveOperLog(action, action_desc, request);
	} catch (Exception e) {
		logger.error(e.getMessage());
		return 0;
	}
}
 
开发者ID:wufeisoft,项目名称:ryf_mms2,代码行数:13,代码来源:PubDao.java

示例10: newContextForAction

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * create a new mini-JPublish context
 *
 * @param dwrContext the WebContext created by the DWR
 * @return a new JPublish context
 */
private JPublishContext newContextForAction(WebContext dwrContext) {
    JPublishContext context = new JPublishContext(this);
    context.disableCheckReservedNames(this);

    context.put(JPublishContext.JPUBLISH_REQUEST, dwrContext.getHttpServletRequest());
    context.put(JPublishContext.JPUBLISH_RESPONSE, dwrContext.getHttpServletResponse());
    context.put(JPublishContext.JPUBLISH_SESSION, dwrContext.getSession());
    context.put(JPublishCreator.APPLICATION, site.getServletContext());
    // add the character encoding map to the context
    context.put(JPublishContext.JPUBLISH_CHARACTER_ENCODING_MAP, site.getCharacterEncodingManager().getDefaultMap());

    // add the URLUtilities to the context
    URLUtilities urlUtilities = new URLUtilities(dwrContext.getHttpServletRequest(),
            dwrContext.getHttpServletResponse());
    context.put(JPublishContext.JPUBLISH_URL_UTILITIES, urlUtilities);

    // add the DateUtilities to the context
    context.put(JPublishContext.JPUBLISH_DATE_UTILITIES, DateUtilities.getInstance());

    // add the NumberUtilities to the context
    context.put(JPublishContext.JPUBLISH_NUMBER_UTILITIES, NumberUtilities.getInstance());

    // add the messages log to the context
    context.put(JPublishContext.JPUBLISH_SYSLOG, SiteContext.syslog);

    // expose the SiteContext
    context.put(JPublishContext.JPUBLISH_SITE, site);
    return context;
}
 
开发者ID:florinpatrascu,项目名称:jpublish,代码行数:36,代码来源:DWRJPublishActionManager.java

示例11: select

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
 * Dwr Item selector updates the RHNset
 * when its passed the setLabel, and ids to update
 * @param setLabel the set label
 * @param ids the ids to update
 * @param on true if the items were to be added
 * @return the selected
 * @throws Exception on exceptions
 */
public String select(String setLabel, String[] ids, boolean on) throws Exception {
    WebContext ctx = WebContextFactory.get();
    HttpServletRequest req = ctx.getHttpServletRequest();
    Integer size = updateSetFromRequest(req, setLabel, ids, on);
    if (size == null) {
        return "";
    }
    return getResponse(size, setLabel);
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:19,代码来源:DWRItemSelector.java

示例12: getPublicCounts

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public String getPublicCounts()
{
	WebContext wctx = WebContextFactory.get();
	HttpServletRequest request = wctx.getHttpServletRequest();
	request.getSession().removeAttribute("publicationSearchResults");

	Integer counts = 0;

	try {
		counts = publicationService.getNumberOfPublicPublications();
	} catch (Exception e) {
		logger.error("Error obtaining counts of public publications from local site.");
	}
	return counts.toString() + " Publications";
}
 
开发者ID:NCIP,项目名称:cananolab,代码行数:16,代码来源:PublicationManager.java

示例13: getFullURL

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
/**
  * @param pageName
  * @return
  */
public static String getFullURL(String pageName) {
	String serverName = appConfig.getProperty("application-server.name", "localhost");
	log.debug("Server name is " + serverName);
	WebContext wctx = WebContextFactory.get();
	HttpServletRequest rq = wctx.getHttpServletRequest();
	StringBuilder url = new StringBuilder();
	url.append(rq.getScheme()).append("://").append(serverName).append(":").append(rq.getServerPort())
		.append(rq.getContextPath()).append(pageName);
	return url.toString();
}
 
开发者ID:NCIP,项目名称:edct-formbuilder,代码行数:15,代码来源:IOUtils.java

示例14: get

import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public HttpServletRequest get()
{
    WebContext webcx = WebContextFactory.get();
    return webcx.getHttpServletRequest();
}
 
开发者ID:directwebremoting,项目名称:dwr,代码行数:6,代码来源:DwrGuiceServletModule.java


注:本文中的org.directwebremoting.WebContext.getHttpServletRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。