Java Code Examples for java.net.httpurlconnection#HTTP_FORBIDDEN

The following examples show how to use java.net.httpurlconnection#HTTP_FORBIDDEN . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PickServerFragment.java    From android-vlc-remote with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onHostFound(String hostname, int responseCode) {
    Server server = new Server(hostname + ":" + mPort, responseCode);
    switch (responseCode) {
        case HttpURLConnection.HTTP_OK:
        case HttpURLConnection.HTTP_FORBIDDEN:
        case HttpURLConnection.HTTP_UNAUTHORIZED:
            if (!mRemembered.containsKey(server.getUri().getAuthority()) && getActivity() != null) {
                Preference preference = createServerPreference(server);
                mProgressCategory.addPreference(preference);
            }
            break;
        default:
            Log.d(TAG, "Unexpected response code: " + responseCode);
            break;
    }
}
 
Example 2
Source File: ServerConnectionTest.java    From android-vlc-remote with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onPostExecute(Integer result) {
    switch(result) {
        case HttpURLConnection.HTTP_UNAUTHORIZED:
            Toast.makeText(context, R.string.server_unauthorized, Toast.LENGTH_SHORT).show();
            break;
        case HttpURLConnection.HTTP_FORBIDDEN:
            Toast.makeText(context, R.string.server_forbidden, Toast.LENGTH_SHORT).show();
            break;
        case HttpURLConnection.HTTP_OK:
            Toast.makeText(context, R.string.server_ok, Toast.LENGTH_SHORT).show();
            break;
        default:
            Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show();
    }
}
 
Example 3
Source File: PaymentFileManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 6 votes vote down vote up
@PUT
@Path("/{id}/payments/{referenceUid}/confirmfile")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "upload PaymentFile")
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns"),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response updatePaymentFileConfirm(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, 
		@ApiParam(value = "id of payments", required = true) @PathParam("id") String id,
		@ApiParam(value = "reference of paymentFile", required = true) @PathParam("referenceUid") String referenceUid,
		@ApiParam(value = "Attachment files") @Multipart("file") Attachment file/*,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("confirmNote") String confirmNote,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("paymentMethod") String paymentMethod,
		@ApiParam(value = "Metadata of PaymentFile") @Multipart("confirmPayload") String confirmPayload*/);
 
Example 4
Source File: DossierManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@GET
@Path("/{id}/mermaidgraph")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get the detail of Dossier by its id (or referenceId)", response = DossierDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a list of Dossiers have been filtered", response = DossierDetailModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response getMermaidGraphDetailDossier(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") String id);
 
Example 5
Source File: RegistrationTemplatesManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@GET
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get all registrationtemplates", response = RegistrationTemplatesResultsModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a list of all registrationtemplates", response = RegistrationTemplatesResultsModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response getRegistrationTemplates(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, 
		@QueryParam("formNo") String formNo,
		@QueryParam("govAgencyCode") String govAgencyCode);
 
Example 6
Source File: DossierManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@POST
@Path("/{id}/fixSyncContact")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get a list of assign users", response = DossierResultsModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a list of assign users have been filtered", response = DossierResultsModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response fixSyncContactDossier(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") String id);
 
Example 7
Source File: DossierManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@POST
@Path("/{id}/goto/{stepCode}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Add a Dossier", response = DossierDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a Dossier was created", response = DossierDetailModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response gotoStep(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") String id, @PathParam("stepCode") String stepCode);
 
Example 8
Source File: UserInfoLogManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED})
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = ""),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })
public Response addUserLog(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext, 
		@BeanParam UserInfoLogInputModel input);
 
Example 9
Source File: FileBasedCredentialsService.java    From hono with Eclipse Public License 2.0 5 votes vote down vote up
private void verifyOverwriteEnabled(final Span span) {

        // check if we may overwrite
        if (!config.isModificationEnabled()) {
            TracingHelper.logError(span, "Modification is disabled for the Credentials service.");
            throw new ClientErrorException(HttpURLConnection.HTTP_FORBIDDEN);
        }
    }
 
