本文整理汇总了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();
}
示例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);
}
示例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();
});
}
示例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;
}
示例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();
});
}
示例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;
}
示例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;
}
示例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;
}
示例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);
示例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();
}
示例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;
示例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();
}
示例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;
}
示例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());
}
示例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;
}