Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#6 Adds new servlet aware context factory

closed
None
5
2007-04-04
2007-03-19
Anonymous
No

I modified the servlet PhpJavaServlet, HttpSessionFacade and added the necessary classes (following the current structure) for creating a context factory.

The main purpose of these changes are that PHP scripts can access applications that runs whitin J2EE server and can only be discovered through servlet context, for example a Spring managed application.

The changes in PhpJavaServlet are minimal, only added a protected method that constructs the context factory.

Discussion

  • Changes

     
    Attachments
    • status: open --> pending
     
  • Logged In: YES
    user_id=1637115
    Originator: NO

    Hi,

    the servlet, servletContext, servletRequest are already protected since 4.0.2.

    I will change the visibility of getContext() and add a hook which allows you to wait for it. The patch is attached.

    Here's the new FAQ entry:

    How can is access the Servlet, ServletContext or ServletRequest from a remote PHP script?
    Unless you write your own servlet, you can't. The default implementation of the PhpJavaServlet does not wait for a RemoteServletContextFactory to finish because it cannot reliably determine if a remote script terminated or not.

    If you can provide this information, override the PhpJavaServlet's getContextFactory(). Provide your own RemoteServletContextFactory and create a custom Context in your createContext() method. Then wait for the context by overriding the waitForContext() method.. Ask yourself how to handle a situation where a script asks for a context but doesn't do anything with it, for example: <?php java_context(); ?>. I it okay that the servlet waits 10 minutes until the orphaned context is destroyed?

    Is that okay?

    File Added: php-java-bridge-4.0.2.patch

     
    • assigned_to: nobody --> jost_boekemeier
     
  • Logged In: YES
    user_id=1637115
    Originator: NO

    File Added: php-java-bridge-4.0.2.patch

     
    • status: pending --> closed
     
  • Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).