org.openbp.common.resource
Class HttpResourceProvider

java.lang.Object
  extended by org.openbp.common.resource.ResourceProvider
      extended by org.openbp.common.resource.HttpResourceProvider

public class HttpResourceProvider
extends ResourceProvider

Provides access to resources using a HTTP connection.

Author:
Heiko Erhardt

Field Summary
 
Fields inherited from class org.openbp.common.resource.ResourceProvider
PROTOCOL_PREFIX_SEPARATOR, resourceLoader
 
Constructor Summary
protected HttpResourceProvider(int priority, org.springframework.core.io.ResourceLoader resourceLoader, java.lang.String protocol, java.lang.String host, java.lang.String port)
          Constructor.
 
Method Summary
 java.lang.String applyPrefix(java.lang.String resourceLocation)
          Applies the protocl prefix to the given resource location.
 java.lang.String getHost()
          Gets the host (e. g.
 java.lang.String getPort()
          Gets the port (e. g. "8080").
 java.lang.String getProtocol()
          Gets the protocol (e. g.
 org.springframework.core.io.Resource getResource(java.lang.String resourceLocation)
          Gets a resource.
 java.lang.String getUrlPrefix()
           
 void setHost(java.lang.String host)
          Sets the host (e. g.
 void setPort(java.lang.String port)
          Sets the port (e. g. "8080").
 void setProtocol(java.lang.String protocol)
          Sets the protocol (e. g.
 java.lang.String toString()
           
 
Methods inherited from class org.openbp.common.resource.ResourceProvider
getPrefix, getPriority, getResourceLoader, hasPrefix, setPriority, setResourceLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpResourceProvider

protected HttpResourceProvider(int priority,
                               org.springframework.core.io.ResourceLoader resourceLoader,
                               java.lang.String protocol,
                               java.lang.String host,
                               java.lang.String port)
Constructor.

Parameters:
priority - Priority of the provider
resourceLoader - Resource loader
protocol - Protocol (e. g. "http")
host - Host (e. g. "localhost")
port - Port (e. g. "8080")
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getUrlPrefix

public java.lang.String getUrlPrefix()

getResource

public org.springframework.core.io.Resource getResource(java.lang.String resourceLocation)
                                                 throws ResourceMgrException
Description copied from class: ResourceProvider
Gets a resource.

Specified by:
getResource in class ResourceProvider
Parameters:
resourceLocation - Resource location
Returns:
The resource
Throws:
ResourceMgrException - If the provider is unable to find the specified resource

applyPrefix

public java.lang.String applyPrefix(java.lang.String resourceLocation)
Applies the protocl prefix to the given resource location. The HttpResourceProvider needs to separate the prefix from the resource name by "/" e.g.: https://localhost:8080 + '/' + resourceName

Overrides:
applyPrefix in class ResourceProvider
Parameters:
resourceLocation - Resource
Returns:
The resource location, prefixed by the prefix of the provider (e. h. "file:")

getProtocol

public java.lang.String getProtocol()
Gets the protocol (e. g. "http").


setProtocol

public void setProtocol(java.lang.String protocol)
Sets the protocol (e. g. "http").


getHost

public java.lang.String getHost()
Gets the host (e. g. "localhost").


setHost

public void setHost(java.lang.String host)
Sets the host (e. g. "localhost").


getPort

public java.lang.String getPort()
Gets the port (e. g. "8080").


setPort

public void setPort(java.lang.String port)
Sets the port (e. g. "8080").



Copyright © 2011. All Rights Reserved.