javax.ws.rs.FormParam Java Examples

The following examples show how to use javax.ws.rs.FormParam. 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: Index.java    From json-schema-validator-demo with GNU Lesser General Public License v3.0 7 votes vote down vote up
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public static Response validate(
    @FormParam("input") final String schema,
    @FormParam("input2") final String data
)
{
    if (schema == null || data == null)
        return BAD;
    try {
        final JsonNode ret = buildResult(schema, data);
        return Response.ok().entity(ret.toString()).build();
    } catch (IOException e) {
        log.error("I/O error while validating data", e);
        return OOPS;
    }
}
 
Example #2
Source File: CartApi.java    From commerce-cif-api with Apache License 2.0 6 votes vote down vote up
@POST
@Path("/{id}/entries")
@ApiOperation(value = "Adds a new cart entry to an existing cart.")
@ApiResponses(value = {
    @ApiResponse(code = HTTP_CREATED, message = HTTP_CREATED_MESSAGE, response = Cart.class,
            responseHeaders = @ResponseHeader(name = "Location", description = "Location of the newly created cart entry.", response = String.class)),
    @ApiResponse(code = HTTP_BAD_REQUEST, message = HTTP_BAD_REQUEST_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_FORBIDDEN, message = HTTP_FORBIDDEN_MESSAGE, response = ErrorResponse.class),
    @ApiResponse(code = HTTP_NOT_FOUND, message = HTTP_NOT_FOUND_MESSAGE, response = ErrorResponse.class)
})
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
Cart postCartEntry(
    @ApiParam(value = "The ID of the cart for the new entry", required = true)
    @PathParam("id") String id,

    @ApiParam(value = "The product variant id to be added to the cart entry. If product variant exists in the" +
        " cart then the cart entry quantity is increased with the provided quantity.", required = true)
    @FormParam("productVariantId") String productVariantId,

    @ApiParam(value = "The quantity for the new entry.", required = true)
    @FormParam("quantity")
    @Min(value = 0) int quantity,

    @ApiParam(value = ACCEPT_LANGUAGE_DESC)
    @HeaderParam(ACCEPT_LANGUAGE) String acceptLanguage);
 
Example #3
Source File: ModelBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * <strong>Administrator credentials required.</strong> Copy a model
 *
 * @param name
 *            model to copy
 * @param newName
 *            name of copied model
 * @param modelTableName
 *            name of the table that contains the model
 * @return datawave.webservice.result.VoidResponse
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
 *
 * @HTTP 200 success
 * @HTTP 204 model not found
 * @HTTP 500 internal server error
 */
@POST
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/clone")
@GZIP
@RolesAllowed({"Administrator", "JBossAdministrator"})
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public VoidResponse cloneModel(@Required("name") @FormParam("name") String name, @Required("newName") @FormParam("newName") String newName,
                @FormParam("modelTableName") String modelTableName) {
    VoidResponse response = new VoidResponse();
    
    if (modelTableName == null) {
        modelTableName = defaultModelTableName;
    }
    
    datawave.webservice.model.Model model = getModel(name, modelTableName);
    // Set the new name
    model.setName(newName);
    importModel(model, modelTableName);
    return response;
}
 
Example #4
Source File: ConstraintViolationMetadata.java    From ozark with Apache License 2.0 6 votes vote down vote up
public Optional<String> getParamName() {
    for (Annotation annotation : annotations) {
        if (annotation instanceof QueryParam) {
            return Optional.of(((QueryParam) annotation).value());
        }
        if (annotation instanceof PathParam) {
            return Optional.of(((PathParam) annotation).value());
        }
        if (annotation instanceof FormParam) {
            return Optional.of(((FormParam) annotation).value());
        }
        if (annotation instanceof MatrixParam) {
            return Optional.of(((MatrixParam) annotation).value());
        }
        if (annotation instanceof CookieParam) {
            return Optional.of(((CookieParam) annotation).value());
        }
    }
    return Optional.empty();
}
 
