當前位置: 首頁>>代碼示例>>Java>>正文


Java FormParam類代碼示例

本文整理匯總了Java中javax.ws.rs.FormParam的典型用法代碼示例。如果您正苦於以下問題:Java FormParam類的具體用法?Java FormParam怎麽用?Java FormParam使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FormParam類屬於javax.ws.rs包,在下文中一共展示了FormParam類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateSystemOption

import javax.ws.rs.FormParam; //導入依賴的package包/類
@POST
@Path("/option/{optionName}")
@Consumes("application/x-www-form-urlencoded")
@Produces(MediaType.TEXT_HTML)
public Viewable updateSystemOption(@FormParam("name") String name, @FormParam("value") String value,
                                 @FormParam("kind") String kind) {
  try {
    work.getContext()
      .getOptionManager()
      .setOption(OptionValue.createOption(
        OptionValue.Kind.valueOf(kind),
        OptionValue.OptionType.SYSTEM,
        name,
        value));
  } catch (Exception e) {
    logger.debug("Could not update.", e);
  }
  return getSystemOptions();
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:20,代碼來源:StatusResources.java

示例2: register

import javax.ws.rs.FormParam; //導入依賴的package包/類
@POST
@Path("register")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public String register(@FormParam("userName") String userName,
		@FormParam("password") String password,
		@FormParam("phone") Long phone, @FormParam("email") String email,
		@FormParam("nick") String nick, @FormParam("addr") String addr,
		@FormParam("gender") String gender) {
	// check not null
	User u = new User();// dao 應該查詢
	u.setAddr(addr);
	u.setEmail(email);
	u.setGender(gender);
	u.setNick(nick);
	u.setPassword(password);
	u.setPhone(phone);
	u.setUsername(userName);
	return JsonUtil.bean2Json(u);
}
 
開發者ID:jiumao-org,項目名稱:wechat-mall,代碼行數:20,代碼來源:IndexResource.java

示例3: save

import javax.ws.rs.FormParam; //導入依賴的package包/類
@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");

		PagesDao dao = (PagesDao) AppGlobals.get().getGlobal("dao");
		Single<Integer> query;
		if(isNewPage)
	        query = dao.client().execute(DSL.using(dao.configuration()).insertInto(dao.getTable())
	        		.columns(Tables.PAGES.NAME, Tables.PAGES.CONTENT)
	        		.values(title, markdown));
		else
			query = dao.updateExecAsync(new Pages().setId(Integer.valueOf(id)).setContent(markdown));
		await(query);
		URI location = Router.getURI(WikiResource::renderPage, title);
		return Response.seeOther(location).build();
	});
}
 
開發者ID:FroMage,項目名稱:redpipe,代碼行數:26,代碼來源:WikiResource.java

示例4: createUser

import javax.ws.rs.FormParam; //導入依賴的package包/類
@PUT
@Path("/users")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public String createUser(
        @FormParam("id") int id,
        @FormParam("name") String name,
        @FormParam("profession") String profession)
{
    User user = new User(id, name, profession);
    int result = userDao.addUser(user);
    if (result == 1)
    {
        return SUCCESS_JSON;
    }

    return FAILURE_JSON;
}
 
開發者ID:nfriaa,項目名稱:javase-restful-server,代碼行數:19,代碼來源:UserService.java

示例5: save

import javax.ws.rs.FormParam; //導入依賴的package包/類
@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((con) -> {
		boolean isNewPage = "yes".equals(newPage);
		String requiredPermission = isNewPage ? "create" : "update";
		if(!await(user.rxIsAuthorised(requiredPermission)))
			throw new AuthorizationException("Not authorized");

		String sql = isNewPage ? SQL.SQL_CREATE_PAGE : SQL.SQL_SAVE_PAGE;
		JsonArray params = new JsonArray();
		if (isNewPage) {
			params.add(title).add(markdown);
		} else {
			params.add(markdown).add(id);
		}
		await(con.rxUpdateWithParams(sql, params));
		URI location = Router.getURI(WikiResource::renderPage, title);
		return Response.seeOther(location).build();
	});
}
 
開發者ID:FroMage,項目名稱:redpipe,代碼行數:25,代碼來源:WikiResource.java

示例6: getById

import javax.ws.rs.FormParam; //導入依賴的package包/類
@POST
@Path("{id}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes({MediaType.APPLICATION_FORM_URLENCODED})
public Cliente getById(@PathParam("id") int id,
		@QueryParam("citta") String citta,
		@FormParam("parametro") String nome) {
	Cliente c = new Cliente();
	c.setNome(nome + " : " + id);
	c.setPartitaIva("658736457634");
	c.setTelefono(citta);
	return c;
}
 
開發者ID:andrea-colleoni,項目名稱:corso-lutech,代碼行數:14,代碼來源:ClienteAPI.java

示例7: accountStatus

import javax.ws.rs.FormParam; //導入依賴的package包/類
@POST
@Path("accountalias")
public BaseDTO accountStatus(@FormParam("username") String username) {
    BaseDTO baseDto = new BaseDTO();

    try {
        baseDto.setCode(200);
        baseDto.setData(accountAliasConverter.convertAlias(username));
    } catch (Exception ex) {
        logger.error(ex.getMessage(), ex);
        baseDto.setCode(500);
        baseDto.setMessage(ex.getMessage());
    }

    return baseDto;
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:17,代碼來源:AccountStatusResource.java

示例8: helloHelloPost

import javax.ws.rs.FormParam; //導入依賴的package包/類
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.TEXT_PLAIN)
public String helloHelloPost(@FormParam("me") final String me) {

    return "HelloHello " + me;
}
 
開發者ID:trajano,項目名稱:app-ms,代碼行數:8,代碼來源:SingleHello2.java

示例9: updateRegistrationTemplateSampleData

import javax.ws.rs.FormParam; //導入依賴的package包/類
@PUT
@Path("/{id}/sampledata")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "update sampledata")
@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 updateRegistrationTemplateSampleData(@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 registrationTemplatesId,
		@ApiParam(value = "sampledata of  registrationTemplate", required = true) @FormParam("sampleData") String sampledata);
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:15,代碼來源:RegistrationTemplatesManagement.java

