本文整理汇总了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();
}
示例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;
}
示例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);
}
示例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);
}
示例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[] { "" };
}
示例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[] { "" };
}
示例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[] { "" };
}
示例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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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";
}
示例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();
}
示例14: get
import org.directwebremoting.WebContext; //导入方法依赖的package包/类
public HttpServletRequest get()
{
WebContext webcx = WebContextFactory.get();
return webcx.getHttpServletRequest();
}