org.objectweb.jac.aspects.gui.web
Class AbstractJacRequest

java.lang.Object
  |
  +--org.objectweb.jac.aspects.gui.web.AbstractJacRequest
All Implemented Interfaces:
JacRequest
Direct Known Subclasses:
MultiMapJacRequest, MultiPartJacRequest

public abstract class AbstractJacRequest
extends Object
implements JacRequest

This class represents a multi-part HttpRequest.


Field Summary
protected static long DEFAULT_REQUEST_TIMEOUT
           
protected  Semaphore semaphore
          The semaphore that blocks the requesting thread until the response is available.
 
Constructor Summary
AbstractJacRequest(HttpServletRequest servletRequest)
           
 
Method Summary
 String getHeader(String name)
          Gets the value of a header.
abstract  Object getParameter(String name)
          Returns a parameter.
 String getUserAgent()
          Returns the user agent of this request
 boolean isIEUserAgent()
          Tells if the user agent of the request is Internet Explorer
 void setParent(JacRequest parent)
           
 void setResponse()
          Unblock a thread that was blocked by a waitForResult call.
 boolean userAgentMatch(String s)
          Tells if the user agent contains a given string
 boolean waitForResponse()
          Makes the current requesting thread block and wait until the response is available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.jac.aspects.gui.web.JacRequest
contains, getParameters
 

Field Detail

semaphore

protected transient Semaphore semaphore
The semaphore that blocks the requesting thread until the response is available.


DEFAULT_REQUEST_TIMEOUT

protected static final long DEFAULT_REQUEST_TIMEOUT
See Also:
Constant Field Values
Constructor Detail

AbstractJacRequest

public AbstractJacRequest(HttpServletRequest servletRequest)
Method Detail

getParameter

public abstract Object getParameter(String name)
Description copied from interface: JacRequest
Returns a parameter. The result can be a String or a FileParameter object.

Specified by:
getParameter in interface JacRequest
Parameters:
name - the name of the parameter
Returns:
the value of the parameter (a String a or FileParameter) if the parameter exists in the request, null otherwise.

isIEUserAgent

public boolean isIEUserAgent()
Description copied from interface: JacRequest
Tells if the user agent of the request is Internet Explorer

Specified by:
isIEUserAgent in interface JacRequest
Returns:
true if the user agent is Internet Explorer, false otherwise
See Also:
JacRequest.userAgentMatch(String)

getUserAgent

public String getUserAgent()
Description copied from interface: JacRequest
Returns the user agent of this request

Specified by:
getUserAgent in interface JacRequest
Returns:
the user agent of this request

userAgentMatch

public boolean userAgentMatch(String s)
Description copied from interface: JacRequest
Tells if the user agent contains a given string

Specified by:
userAgentMatch in interface JacRequest
Parameters:
s - string to be searched in user agent
Returns:
true if the user agent is Internet Explorer, false otherwise

getHeader

public String getHeader(String name)
Description copied from interface: JacRequest
Gets the value of a header.

Specified by:
getHeader in interface JacRequest
Parameters:
name - name of the header
Returns:
the value of the header

setParent

public void setParent(JacRequest parent)

waitForResponse

public boolean waitForResponse()
Description copied from interface: JacRequest
Makes the current requesting thread block and wait until the response is available.

The thread that call this method waits until a call to setResponse occurs or a timeout occurs.

Specified by:
waitForResponse in interface JacRequest
Returns:
false if a timeout occured, true otherwise.
See Also:
JacRequest.setResponse()

setResponse

public void setResponse()
Description copied from interface: JacRequest
Unblock a thread that was blocked by a waitForResult call.

Specified by:
setResponse in interface JacRequest
See Also:
JacRequest.waitForResponse()