# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import vertx from core.file_system import FileSystem from core.streams import Pump client = vertx.create_http_client() client.port = 8080 client.host = "localhost" fs = vertx.file_system() def response_handler(resp): print "Response %d" % resp.status_code req = client.put("/someurl", response_handler) filename = "upload/upload.txt" def file_props(err, props): print "in file_props" req.put_header("Content-Length", "%s" % props.size) def open_handler(err, file):
import vertx from core.event_bus import EventBus from core.file_system import FileSystem from core.http import RouteMatcher from server import upload from server import file_service #inicialize server = vertx.create_http_server() route_matcher = RouteMatcher() logger = vertx.logger() fs = vertx.file_system() app_config = vertx.config() #set global path_web = app_config['paths']['web'] path_public = app_config['paths']['path_public'] path_symlink = app_config['paths']['path_symlink'] #cros module variable ##TODO upload.path_public = path_public file_service.path_public = path_public file_service.path_private = app_config['paths']['path_private'] upload.path_symlink = path_symlink upload.path_upload = app_config['paths']['path_private'] upload.path_temp = app_config['paths']['path_temp'] def index_handler(req): req.response.send_file( "%sindex.html"% path_web)