Package de.fuberlin.wiwiss.pubby

Examples of de.fuberlin.wiwiss.pubby.HypermediaControls


  @Override
  protected boolean doGet(String relativeURI,
      HttpServletRequest request,
      HttpServletResponse response,
      Configuration config) throws IOException {
    HypermediaControls controller = config.getControls(relativeURI, false);

    ResourceDescription description = controller == null ?
        null : controller.getResourceDescription();
    // Check if resource exists in dataset
    if (description == null) {
      response.setStatus(404);
      response.setContentType("text/plain");
      response.getOutputStream().println("Nothing known about <" + controller.getAbsoluteIRI() + ">");
      return true;
    }
    Model model = description.getModel();
   
    addHighDegreePropertyLinks(model, controller);
   
    addDocumentMetadata(model, controller,
        addQueryString(controller.getDataURL(), request),
        "RDF description of " + description.getTitle());
   
    ModelResponse server = new ModelResponse(model, request, response);
    server.serve();
    return true;
View Full Code Here


      relativeURI = matcher.group(3)// Keep just last part
      property = ResourceFactory.createProperty(propertyIRI);
    }
    isInverse = "-".equals(matcher.group(1));
   
    HypermediaControls controller = config.getControls(relativeURI, false);
    if (controller == null) {
      return false;
    }
    return doGet(controller, property, isInverse, request, response, config);
  }
View Full Code Here

public class WebURIServlet extends BaseServlet {

  public boolean doGet(String relativeURI, HttpServletRequest request,
      HttpServletResponse response, Configuration config) throws IOException {
   
    HypermediaControls controller = config.getControls(relativeURI, true);
    // It's a resource with an IRI we can't handle
    if (controller == null) return false;
    // It's a resource that's not in our namespace.
    // We don't provide a 303 service for those, only browsable pages.
    if (!controller.isHosted()) return false;

    response.addHeader("Vary", "Accept, User-Agent");
    ContentTypeNegotiator negotiator = PubbyNegotiator.getPubbyNegotiator();
    MediaRangeSpec bestMatch = negotiator.getBestMatch(
        request.getHeader("Accept"), request.getHeader("User-Agent"));
    if (bestMatch == null) {
      response.setStatus(406);
      response.setContentType("text/plain");
      response.getOutputStream().println(
          "406 Not Acceptable: The requested data format is not supported. " +
          "Only HTML and RDF are available.");
      return true;
    }
   
    response.setStatus(303);
    response.setContentType("text/plain");
    String location;
    if ("text/html".equals(bestMatch.getMediaType())) {
      location = controller.getPageURL();
    } else {
      location = controller.getDataURL();
    }
    response.addHeader("Location", IRIEncoder.toURI(location));
    response.getOutputStream().println(
        "303 See Other: For a description of this item, see " + location);
    return true;
View Full Code Here

  public boolean doGet(String relativeURI,
      HttpServletRequest request,
      HttpServletResponse response,
      Configuration config) throws ServletException, IOException {

    HypermediaControls controller = config.getControls(relativeURI, false);
    if (controller == null) return false;
    ResourceDescription description = controller.getResourceDescription();
    if (description == null) return false;
   
    VelocityHelper template = new VelocityHelper(getServletContext(), response);
    Context context = template.getVelocityContext();
    context.put("project_name", config.getProjectName());
    context.put("project_link", config.getProjectLink());
    context.put("uri", description.getURI());
    context.put("server_base", config.getWebApplicationBaseURI());
    context.put("rdf_link", controller.getDataURL());
    context.put("title", description.getTitle());
    context.put("comment", description.getComment());
    context.put("image", description.getImageURL());
    context.put("properties", description.getProperties());
    context.put("showLabels", config.showLabels());
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.pubby.HypermediaControls

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.