本文整理匯總了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;
}