org.openxri.proxy.impl
Class BasicProxy

java.lang.Object
  extended by org.openxri.proxy.impl.BasicProxy
All Implemented Interfaces:
Proxy

public class BasicProxy
extends java.lang.Object
implements Proxy

Provides a servlet implementation for the XRI resolution protocol

Author:
=wil, srinivasa.adapa@neustar.com

Nested Class Summary
protected  class BasicProxy.QueryParams
           
 
Field Summary
static java.lang.String _XRD_M
           
static java.lang.String _XRD_R
           
static java.lang.String _XRD_T
           
protected  java.lang.String bareXRINotFoundRedirect
           
protected  ProxyConfig config
           
static java.lang.String HTTP_ERROR_CONTENT_TYPE
           
static java.lang.String HTTP_XML_CONTENT_TYPE
           
protected static org.apache.commons.logging.Log log
          Static Logging object that can be used by derived classes
static java.lang.String PARAM_URIC
           
protected  Resolver resolver
          The XRI resolver object for the server.
protected  java.lang.String rootRedirect
           
protected  boolean supportRedirect
           
protected  boolean supportURIList
           
protected  boolean supportXRD
           
protected  boolean supportXRDS
           
 
Constructor Summary
BasicProxy(ProxyConfig config)
           
 
Method Summary
protected  java.lang.String buildAbsoluteURL(javax.servlet.http.HttpServletRequest request, java.lang.String relPath)
           
 void init()
           
protected  BasicProxy.QueryParams parseQuery(javax.servlet.http.HttpServletRequest req)
           
 void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Service an incoming request.
protected  void send301(javax.servlet.http.HttpServletResponse response, java.lang.String location)
          Send a 301 HTTP redirect to the client.
protected  void send303(javax.servlet.http.HttpServletResponse response, java.lang.String location)
          Send a 303 HTTP redirect to the client.
protected  void sendFatalError(javax.servlet.http.HttpServletResponse resp, java.lang.String errorMessage)
          This method is called when an unknown error is encountered.
protected  void sendPartialResponse(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String qxri, boolean isDebug, MimeType resMediaType, XRDS partialXRDS, TrustType trustType)
           
protected  void sendResponse(javax.servlet.http.HttpServletResponse response, boolean isDebug, java.lang.String contentType, java.lang.String result, TrustType trustType)
          Send a HTTP response to the client.
protected  void sendResponse(javax.servlet.http.HttpServletResponse response, int statusCode, java.lang.String contentType, java.lang.String result, TrustType trustType)
          Send a HTTP response with the specified status code to the client.
protected  void sendResponse(javax.servlet.http.HttpServletResponse response, java.lang.String contentType, java.lang.String result, TrustType trustType)
          Send a HTTP response to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

protected ProxyConfig config

log

protected static org.apache.commons.logging.Log log
Static Logging object that can be used by derived classes


_XRD_R

public static final java.lang.String _XRD_R
See Also:
Constant Field Values

_XRD_T

public static final java.lang.String _XRD_T
See Also:
Constant Field Values

_XRD_M

public static final java.lang.String _XRD_M
See Also:
Constant Field Values

HTTP_ERROR_CONTENT_TYPE

public static final java.lang.String HTTP_ERROR_CONTENT_TYPE
See Also:
Constant Field Values

HTTP_XML_CONTENT_TYPE

public static final java.lang.String HTTP_XML_CONTENT_TYPE
See Also:
Constant Field Values

PARAM_URIC

public static final java.lang.String PARAM_URIC
See Also:
Constant Field Values

supportXRDS

protected boolean supportXRDS

supportXRD

protected boolean supportXRD

supportURIList

protected boolean supportURIList

supportRedirect

protected boolean supportRedirect

rootRedirect

protected java.lang.String rootRedirect

bareXRINotFoundRedirect

protected java.lang.String bareXRINotFoundRedirect

resolver

protected Resolver resolver
The XRI resolver object for the server. Used for proxied resolution.

Constructor Detail

BasicProxy

public BasicProxy(ProxyConfig config)
Method Detail

init

public void init()
          throws ProxyException
Specified by:
init in interface Proxy
Throws:
ProxyException

process

public void process(javax.servlet.http.HttpServletRequest request,
                    javax.servlet.http.HttpServletResponse response)
Service an incoming request.

Specified by:
process in interface Proxy

buildAbsoluteURL

protected java.lang.String buildAbsoluteURL(javax.servlet.http.HttpServletRequest request,
                                            java.lang.String relPath)

sendFatalError

protected void sendFatalError(javax.servlet.http.HttpServletResponse resp,
                              java.lang.String errorMessage)
This method is called when an unknown error is encountered. This simply outputs the error message in text/plain.

Parameters:
resp -
errorMessage -

sendPartialResponse

protected void sendPartialResponse(javax.servlet.http.HttpServletRequest request,
                                   javax.servlet.http.HttpServletResponse response,
                                   java.lang.String qxri,
                                   boolean isDebug,
                                   MimeType resMediaType,
                                   XRDS partialXRDS,
                                   TrustType trustType)
                            throws java.io.IOException
Throws:
java.io.IOException

send301

protected void send301(javax.servlet.http.HttpServletResponse response,
                       java.lang.String location)
                throws java.io.IOException
Send a 301 HTTP redirect to the client.

Throws:
java.io.IOException

send303

protected void send303(javax.servlet.http.HttpServletResponse response,
                       java.lang.String location)
                throws java.io.IOException
Send a 303 HTTP redirect to the client.

Throws:
java.io.IOException

sendResponse

protected void sendResponse(javax.servlet.http.HttpServletResponse response,
                            boolean isDebug,
                            java.lang.String contentType,
                            java.lang.String result,
                            TrustType trustType)
                     throws java.io.IOException
Send a HTTP response to the client. This method is designed to be overridden by subclasses for user-friendly display of errors.

Parameters:
isDebug - flag to indicate if the client wants text/xml to be returned
Throws:
java.io.IOException

sendResponse

protected void sendResponse(javax.servlet.http.HttpServletResponse response,
                            java.lang.String contentType,
                            java.lang.String result,
                            TrustType trustType)
                     throws java.io.IOException
Send a HTTP response to the client.

Throws:
java.io.IOException

sendResponse

protected void sendResponse(javax.servlet.http.HttpServletResponse response,
                            int statusCode,
                            java.lang.String contentType,
                            java.lang.String result,
                            TrustType trustType)
                     throws java.io.IOException
Send a HTTP response with the specified status code to the client.

Parameters:
response -
statusCode -
contentType -
result -
trustType -
Throws:
java.io.IOException

parseQuery

protected BasicProxy.QueryParams parseQuery(javax.servlet.http.HttpServletRequest req)


Copyright © 2005-2012. All Rights Reserved.