info.sswap.http.rest
Class DefaultResource

java.lang.Object
  extended by info.sswap.http.rest.DefaultResource

public class DefaultResource
extends java.lang.Object

A default, catch-all resource that is used to serve static content (e.g., man-pages) or to generate a 404 HTTP message if there is no other resource found.

Author:
Blazej Bulka

Field Summary
private static java.util.Map<java.lang.String,javax.ws.rs.core.MediaType> EXTENSION_MEDIA_TYPE_MAP
          Maps extensions (lower case) onto corresponding MediaTypes
private static org.apache.log4j.Logger LOGGER
          The logger for the makeType task.
private static java.lang.String MAN_PAGES_ROOT
          The root of the man pages
 
Constructor Summary
DefaultResource()
           
 
Method Summary
private static java.lang.String getExtension(java.lang.String path)
          Gets the extension from the path
 javax.ws.rs.core.Response serve(java.lang.String path)
          Produces the content of a static resource or NotFoundException if there is no corresponding resource
static javax.ws.rs.core.Response serveStaticResource(java.lang.String path)
          A static method for serving content (so that it can be called by other RESTful resources easily).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.apache.log4j.Logger LOGGER
The logger for the makeType task.


MAN_PAGES_ROOT

private static final java.lang.String MAN_PAGES_ROOT
The root of the man pages

See Also:
Constant Field Values

EXTENSION_MEDIA_TYPE_MAP

private static final java.util.Map<java.lang.String,javax.ws.rs.core.MediaType> EXTENSION_MEDIA_TYPE_MAP
Maps extensions (lower case) onto corresponding MediaTypes

Constructor Detail

DefaultResource

public DefaultResource()
Method Detail

serve

public javax.ws.rs.core.Response serve(java.lang.String path)
Produces the content of a static resource or NotFoundException if there is no corresponding resource

Parameters:
path - the value of the path URI parameter

serveStaticResource

public static javax.ws.rs.core.Response serveStaticResource(java.lang.String path)
A static method for serving content (so that it can be called by other RESTful resources easily).

Parameters:
path - the path to be served
Returns:
the response

getExtension

private static java.lang.String getExtension(java.lang.String path)
Gets the extension from the path

Parameters:
path - the path
Returns:
the extension


Copyright (c) 2010, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.