Example #5
Source File: Persons.java    From jaxrs-beanvalidation-javaee7 with Apache License 2.0 6 votes vote down vote up
@POST
@Path("create")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response createPerson(
        @FormParam("id")
        @NotNull(message = "{person.id.notnull}")
        @Pattern(regexp = "[0-9]+", message = "{person.id.pattern}")
        String id,
        @FormParam("name")
        @Size(min = 2, max = 50, message = "{person.name.size}")
        String name) {
    Person person = new Person();
    person.setId(Integer.valueOf(id));
    person.setName(name);
    persons.put(id, person);
    return Response.status(Response.Status.CREATED).entity(person).build();
}
 
Example #6
Source File: DigitalObjectResource.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
@POST
@Path(DigitalObjectResourceApi.CHANGE_PAGE_TO_NDK_PAGE)
@Produces(MediaType.APPLICATION_JSON)
public SmartGwtResponse<Item> changePageToNdkPage(
        @FormParam(DigitalObjectResourceApi.DIGITALOBJECT_PID) String pid,
        @FormParam(DigitalObjectResourceApi.DIGITALOBJECT_MODEL) String modelId
) throws DigitalObjectException {

    if (pid == null || pid.isEmpty()|| modelId == null || modelId.isEmpty()) {
        return new SmartGwtResponse<>();
    }
    ChangeModels changeModels = new ChangeModels(appConfig, pid, modelId, NdkPlugin.MODEL_PAGE, NdkPlugin.MODEL_NDK_PAGE);
    List<String> pids = changeModels.findObjects();
    changeModels.changeModels();

    RepairMetadata repairMetadata = new RepairMetadata(appConfig, NdkPlugin.MODEL_NDK_PAGE, pids);
    repairMetadata.repair();
    return new SmartGwtResponse<>();
}
 
Example #7
Source File: Persons.java    From jaxrs-beanvalidation-javaee7 with Apache License 2.0 6 votes vote down vote up
@POST
@Path("create")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response createPerson(
        @FormParam("id")
        @NotNull(message = "{person.id.notnull}")
        @Pattern(regexp = "[0-9]+", message = "{person.id.pattern}")
        String id,
        @FormParam("name")
        @Size(min = 2, max = 50, message = "{person.name.size}")
        String name) {
    Person person = new Person();
    person.setId(Integer.valueOf(id));
    person.setName(name);
    persons.put(id, person);
    return Response.status(Response.Status.CREATED).entity(person).build();
}
 
Example #8
Source File: WorkflowResource.java    From oodt with Apache License 2.0 6 votes vote down vote up
/**
 * Add Packaged Repository Workflow
 * 
 * @param workflowID
 *          id of the workflow
 * @param workflowXML
 *          xml representation of the workflow
 * @return true if addition successful
 */
@POST
@Path("/addPackagedRepositoryWorkflow")
public boolean addPackagedRepositoryWorkflow(
    @FormParam("workflowID") String workflowID,
    @FormParam("workflowXML") String workflowXML) throws Exception {
  try {
    PackagedWorkflowManager pwmanager = new PackagedWorkflowManager();
    Workflow workflow = pwmanager.parsePackagedWorkflow(workflowID, workflowXML);
    if(workflow == null)
      return false;
    String workflowDir = this.getContextPkgReposDir().getAbsolutePath();
    pwmanager.addWorkflow(workflow, workflowDir);
    return getContextClient().refreshRepository();
  } catch (Exception e) {
    String message = "Unable to add workflow. ";
    message += e.getMessage();
    LOGGER.log(Level.SEVERE, message);
    throw e;
  }
}
 
Example #9
Source File: ClusterResource.java    From cassandra-reaper with Apache License 2.0 6 votes vote down vote up
@PUT
@Path("/auth/{cluster_name}")
public Response addOrUpdateCluster(
    @Context UriInfo uriInfo,
    @PathParam("cluster_name") String clusterName,
    @FormParam("seedHost") Optional<String> seedHost,
    @FormParam("jmxPort") Optional<Integer> jmxPort,
    @FormParam("jmxUsername") Optional<String> jmxUsername,
    @FormParam("jmxPassword") Optional<String> jmxPassword) {

  LOG.info(
      "PUT addOrUpdateCluster called with: cluster_name = {}, seedHost = {}",
      clusterName, seedHost.orElse(null));

  return addOrUpdateCluster(uriInfo, Optional.of(clusterName), seedHost, jmxPort, jmxUsername, jmxPassword);
}
 
