{"id":13805709,"url":"https://github.com/bazaarvoice/dropwizard-redirect-bundle","last_synced_at":"2025-05-13T19:31:55.515Z","repository":{"id":5733124,"uuid":"6945118","full_name":"bazaarvoice/dropwizard-redirect-bundle","owner":"bazaarvoice","description":"A simple bundle for DropWizard that allows for HTTP redirects","archived":true,"fork":false,"pushed_at":"2022-03-09T15:21:49.000Z","size":26,"stargazers_count":13,"open_issues_count":0,"forks_count":5,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-08-04T01:05:21.370Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bazaarvoice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-11-30T20:21:45.000Z","updated_at":"2023-01-28T02:29:55.000Z","dependencies_parsed_at":"2022-09-10T23:12:51.419Z","dependency_job_id":null,"html_url":"https://github.com/bazaarvoice/dropwizard-redirect-bundle","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Fdropwizard-redirect-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Fdropwizard-redirect-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Fdropwizard-redirect-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazaarvoice%2Fdropwizard-redirect-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bazaarvoice","download_url":"https://codeload.github.com/bazaarvoice/dropwizard-redirect-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225254370,"owners_count":17445172,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T01:01:04.065Z","updated_at":"2024-11-18T21:31:35.729Z","avatar_url":"https://github.com/bazaarvoice.png","language":"Java","funding_links":[],"categories":["Open Source"],"sub_categories":["Eclipse"],"readme":"**NOTE: THIS PROJECT IS DEPRECATED.** This projects is no longer maintained.  It is deprecated for\n[dropwizard-bundles maintained fork](https://github.com/dropwizard-bundles/dropwizard-redirect-bundle).\nUsers of this project should update their project dependencies appropriately.\n\nGetting Started\n===============\n\nJust add this maven dependency:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.bazaarvoice.dropwizard\u003c/groupId\u003e\n  \u003cartifactId\u003edropwizard-redirect-bundle\u003c/artifactId\u003e\n  \u003cversion\u003e0.4.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n- For Dropwizard 0.6.2: use version \u003c 0.3.0\n- For Dropwizard 0.7.0: use version \u003e= 0.3.0\n\nTo redirect one path to another path:\n```java\npublic class MyApplication extends Application\u003c...\u003e {\n  // ...\n\n  @Override\n  public void initialize(Bootstrap\u003c?\u003e bootstrap) {\n    bootstrap.addBundle(new RedirectBundle(\n      new PathRedirect(\"/old\", \"/new\")\n    ));\n  }\n\n  // ...\n}\n```\n\nTo redirect many paths at once:\n```java\npublic class MyApplication extends Application\u003c...\u003e {\n  // ...\n\n  @Override\n  public void initialize(Bootstrap\u003c?\u003e bootstrap) {\n    bootstrap.addBundle(new RedirectBundle(\n      new PathRedirect(ImmutableMap.\u003cString, String\u003ebuilder()\n        .put(\"/old1\", \"/new1\")\n        .put(\"/old2\", \"/new2\")\n        .build())\n    ));\n  }\n\n  // ...\n}\n```\n\nTo redirect non-HTTPS traffic to the HTTPS port:\n```java\npublic class MyApplication extends Application\u003c...\u003e {\n  // ...\n\n  @Override\n  public void initialize(Bootstrap\u003c?\u003e bootstrap) {\n    bootstrap.addBundle(new RedirectBundle(\n      new HttpsRedirect()\n    ));\n  }\n\n  // ...\n}\n```\n\nFor more advanced users, there is also a regular expression based redirector that has access to the full URI.  This\noperates in a similar fashion to the mod-rewrite module for Apache:\n```java\npublic class MyApplication extends Application\u003c...\u003e {\n  // ...\n\n  @Override\n  public void initialize(Bootstrap\u003c?\u003e bootstrap) {\n    bootstrap.addBundle(new RedirectBundle(\n      new UriRedirect(\"(.*)/welcome.html$\", \"$1/index.html\")\n    ));\n  }\n\n  // ...\n}\n```\n\nIf you have to combine http to https redirect and path redirect at the same time, then you want to do the following:\n```java\npublic class MyApplication extends Application\u003c...\u003e {\n  // ...\n\n  @Override\n  public void initialize(Bootstrap\u003c?\u003e bootstrap) {\n    bootstrap.addBundle(new RedirectBundle(\n        bootstrap.addBundle(new RedirectBundle(new PathRedirect(\"/\", \"docs\"), new HttpsRedirect()));\n    ));\n  }\n\n  // ...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazaarvoice%2Fdropwizard-redirect-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbazaarvoice%2Fdropwizard-redirect-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazaarvoice%2Fdropwizard-redirect-bundle/lists"}