public class DWRClass { public doSomething(){ WebContext ctx = WebContextFactory.get(); HttpServletRequest req = ctx.getHttpServletRequest(); HttpSession sess = req.getSession(); //no parameter is the same as passing true //Lets set another attribute for a forward or JSP to use ArrayList<Boolean> flags = new ArrayList<Boolean>(); req.setAttribute("listOfNames", flags); } }
public HttpServletRequest get() { WebContext webcx = WebContextFactory.get(); return webcx.getHttpServletRequest(); }
@Override public HttpServletRequest get() { return WebContextFactory.get().getHttpServletRequest(); }
@SuppressWarnings({"unchecked"}) public Map<String, String[]> get() { WebContext webcx = WebContextFactory.get(); return webcx.getHttpServletRequest().getParameterMap(); }
public String addFileTransfer(FileTransfer generator) throws IOException { String id = idGenerator.generate(); putFileTransfer(id, generator); HttpServletRequest request = WebContextFactory.get().getHttpServletRequest(); return "'" + request.getContextPath() + request.getServletPath() + downloadHandlerUrl + id + "'"; }
public String getPathToDwrServlet(String contextServletPath) { String actualPath = contextServletPath; if (useAbsolutePath) { HttpServletRequest request = WebContextFactory.get().getHttpServletRequest(); actualPath = LocalUtil.getFullUrlToDwrServlet(request); } return actualPath; }
public Object test(){ WebContext ctx = WebContextFactory.get(); HttpServletRequest req = ctx.getHttpServletRequest(); VitroRequest vreq = new VitroRequest(req); WebappDaoFactory wdf = vreq.getWebappDaoFactory(); Collection c = wdf.getPropertyInstanceDao().getExistingProperties("http://example.org/property", null); return c.iterator().next(); }
private void assertIsPublishGranted(ContentContainer container) { AccessController.assertIsGranted("publish", container.getOwner(), WebContextFactory.get().getHttpServletRequest()); }
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception { WebContext webContext = WebContextFactory.get(); WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(webContext .getServletContext()); MessageSource messageSource = (MessageSource) wac.getBean(messageSourceKey); JstlUtils.exposeLocalizationContext(webContext.getHttpServletRequest(), messageSource); return chain.doFilter(obj, method, params); } }
public Object doFilter(Object obj, Method method, Object[] params, AjaxFilterChain chain) throws Exception { WebContext webContext = WebContextFactory.get(); if (resourceBundleDirectory != null && resourceBundleLoader == null) resourceBundleLoader = new ResourceBundleLoader(webContext.getServletContext().getRealPath( resourceBundleDirectory)); I18NUtils.prepareRequest(webContext.getHttpServletRequest(), localeResolverName, bundleBaseName, resourceBundleLoader); return chain.doFilter(obj, method, params); } }
@Override public OutboundVariable convertOutbound(Object data, OutboundContext outctx) throws MarshallException { WebContext webctx = WebContextFactory.get(); LocalizableMessage lm = (LocalizableMessage)data; String s = lm.getLocalizedMessage(I18NUtils.getBundle(webctx.getHttpServletRequest())); return super.convertOutbound(s, outctx); } }
/** * Performs a logout. */ @RemoteMethod public void logout() { WebContext ctx = WebContextFactory.get(); LoginManager.logout(ctx.getHttpServletRequest(), ctx.getHttpServletResponse()); }
private void initScriptSession() { WebContext webContext = WebContextFactory.get(); HttpServletRequest request = webContext.getHttpServletRequest(); ScriptSession currentSession = webContext.getScriptSession(); String host = request.getServerName(); RiotUser user = AccessController.getCurrentUser(); currentSession.setAttribute("host", host); currentSession.setAttribute("userId", user.getUserId()); }
public PropertyInstance getProperty(String subjectURI, String predicateURI, String objectURI) { WebContext ctx = WebContextFactory.get(); HttpServletRequest req = ctx.getHttpServletRequest(); VitroRequest vreq = new VitroRequest(req); WebappDaoFactory wdf = vreq.getUnfilteredWebappDaoFactory(); return wdf.getPropertyInstanceDao().getProperty(subjectURI, predicateURI, objectURI); }
public int deleteProp(String subjectUri, String predicateUri, String objectUri){ WebContext ctx = WebContextFactory.get(); HttpServletRequest req = ctx.getHttpServletRequest(); VitroRequest vreq = new VitroRequest(req); vreq.getUnfilteredWebappDaoFactory().getPropertyInstanceDao().deleteObjectPropertyStatement(subjectUri, predicateUri, objectUri); return 0; }
public Collection getAllPossiblePropInstForIndividual(String individualURI) { WebContext ctx = WebContextFactory.get(); HttpServletRequest req = ctx.getHttpServletRequest(); VitroRequest vreq = new VitroRequest(req); WebappDaoFactory wdf = vreq.getUnfilteredWebappDaoFactory(); Collection c = wdf.getPropertyInstanceDao().getAllPossiblePropInstForIndividual(individualURI); return c; }
/** ******************************************************** * Gets an Entity object for a given entities.id. */ public Individual entityByURI(String entityURI){ WebContext ctx = WebContextFactory.get(); HttpServletRequest req = ctx.getHttpServletRequest(); VitroRequest vreq = new VitroRequest(req); Individual ind = vreq.getWebappDaoFactory().getIndividualDao().getIndividualByURI(entityURI); return ind; }
public int insertProp( PropertyInstance prop) { WebContext ctx = WebContextFactory.get(); HttpServletRequest req = ctx.getHttpServletRequest(); VitroRequest vreq = new VitroRequest(req); return vreq.getUnfilteredWebappDaoFactory().getPropertyInstanceDao().insertProp(prop); }
/** * Is the data: URL allowed by the current browser. * @return true if data: is allowed */ protected boolean isDataUrlAvailable() { HttpServletRequest request = WebContextFactory.get().getHttpServletRequest(); return BrowserDetect.atLeast(request, UserAgent.IE, 8) || BrowserDetect.atLeast(request, UserAgent.Gecko, 20041107) || BrowserDetect.atLeast(request, UserAgent.AppleWebKit, 2) || BrowserDetect.atLeast(request, UserAgent.Opera, 8); } }
@DwrPermission(anonymous = true) public void setLocale(String locale) { WebContext webContext = WebContextFactory.get(); LocaleResolver localeResolver = new SessionLocaleResolver(); LocaleEditor localeEditor = new LocaleEditor(); localeEditor.setAsText(locale); localeResolver.setLocale(webContext.getHttpServletRequest(), webContext.getHttpServletResponse(), (Locale) localeEditor.getValue()); }