Example #10
Source File: SessionResource.java    From airpal with Apache License 2.0 6 votes vote down vote up
@POST
@Path("/login")
public void doLogin(
        @Context HttpServletRequest request,
        @Context HttpServletResponse response,
        @FormParam("username") String username,
        @FormParam("password") String password)
        throws IOException
{
    Subject currentUser = SecurityUtils.getSubject();
    if (!currentUser.isAuthenticated()) {
        AuthenticationToken token = new UsernamePasswordToken(username, password);
        currentUser.login(token);
    }

    WebUtils.redirectToSavedRequest(request, response, "/app");
}
 
Example #11
Source File: JaxrsApplicationParser.java    From typescript-generator with MIT License 6 votes vote down vote up
private MethodParameterModel getEntityParameter(Class<?> resourceClass, Method method, List<Pair<Parameter, Type>> parameters) {
    for (Pair<Parameter, Type> pair : parameters) {
        if (!Utils.hasAnyAnnotation(annotationClass -> pair.getValue1().getAnnotation(annotationClass), Arrays.asList(
                MatrixParam.class,
                QueryParam.class,
                PathParam.class,
                CookieParam.class,
                HeaderParam.class,
                Suspended.class,
                Context.class,
                FormParam.class,
                BeanParam.class
        ))) {
            final Type resolvedType = GenericsResolver.resolveType(resourceClass, pair.getValue2(), method.getDeclaringClass());
            return new MethodParameterModel(pair.getValue1().getName(), resolvedType);
        }
    }
    return null;
}
 
Example #12
Source File: WikiResource.java    From redpipe with Apache License 2.0 6 votes vote down vote up
@Path("/save")
@POST
public Single<Response> save(@FormParam("id") String id,
		@FormParam("title") String title,
		@FormParam("markdown") String markdown,
		@FormParam("newPage") String newPage){
	return fiber(() -> {
		boolean isNewPage = "yes".equals(newPage);
		String requiredPermission = isNewPage ? "create" : "update";
		if(!await(user.rxIsAuthorised(requiredPermission)))
			throw new AuthorizationException("Not authorized");

		io.reactivex.Single<Integer> query;
		if(isNewPage)
	        query = dao.insert(new Pages().setName(title).setContent(markdown));
		else
			query = dao.update(new Pages().setId(Integer.valueOf(id)).setContent(markdown).setName(title));
		await(query);
		URI location = Router.getURI(WikiResource::renderPage, title);
		return Response.seeOther(location).build();
	});
}
 
Example #13
Source File: PodcastRestService.java    From demo-restWS-spring-jersey-jpa2-hibernate with MIT License 6 votes vote down vote up
/**
 * Adds a new resource (podcast) from "form" (at least title and feed
 * elements are required at the DB level)
 * 
 * @param title
 * @param linkOnPodcastpedia
 * @param feed
 * @param description
 * @return
 */
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces({ MediaType.TEXT_HTML })
@Transactional
public Response createPodcastFromForm(@FormParam("title") String title,
		@FormParam("linkOnPodcastpedia") String linkOnPodcastpedia,
		@FormParam("feed") String feed,
		@FormParam("description") String description) {
	Podcast podcast = new Podcast(title, linkOnPodcastpedia, feed,
			description);
	podcastDao.createPodcast(podcast);

	return Response.status(201)
			.entity("A new podcast/resource has been created").build();
}
 