Example 10
Source File: PaymentConfigManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@GET
@Path("/{id}/epaymentconfig")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get the epaymentconfig", response = PaymentConfigSingleInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns epaymentconfig of PaymentConfig", response = PaymentConfigSingleInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response getEpaymentconfig(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id);
 
Example 11
Source File: DossierActionManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@GET
@Path("/{id}/nextactions/{actionId}/payload")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get List Actions", response = ActionResultModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns list action can be executed", response = ActionResultModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response getActionPayload(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @BeanParam DossierActionSearchModel query,
		@PathParam("id") String id, @PathParam("actionId") String actionId);
 
Example 12
Source File: DossierManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@GET
@Path("/processing/getInfoDossier")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get a list of Dossiers", response = DossierResultsModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a list of Dossiers have been filtered", response = DossierResultsModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response getDossiersInfoList(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @BeanParam DossierSearchModel query);
 
Example 13
Source File: SystemManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@POST
@Path("/clean/{siteId}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Clean a site", response = BackgroundTaskResult.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a background was created", response = BackgroundTaskResult.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response cleanSite(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("siteId") Long siteId);
 
Example 14
Source File: DossierManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@PUT
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Update a Dossier", response = DossierDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a Dossier was updated", response = DossierDetailModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response updateDossier(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id, @BeanParam DossierInputModel input);
 
Example 15
Source File: ServiceProcessManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@DELETE
@Path("/{id}/roles/{roleid}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Remove a ServiceProcessRole of a ServiceProcess", response = RoleInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a ServiceProcessRole was deleted", response = RoleInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })

public Response removeServiceProcessRole(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id, @PathParam("roleid") long roleid);
 
Example 16
Source File: ServiceConfigManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@POST
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Add ServiceConfig", response = ServiceConfigInputModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a ServiceConfig entity was added", response = ServiceConfigInputModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response addServiceConfig(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "body params for post") @BeanParam ServiceConfigInputModel input);
 
Example 17
Source File: DossierTemplateManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@GET
@Path("/{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "Get a DossierTemplate", response = DossierTemplateDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns detail of DossierTemplate", response = DossierTemplateDetailModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Internal error", response = ExceptionModel.class) })

public Response getDossierTemplateDetail(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") String id, @Context Request requestCC);
 
Example 18
Source File: ServiceConfigManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@GET
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation(value = "Get a ServiceConfig by id", response = ServiceConfigDetailModel.class)
@ApiResponses(value = {
		@ApiResponse(code = HttpURLConnection.HTTP_OK, message = "Returns a ServiceConfig", response = ServiceConfigDetailModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_UNAUTHORIZED, message = "Unauthorized", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Not found", response = ExceptionModel.class),
		@ApiResponse(code = HttpURLConnection.HTTP_FORBIDDEN, message = "Access denied", response = ExceptionModel.class) })
public Response getServiceConfig(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "serviceconfigId for get detail") @PathParam("id") long input);
 
Example 19
Source File: Jobs.java    From sfs with Apache License 2.0 4 votes vote down vote up
public JobMustRunOnMaster() {
    super(HttpURLConnection.HTTP_FORBIDDEN);
}
 
Example 20
Source File: Request.java    From metrics_publish_java with MIT License 2 votes vote down vote up
/**
 * Checks if the agent has been remotely disabled by the Collector.
 * A 403 response code (HTTP_FORBIDDEN) with DISABLE_NEW_RELIC as the response body
 * indicate that the agent should be remotely disabled.
 * @param responseCode
 * @param responseBody
 * @return boolean
 */
private boolean isRemotelyDisabled(int responseCode, String responseBody) {
    return responseCode == HttpURLConnection.HTTP_FORBIDDEN && DISABLE_NEW_RELIC.equals(responseBody);
}