Giter Site home page Giter Site logo

docrest's Introduction

Simple Document Repository Using RESTlet

REST architecture basically utilized URI for a restricted set of operation done via HTTP vocabulary. The most common vocabulary is GET, POST, PUT and DELETE. In my current project we need to have a simple way to store and retrieve PDF documents via a web server.

You might ask why I choose to use REST and not simply code a simple PHP upload script. Currently where I work its often difficult to add or install application to a server. I have a web server on Server#1, in which storage is limited and I can't use it to store files other than web pages/scripts. I have another server Server#2 which is a database and processing server that has large amount of free space but doesn't have any web server on it. So I think why not make a simple web server on Server#2 and expose POST/GET API to store/retrieve pdf.

I use Restlets, a simple REST framework build with Java. Using Restlets every URI is represented with a Resources class which will return a Representation if called. For this project I have two REST URI

http://server/docs/ (POST)
http://server/docs/{documentName} (GET)

Its very simple, if I want to upload a document I just need to do a POST with form and <input type="file">. If the operation is successful it will return the file name. For download I would just do a usual get to the specified URL e.g.

GET http://server/docs/sample.pdf HTTP/1.1

or I would just direct my browser to the specified URL. I add a simple listing if you direct your URL to http://server/docs/

docrest's People

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

carsonshan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.