Example #14
Source File: CountryEndpoint.java    From java-resource-server with Apache License 2.0 6 votes vote down vote up
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response post(
        @HeaderParam(HttpHeaders.AUTHORIZATION) String authorization,
        @HeaderParam("DPoP") String dpop,
        @FormParam("access_token") String accessToken,
        @PathParam("code") String code,
        @Context HttpServletRequest request)
{
    // Extract an access token from either the Authorization header or
    // the request parameters. The Authorization header takes precedence.
    // See RFC 6750 (Bearer Token Usage) about the standard ways to accept
    // an access token from a client application.
    String token = extractAccessToken(authorization, accessToken);

    return process(request, token, dpop, code);
}
 
Example #15
Source File: BookStoreWithValidation.java    From cxf with Apache License 2.0 5 votes vote down vote up
@POST
@Path("/books")
public Response addBook(@Context final UriInfo uriInfo,
        @NotNull @FormParam("id") String id,
        @FormParam("name") String name) {

    final BookWithValidation book = new BookWithValidation(name, id);
    provider.validateBean(book);

    return Response.created(uriInfo.getRequestUriBuilder().path(id).build()).build();
}
 
Example #16
Source File: DataResource.java    From wings with Apache License 2.0 5 votes vote down vote up
@POST
@Path("delDataTypes")
@Produces(MediaType.TEXT_PLAIN)
public String delDataTypes(
    @FormParam("data_type") String dtypes) {
  Gson gson = new Gson();
  String[] data_types = gson.fromJson(dtypes, String[].class);
  if(this.dc != null && this.isOwner() && !config.isSandboxed() &&
      this.dc.delDatatypes(data_types)) {
    RunController.invalidateCachedAPIs();
    return "OK";
  }
  return null;
}
 
Example #17
Source File: TopologyResource.java    From incubator-heron with Apache License 2.0 5 votes vote down vote up
@POST
@Path("/{cluster}/{role}/{environment}/{name}/restart")
@Produces(MediaType.APPLICATION_JSON)
@SuppressWarnings("IllegalCatch")
public Response restart(
    final @PathParam("cluster") String cluster,
    final @PathParam("role") String role,
    final @PathParam("environment") String environment,
    final @PathParam("name") String name,
    final @DefaultValue("-1") @FormParam("container_id") int containerId) {
  try {
    final List<Pair<String, Object>> keyValues = new ArrayList<>(
        Arrays.asList(
          Pair.create(Key.CLUSTER.value(), cluster),
          Pair.create(Key.ROLE.value(), role),
          Pair.create(Key.ENVIRON.value(), environment),
          Pair.create(Key.TOPOLOGY_NAME.value(), name),
          Pair.create(Key.TOPOLOGY_CONTAINER_ID.value(),  containerId)
        )
    );

    final Config config = createConfig(keyValues);
    getActionFactory().createRuntimeAction(config, ActionType.RESTART).execute();

    return Response.ok()
        .type(MediaType.APPLICATION_JSON)
        .entity(Utils.createMessage(String.format("%s restarted", name)))
        .build();
  } catch (Exception ex) {
    LOG.error("error restarting topology {}", name, ex);
    return Response.serverError()
        .type(MediaType.APPLICATION_JSON)
        .entity(Utils.createMessage(ex.getMessage()))
        .build();
  }
}
 
Example #18
Source File: FileApi.java    From bitbucket-rest with Apache License 2.0 5 votes vote down vote up
@Named("file:update-content")
@Documentation({"https://docs.atlassian.com/bitbucket-server/rest/6.0.0/bitbucket-rest.html#idp185"})
@Consumes(MediaType.APPLICATION_JSON)
@Path("/rest/api/{jclouds.api-version}/projects/{project}/repos/{repo}/browse/{filePath}")
@Fallback(BitbucketFallbacks.CommitOnError.class)
@PUT
Commit updateContent(@PathParam("project") String project,
                     @PathParam("repo") String repo,
                     @PathParam("filePath") String filePath,
                     @FormParam("branch") String branch,
                     @PartParam(name = "content") String content,
                     @Nullable @FormParam("message") String message,
                     @Nullable @FormParam("sourceCommitId") String sourceCommitId,
                     @Nullable @FormParam("sourceBranch") String sourceBranch);
 
