org.universAAL.ui.resource.server
Class ResourceServer
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.universAAL.ui.resource.server.ResourceServer
- All Implemented Interfaces:
- Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
public class ResourceServer
- extends javax.servlet.http.HttpServlet
Resource Server receives GET and POST requests and exposes/serves requested
resources from the common resources storage.
One of the usage scenarios of this artefact is following: UI Handlers that
are not always on the same node can, by using this server, obtain common
(also application specific) resources. Since universAAL middleware does not
have the capability to transfer binary files UI Handlers can obtain icons and
other media types and connect them with the abstract UI representations
comming from the applications. This way application developers can store
specific resources into the common folder and then simply add their names to
the abstract UI representations. The job of the UI Handlers is to merge this
resources with the rendered user interfaces.
- Author:
- Andrej Grguric
- See Also:
- Serialized Form
Method Summary |
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
|
protected void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
|
String |
getMimeType(String name)
Determine mime type of the resource. |
boolean |
isAuthorized(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Checks if the resource Requester is authorized to access resource |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
confHome
public static File confHome
PATH_TO_RESOURCES
public static String PATH_TO_RESOURCES
- Path to resources; e.g. ...runner\configurations\ResourceServer
ResourceServer
public ResourceServer(ModuleContext mcontext)
getMimeType
public String getMimeType(String name)
- Determine mime type of the resource. If resource type is not recognized
(between gif, png, jpg, jpeg, xml, au, aa3, aac, aif, al, mp4, mpeg) null
is returned.
- Parameters:
name
- resoruce name
- Returns:
- mime type
doGet
protected void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
- Overrides:
doGet
in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
isAuthorized
public boolean isAuthorized(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
- Checks if the resource Requester is authorized to access resource
- Parameters:
req
- The requestresp
- The response
doPost
protected void doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
- Overrides:
doPost
in class javax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
IOException
Copyright © 2014 universAAL Consortium. All Rights Reserved.