-
1. Re: SampleFilter Implementation
ndkhoiits May 3, 2012 3:57 AM (in response to khkh82)You can refer to sample extension here for more detail
-
2. Re: SampleFilter Implementation
khkh82 May 3, 2012 4:06 AM (in response to ndkhoiits)Actually, the problem so far not with this part. As I did it before.
The problem is, I need to access ServletContext from SampleFilter which is you know is extended from org.exoplatform.web.filter.Filter which has only one method doFilter, even initiate method won't be executed. (We can get ServletContext from FilterConfig.getServletContext()).
So, what alternative that's eXo could offer us to handle this peice ?
Thanks
-
3. Re: SampleFilter Implementation
ndkhoiits May 3, 2012 5:18 AM (in response to khkh82)No, I think there is no way to to get ServletContext from your sample filter which extended from org.exoplatform.web.filter.Filter. However, would u like to let me your problem which impacts to your process, Did you want to get servlet context before access to PortalLoginController?
-
4. Re: SampleFilter Implementation
khkh82 May 3, 2012 5:49 AM (in response to ndkhoiits)The problem as following:
I need to do simple integration between java and php by implement php-java-bridge. The main purpose, is just to passing parameter from login jsp page to php corresponding one.
This process should be handle during Servlet (PortalLoginController), but I had got recomendation to adopt SampleFilter for this instead of modify web.xml related files to obtain continuse support.
I did this, follow the procedure step by step. But, ServletContext won't be accessable.
The piece of code is:
HttpServletRequest httpRequest = (HttpServletRequest)request; HttpServletResponse httpResponse = (HttpServletResponse)response; RemoteHttpServletContextFactory ctx = new RemoteHttpServletContextFactory(getServlet(), getFilterConfig().getServletContext(), httpRequest, httpRequest, httpResponse); Besides, at the end of this code I do simple function
ctx.handleRequests(httpRequest.getInputStream(),
httpResponse.getOutputStream());
your support is really appreciated.
-
5. Re: SampleFilter Implementation
ndkhoiits May 3, 2012 5:54 AM (in response to khkh82)Do you know how RemoteHttpServletContextFactory handle ServletContext within? if it's not necessary an instance of ServletContext, would you like to put null value, or PortalContainerContext (extended from ServletContext) instead of
-
6. Re: SampleFilter Implementation
khkh82 May 3, 2012 6:11 AM (in response to ndkhoiits)I'll try this and refer you back.
But, do their any stucks while implementing ctx.handleRequests(httpRequest.getInputStream(),httpResponse.getOutputStream());
I mean, any conflict between this and eXo container lifecycle.?
-
7. Re: SampleFilter Implementation
hoang_to May 3, 2012 7:13 AM (in response to khkh82)Khaldoun Khashan wrote:
I'll try this and refer you back.
But, do their any stucks while implementing ctx.handleRequests(httpRequest.getInputStream(),httpResponse.getOutputStream());
I mean, any conflict between this and eXo container lifecycle.?
There might be conflict ( kind of IllegalStateException as both getOutputStream()/getWriter() are invoked on httpResponse object)
-
8. Re: SampleFilter Implementation
khkh82 Jun 5, 2012 7:13 AM (in response to hoang_to)Minh,
So how could we handle this kind of conflict, as long as GateIn Portal show me Illegal header.