Example #19
Source File: DataTempManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@POST
@Path("/{code}/dictgroups/{groupCode}/dictitems")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response addDictgroupsDictItems(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user, @Context ServiceContext serviceContext,
		@PathParam("code") String code, @PathParam("groupCode") String groupCode, @FormParam("itemCode") String itemCode);
 
Example #20
Source File: ComponentResource.java    From wings with Apache License 2.0 5 votes vote down vote up
@POST
@Path("fb/addFile")
@Produces(MediaType.TEXT_PLAIN)
public String addComponentFile(
    @FormParam("cid") String cid,
    @FormParam("path") String path) {
  if(this.cc != null && this.isOwner() && !config.isSandboxed() &&
      this.cc.addComponentFile(cid, path))
    return "OK";
  return null;
}
 
Example #21
Source File: DeliverableTypesManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@PUT
@Path("/{id}/formscript")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "update FormScript")
@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 updateDeliverableTypeFormScript(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "id of DeliverableType", required = true) @PathParam("id") long deliverableTypeId,
		@ApiParam(value = "FormScript of dossierfile", required = true) @FormParam("formScript") String formScript);
 
Example #22
Source File: UserService.java    From aws-photosharing-example with Apache License 2.0 5 votes vote down vote up
@POST
@Path("/register")
@Produces(MediaType.APPLICATION_JSON)    
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response register(@FormParam("username") String p_username, @FormParam("password") String p_password, @FormParam("email") String p_email) {    	
	return Response.ok(_facade.register(new User(p_username, p_password, p_email))).build();
}
 
Example #23
Source File: BaseSecurityResource.java    From redpipe with Apache License 2.0 5 votes vote down vote up
@POST
@Path("/loginAuth")
public Single<Response> loginAuth(@FormParam("username") String username, @FormParam("password") String password,
		@FormParam("return_url") String returnUrl, @Context Session session, @Context RoutingContext ctx,
		@Context AuthProvider auth) throws URISyntaxException {
	if (username == null || username.isEmpty() || password == null || password.isEmpty())
		return Single.just(Response.status(Status.BAD_REQUEST).build());

	JsonObject authInfo = new JsonObject().put("username", username).put("password", password);
	return auth.rxAuthenticate(authInfo).map(user -> {
		ctx.setUser(user);
		if (session != null) {
			// the user has upgraded from unauthenticated to authenticated
			// session should be upgraded as recommended by owasp
			session.regenerateId();
		}
		String redirectUrl = session.remove(REDIRECT_KEY);
		if (redirectUrl == null)
			redirectUrl = returnUrl;
		if (redirectUrl == null)
			redirectUrl = "/";

		try {
			return Response.status(Status.FOUND).location(new URI(redirectUrl)).build();
		} catch (URISyntaxException e) {
			throw new RuntimeException(e);
		}
	}).onErrorReturn(t -> {
		return Response.status(Status.FORBIDDEN).entity(t.getMessage()).type(MediaType.TEXT_PLAIN).build();
	});
}
 
Example #24
Source File: ComponentResource.java    From wings with Apache License 2.0 5 votes vote down vote up
@POST
@Path("delComponent")
@Produces(MediaType.TEXT_PLAIN)
public String delComponent(
    @FormParam("cid") String cid) {
  if(this.cc != null && this.isOwner() && !config.isSandboxed() &&
      this.cc.delComponent(cid)) {
    RunController.invalidateCachedAPIs();
    return "OK";
  }
  return null;
}
 
