...
[15:04:14 CDT(-0500)] <EricDalquist> </bean>
[15:07:27 CDT(-0500)] <drewwills> yes I was figuring it would be a spring bean, though partly because I was guessing there would eventually be dependencies or config I would want to bake into it from the xml... though I didn't have any yet
[15:07:42 CDT(-0500)] <drewwills> so the <bean> you describe could be part of that
[15:07:49 CDT(-0500)] <EricDalquist> yeah in that case I'd just make the ServletContext a constructor argument
[15:08:00 CDT(-0500)] <EricDalquist> since it should be known at that point
[15:08:06 CDT(-0500)] <EricDalquist> and it keeps the runtime API simpler
[15:08:17 CDT(-0500)] <drewwills> welll... 1 sec
[15:09:11 CDT(-0500)] Wiki Markup <drewwills> how would you know which context you want to invoke at "bean time?" and how would you get a reference to a different context w/ value="#{servletContext}"
[15:09:26 CDT(-0500)] <EricDalquist> no that is the caller's servletcontext
[15:09:31 CDT(-0500)] <drewwills> or do you mean 2 props/args
[15:09:57 CDT(-0500)] <EricDalquist> so looking at line 152: https://github.com/Jasig/portlet-utils/commit/e1402917529432e63124f58b4e179fbaf5e5f974#L4R152
[15:10:01 CDT(-0500)] <drewwills> sure... then how do i know which context to call? string arg?
[15:10:43 CDT(-0500)] <EricDalquist> um ... how are you getting the servlet context to call right now?
[15:10:46 CDT(-0500)] <EricDalquist> I missed that bit
[15:10:49 CDT(-0500)] <EricDalquist> looking ...
[15:10:54 CDT(-0500)] <drewwills> parsing the string
[15:11:01 CDT(-0500)] <drewwills> /uPortal/api/...
[15:11:16 CDT(-0500)] <drewwills> lol, yes i can continue to do that
[15:11:21 CDT(-0500)] <EricDalquist> right
[15:11:32 CDT(-0500)] <EricDalquist> so this isn't a solution to that part of the code
[15:11:34 CDT(-0500)] <drewwills> i thought this whole thread of discussion was about not having to parse that
[15:11:36 CDT(-0500)] <EricDalquist> no
[15:11:52 CDT(-0500)] <EricDalquist> it is about not doing "req.getSession().getServletContext()"
[15:12:04 CDT(-0500)] <EricDalquist> since the webapp has that value at init time
[15:12:16 CDT(-0500)] <drewwills> ok – well we can do it for that
[15:12:20 CDT(-0500)] <EricDalquist> as for the parsing out of "/uPortal"
[15:12:33 CDT(-0500)] <EricDalquist> that would probably be best as a property placeholder for now
[15:12:43 CDT(-0500)] <EricDalquist> if we really publish this as an API for portlets
[15:12:53 CDT(-0500)] <EricDalquist> we'll look at providing the portal's context path as a portlet request property
[15:13:19 CDT(-0500)] <EricDalquist> so you could do:
[15:13:19 CDT(-0500)] <EricDalquist> String portalContextPath = portletRequest.getProperty("org.jasig.portal.context_path")
[15:13:32 CDT(-0500)] <drewwills> i think that would be helpful
[15:13:40 CDT(-0500)] <EricDalquist> yeah that is very easy to do
[15:14:00 CDT(-0500)] <drewwills> but doesn't that just help me construct a string like "/uPortal/api/...?"
[15:14:47 CDT(-0500)] <drewwills> I wasn't thinking to make the code in the ApiInvokerImpl uP context specific... doesn't seem like it needs to be
[15:15:12 CDT(-0500)] <EricDalquist> so your client controller should be doing:
[15:15:12 CDT(-0500)] <EricDalquist> invoke(req, res, "/api/person", params)
[15:15:54 CDT(-0500)] <EricDalquist> then your SimpleCrossContextRestApiInvoker (lets assume portlet req/res) does:
[15:16:05 CDT(-0500)] <drewwills> that would be uP specific i think, unless i did <property name="contextName">/uPortal</property>
[15:16:54 CDT(-0500)] <drewwills> (on the SimpleCrossContextRestApiInvoker wiring)
[15:17:01 CDT(-0500)] <EricDalquist> right
[15:17:04 CDT(-0500)] <EricDalquist> it depends on your goals
[15:17:10 CDT(-0500)] <EricDalquist> easy of config or portability
[15:17:17 CDT(-0500)] <EricDalquist> and if you want it callable just from portlets
[15:17:19 CDT(-0500)] <EricDalquist> or from servlets too
[15:17:34 CDT(-0500)] <EricDalquist> if you're talking portlets and easy of config
[15:17:47 CDT(-0500)] <drewwills> yeah let's see how it goes... with time comes greater clarity
[15:18:33 CDT(-0500)] <EricDalquist> your invoker impl does:
[15:18:33 CDT(-0500)] <EricDalquist> String portalContext = req.getProperty("org.jasig.portal.context_path");
[15:18:33 CDT(-0500)] <EricDalquist> ServletContext portalContext = injectedAppContext.getConext(portalContext);
[15:18:33 CDT(-0500)] <EricDalquist> RequestDispatcher rd = portalContext.getRequestDispatcher(uri);
[15:19:01 CDT(-0500)] <EricDalquist> where injectedAppContext is the ServletContext of the caller app injected via the constructor
[15:21:30 CDT(-0500)] <drewwills> roger