dk.netarkivet.viewerproxy.distribute
Class HTTPControllerClient

java.lang.Object
  extended by dk.netarkivet.viewerproxy.distribute.HTTPControllerClient
All Implemented Interfaces:
Controller

public class HTTPControllerClient
extends java.lang.Object
implements Controller

Client side communication with http controller server. This class works on a specific response object, simply forwarding it to the given url. Thus an instance of this class is a use-once-object. The class is supposed to be used in JSP pages in order to make sure that the remote URI is requested through the browser, so communication with the HTTPControllerServer is done to the one currently set as viewer proxy.


Constructor Summary
HTTPControllerClient(javax.servlet.http.HttpServletResponse response, javax.servlet.jsp.JspWriter out, java.lang.String returnURL)
          Make an HTTP controller client.
 
Method Summary
 void changeIndex(java.util.Set<java.lang.Long> jobList, java.lang.String label)
          Change current index to work on these jobs.
 void clearRecordedURIs()
          Clear recorded URIs and return to return URL.
 java.util.Set<java.net.URI> getRecordedURIs()
          Write recorded URIs to response.
 java.lang.String getStatus(java.util.Locale locale)
          Write the current status of viewerproxy to response.
 void startRecordingURIs()
          Start recording URIs and return to return URL.
 void stopRecordingURIs()
          Stop recording URIs and return to return URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPControllerClient

public HTTPControllerClient(javax.servlet.http.HttpServletResponse response,
                            javax.servlet.jsp.JspWriter out,
                            java.lang.String returnURL)
Make an HTTP controller client. Commands are sent using redirect on the given http response object. For commands with no output, the page is then forwarded to the response url.

Parameters:
response - The response object to use for redirect.
out - The JspWriter used to communicate with the users.
returnURL - The URL to return to afterwards if no output is given. This must not be null or not empty if either startRecordingURIs, stopRecordingURIs, changeIndex or clearRecordedURIs are called.
Method Detail

startRecordingURIs

public void startRecordingURIs()
Start recording URIs and return to return URL.

Specified by:
startRecordingURIs in interface Controller

stopRecordingURIs

public void stopRecordingURIs()
Stop recording URIs and return to return URL.

Specified by:
stopRecordingURIs in interface Controller

clearRecordedURIs

public void clearRecordedURIs()
Clear recorded URIs and return to return URL.

Specified by:
clearRecordedURIs in interface Controller

getRecordedURIs

public java.util.Set<java.net.URI> getRecordedURIs()
Write recorded URIs to response. NOTE! This does not respect the Controller! The URIs are *not* returned!

Specified by:
getRecordedURIs in interface Controller
Returns:
null in all cases. The URIs are written in response by the forwarded call instead.

changeIndex

public void changeIndex(java.util.Set<java.lang.Long> jobList,
                        java.lang.String label)
Change current index to work on these jobs. Then return to returnURL. Since post data cannot be transferred through a regular redirect, we instead build a page that uses javascript to immediately repost the data to the url.

Specified by:
changeIndex in interface Controller
Parameters:
jobList - The list of jobs.
label - An arbitrary label that will be used to indicate this index

getStatus

public java.lang.String getStatus(java.util.Locale locale)
Write the current status of viewerproxy to response. NOTE! This does not respect the Controller API! The URIs are *not* returned!

Specified by:
getStatus in interface Controller
Parameters:
locale - The locale (da, en, ...) that the response should be written using.
Returns:
null. The status is written in response by the forwarded call instead.