Example #25
Source File: HttpProcessorIT.java    From datacollector with Apache License 2.0 5 votes vote down vote up
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.APPLICATION_JSON)
@POST
public Response post(
    @Context HttpHeaders h,
    @FormParam(OAuth2ConfigBean.GRANT_TYPE_KEY) String type,
    @FormParam(OAuth2ConfigBean.ASSERTION_KEY) String assertion
) throws Exception {
  type = URLDecoder.decode(type, "UTF-8");
  if (!type.equals(JWT_BEARER_TOKEN)) {
    return Response.status(Response.Status.FORBIDDEN).build();
  }
  String[] creds = assertion.split("\\.");
  Signature sig = Signature.getInstance("SHA256WithRSA");
  sig.initSign(keyPair.getPrivate());
  sig.update((creds[0] + "." + creds[1]).getBytes());
  byte[] signatureBytes = sig.sign();
  if (!Arrays.equals(signatureBytes, Base64.decodeBase64(creds[2]))) {
    return Response.status(Response.Status.FORBIDDEN).build();
  }
  String base64dAlg = new String(Base64.decodeBase64(creds[0]));
  String base64dJWT = new String(Base64.decodeBase64(creds[1]));
  if (base64dAlg.equals(ALGORITHM) &&
      base64dJWT.equals(JWT)) {
    token = RandomStringUtils.randomAlphanumeric(16);
    String tokenResponse = "{\n" +
        "  \"token_type\": \"Bearer\",\n" +
        "  \"expires_in\": \"3600\",\n" +
        "  \"ext_expires_in\": \"0\",\n" +
        "  \"expires_on\": \"1484788319\",\n" +
        "  \"not_before\": \"1484784419\",\n" +
        "  \"access_token\": \"" + token + "\"\n" +
        "}";
    tokenGetCount++;
    return Response.ok().entity(tokenResponse).build();
  }
  return Response.status(Response.Status.FORBIDDEN).build();
}
 
Example #26
Source File: ClusterAnalysisService.java    From jumbune with GNU Lesser General Public License v3.0 5 votes vote down vote up
@POST
@Path(WebConstants.DATA_CENTER_HEAT_MAP)
@Produces(MediaType.APPLICATION_JSON)
public Response getDataCenterHeatMap(@FormParam(CLUSTER_NAME) String clusterName,
		@FormParam("colorConfigJSON") String colorConfigJSON) {
	try {
		Cluster cluster = cache.getCluster(clusterName);
		ClusterInfo dataCenterHeatMap = getHeatMap(cluster, colorConfigJSON,
				"CLUSTER_VIEW");
		return Response.ok(Constants.gson.toJson(dataCenterHeatMap)).build();
	} catch (Exception e) {
		LOGGER.error("Unable to get data center heat map", e);
		return Response.status(Status.INTERNAL_SERVER_ERROR).build();
	}
}
 
Example #27
Source File: FruitResource.java    From tutorials with MIT License 5 votes vote down vote up
@PUT
@Path("/update")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public void updateFruit(@SerialNumber @FormParam("serial") String serial) {
    Fruit fruit = new Fruit();
    fruit.setSerial(serial);
    SimpleStorageService.storeFruit(fruit);
}
 
Example #28
Source File: V3GitLabApiProxy.java    From gitlab-plugin with GNU General Public License v2.0 5 votes vote down vote up
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("/projects/{projectId}/hooks")
@Override
void addProjectHook(@PathParam("projectId") String projectId,
                    @FormParam("url") String url,
                    @FormParam("push_events") Boolean pushEvents,
                    @FormParam("merge_requests_events") Boolean mergeRequestEvents,
                    @FormParam("note_events") Boolean noteEvents);
 
Example #29
Source File: RestDocumentService.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@POST
@Path("/unsetPassword")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@ApiOperation( value = "Removes password protection", notes = "Removes the password protection from the document")				
public void unsetPassword(
		@FormParam("docId") @ApiParam(value = "Document ID", required = true) long docId, 
		@FormParam("currentPassword") @ApiParam(value = "A password", required = true) String currentPassword) 
				throws Exception {
	String sid = validateSession();
	super.unsetPassword(sid, docId, currentPassword);
}
 
Example #30
Source File: UserManagement.java    From opencps-v2 with GNU Affero General Public License v3.0 5 votes vote down vote up
@POST
@Path("/{id}/changepass/application")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response addChangepassApplication(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext, @PathParam("id") long id,
		@FormParam("oldPassword") String oldPassword, @FormParam("newPassword") String newPassword);