示例10: handleSubmit

import javax.ws.rs.FormParam; //導入依賴的package包/類
@POST
@Path("/new")
@Consumes(APPLICATION_FORM_URLENCODED)
public Response handleSubmit(
        @FormParam("name") final String name,
        @FormParam("address") final String address,
        @FormParam("city") final String city,
        @FormParam("telephone") final String telephone) {

    final Owner owner = new Owner();
    owner.setName(name);
    owner.setAddress(address);
    owner.setCity(city);
    owner.setTelephone(telephone);
    dao.create(owner);
    return Response.seeOther(URI.create(owner.getUrl())).build();
}
 
開發者ID:minijax,項目名稱:minijax,代碼行數:18,代碼來源:OwnersResource.java

示例11: updateRegFormFormData

import javax.ws.rs.FormParam; //導入依賴的package包/類
@PUT
@Path("/registrations/{id}/forms/{referenceUid}/formdata")
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@ApiOperation(value = "update RegistrationForm")
@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 updateRegFormFormData(@Context HttpServletRequest request, @Context HttpHeaders header,
		@Context Company company, @Context Locale locale, @Context User user,
		@Context ServiceContext serviceContext,
		@ApiParam(value = "registrationId", required = true) @PathParam("id") long id,
		@ApiParam(value = "referenceUid", required = true) @PathParam("referenceUid") String referenceUid,
		@ApiParam(value = "formdata of registrationForm", required = true) @FormParam("formdata") String formdata)
		throws PortalException;
 
開發者ID:VietOpenCPS,項目名稱:opencps-v2,代碼行數:17,代碼來源:RegistrationFormManagement.java

示例12: saveUser

import javax.ws.rs.FormParam; //導入依賴的package包/類
@POST
@Consumes("application/x-www-form-urlencoded")
@Produces("application/json")
@Path("/save")
public Object saveUser(@FormParam("userName") String userName,@FormParam("userPass") String userPass){
	String jsonData = "";
	User u = new User();
	u.setUserName(userName);
	u.setUserPass(userPass);
	try {
		userService.save(u);
	} catch (Exception e) {
		//-- 統一在過濾器中添加跨域訪問的header信息,所以這裏就不添加了
		jsonData = JsonUtil.toJsonByProperty("addUser","failure");
		return Response.ok(jsonData).status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR ).build();
	}
	jsonData = JsonUtil.toJsonByProperty("id", u.getId());
	return Response.ok(jsonData).status(HttpServletResponse.SC_OK).build();
}
 
開發者ID:ranji1221,項目名稱:clemon,代碼行數:20,代碼來源:UserResource.java

示例13: formResult

import javax.ws.rs.FormParam; //導入依賴的package包/類
@POST
@Produces(MediaType.TEXT_HTML)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public FreeMarkerOnlineView formResult(
        @FormParam("template") String template,
        @FormParam("dataModel") String dataModel,
        @FormParam("outputFormat") String outputFormat,
        @FormParam("locale") String locale,
        @FormParam("timeZone") String timeZone) {
    FreeMarkerOnlineView view = new FreeMarkerOnlineView();
    view.setTemplate(template);
    view.setDataModel(dataModel);
    view.setOutputFormat(outputFormat);
    view.setLocale(locale);
    view.setTimeZone(timeZone);
    view.setExecute(true);
    return view;
}
 
開發者ID:apache,項目名稱:incubator-freemarker-online-tester,代碼行數:19,代碼來源:WebPageResource.java

示例14: initParameterAnnotationMgr

import javax.ws.rs.FormParam; //導入依賴的package包/類
@Override
protected void initParameterAnnotationMgr() {
  super.initParameterAnnotationMgr();

  parameterAnnotationMgr.register(PathParam.class, new PathParamAnnotationProcessor());
  parameterAnnotationMgr.register(FormParam.class, new FormParamAnnotationProcessor());
  parameterAnnotationMgr.register(CookieParam.class, new CookieParamAnnotationProcessor());

  parameterAnnotationMgr.register(HeaderParam.class, new HeaderParamAnnotationProcessor());
  parameterAnnotationMgr.register(QueryParam.class, new QueryParamAnnotationProcessor());
}
 
開發者ID:apache,項目名稱:incubator-servicecomb-java-chassis,代碼行數:12,代碼來源:JaxrsSwaggerGeneratorContext.java

示例15: login

import javax.ws.rs.FormParam; //導入依賴的package包/類
@POST
@Path("login")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@AuthAnnotation
public User login(@FormParam("userName") String userName,
		@FormParam("password") String password,
		@FormParam("verificationCode") String verificationCode,
		@FormParam("phone") Long phone) {
	// check not null

	return null;
}
 
開發者ID:jiumao-org,項目名稱:wechat-mall,代碼行數:13,代碼來源:IndexResource.java


注:本文中的javax.ws.rs.FormParam類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。