Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## php.java.bridge.http
Class ContextServer

    java.lang.Object
      php.java.bridge.http.ContextServer

    public final class ContextServer

extends java.lang.Object

A bridge pattern which either uses the PipeContextServer or the SocketContextServer, depending on the OS and/or the security restrictions.

A ContextServer instance represents the current web context. There can be more than one ContextServer instance per classloader, but the ContextFactory.get() checks if it is called with the same ContextServer and throws a SecurityException otherwise. So one cannot access contexts belonging to other ContextServers.

Author:
  jostb
See Also:
  `PipeContextServer`, `SocketContextServer`

Constructor Summary
`ContextServer(ThreadPool pool)` Create a new ContextServer using a thread pool.

Method Summary
`void` | `destroy()` Destroy the pipe or socket context server.
`IContextServer.ChannelName` | `getFallbackChannelName(java.lang.String channelName, java.lang.String kontext, IContextFactory currentCtx)` Return the channelName which be passed to the client as X_JAVABRIDGE_REDIRECT
`boolean` | `isAvailable(java.lang.String channelName)` Check if either the pipe of the socket context server is available.
`void` | `recycle(IContextServer.ChannelName channelName)` Recycle a ContextRunner, if possible.
`ContextRunner` | `schedule(IContextServer.ChannelName channelName)` Check for a ContextRunner for channelName
`void` | `start(IContextServer.ChannelName channelName)` Start a channel name.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ContextServer

    public ContextServer(ThreadPool pool)

  Create a new ContextServer using a thread pool.

  Parameters:
    `pool` - The thread pool.

Method Detail

### destroy

    public void destroy()

  Destroy the pipe or socket context server.

### isAvailable

    public boolean isAvailable(java.lang.String channelName)

  Check if either the pipe of the socket context server is available. This function may try start a SocketContextServer, if a PipeContextServer is not available.

  Parameters:
    `channelName` - The header value for X_JAVABRIDGE_CHANNEL, may be null.
  Returns:
    true if either the pipe or the socket context server is available.

### start

    public void start(IContextServer.ChannelName channelName)

  Start a channel name.

  Parameters:
    `channelName` - The ChannelName.
  Throws:
    `java.lang.IllegalStateException` - if there's no Pipe- or SocketContextServer available

### schedule

    public ContextRunner schedule(IContextServer.ChannelName channelName)

  Check for a ContextRunner for channelName

  Parameters:
    `channelName` - The ChannelName
  Returns:
    The ContextRunner or null.

### recycle

    public void recycle(IContextServer.ChannelName channelName)

  Recycle a ContextRunner, if possible.

  Parameters:
    `channelName` - The ChannelName.

### getFallbackChannelName

    public IContextServer.ChannelName getFallbackChannelName(java.lang.String channelName,
                                                             java.lang.String kontext,
                                                             IContextFactory currentCtx)

  Return the channelName which be passed to the client as X_JAVABRIDGE_REDIRECT

  Parameters:
    `channelName` - The name of the channel, see X_JAVABRIDGE_CHANNEL
    `kontext` - The name of the client's default ContextFactory, see X_JAVABRIDGE_CONTEXT_DEFAULT
    `currentCtx` - The current ContextFactory, see X_JAVABRIDGE_CONTEXT
  Returns:
    The channel name of the Pipe- or SocketContextServer.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD