• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JSONObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.tapestry5.json.JSONObject的典型用法代码示例。如果您正苦于以下问题:Java JSONObject类的具体用法?Java JSONObject怎么用?Java JSONObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JSONObject类属于org.apache.tapestry5.json包,在下文中一共展示了JSONObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: validate

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
@GET
@Path("/validate")
@PermitAll
public Response validate( @Context Request req)
{
    Subject subject;
    try {
        subject = securityService.getSubject();
        if (subject.isAuthenticated()) {
            return Response.ok().build();
        }
    }
    catch (Exception e) {
        LOG.debug("User failed to log.");
    }
    JSONObject JSONEntity = new JSONObject();
    JSONEntity.put("message","not Authenticated");
    return Response.status(Response.Status.BAD_REQUEST).entity(JSONEntity.toString()).build();
}
 
开发者ID:ffacon,项目名称:tapestry5-angular2-demo,代码行数:20,代码来源:UserService.java


示例2: update

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
@Override
public void update(final String pageName, final String title, final Block body, final boolean large) {
    if (!updated.get(Boolean.FALSE) && request.isXHR()) {
        updated.set(Boolean.TRUE);

        ajaxResponseRenderer.addRender(TITLE_ID, title);
        ajaxResponseRenderer.addRender(BODY_ID, body);

        callCallback(new JavaScriptCallback() {
            @Override
            public void run(final JavaScriptSupport javascriptSupport) {
                javascriptSupport.require("talentroc/modal-support").invoke("large")
                        .with(new JSONObject("id", MODAL_ID, "large", large));
            }
        });
    } else {
        throw new UnsupportedOperationException("ModalSupport update can only once be used as part as an ajax " +
                "request.");
    }
}
 
开发者ID:talentroc,项目名称:t5-bs-modal,代码行数:21,代码来源:ModalSupportImpl.java


示例3: handleRetrieveAlerts

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
protected void handleRetrieveAlerts(final Request request, final Response response) throws IOException {
  // See TAP5-1941
  if (!request.isXHR()) {
    response.sendError(400, "Expecting XMLHttpRequest");
  }
  JSONObject result = new JSONObject();
  AlertStorage storage = applicationStateManager.getIfExists(AlertStorage.class);
  if (storage != null) {

    for (Alert alert : storage.getAlerts()) {
      result.append("alerts", alert.toJSON());
    }
    storage.dismissNonPersistent();
  }
  try (PrintWriter printWriter = response.getPrintWriter("application/json")) {
    printWriter.write(result.toString(productionMode));
  }
}
 
开发者ID:eddyson-de,项目名称:tapestry-react,代码行数:19,代码来源:ReactAPIFilter.java


示例4: afterRender

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
void afterRender() {
    JSONObject spec = new JSONObject();

    String requiredUsernameError = messages.format("errors.required",
            messages.get("label.username"));
    String requiredPasswordError = messages.format("errors.required",
            messages.get("label.password"));

    spec.put("url", createLink(this.getClass()))
            .put("passwordHintLink", createLink(PasswordHint.class))
            .put("requiredUsername", requiredUsernameError)
            .put("requiredPassword", requiredPasswordError);

    // javascriptSupport.addScript("initialize(%s);", spec);
  //  javascriptSupport.addInitializerCall("loginHint", spec);

}
 
开发者ID:dlwhitehurst,项目名称:musicrecital,代码行数:18,代码来源:Login.java


示例5: afterRender

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
@AfterRender
void afterRender(MarkupWriter writer) {
	String id = clientElement.getClientId();
	String clientID = javaScriptSupport.allocateClientId(id);
	String formID = formSupport.getClientId();
	Date date = coercer.coerce(value, Date.class);
	String formatedDate = "";
	if ( date != null ) {
		DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		formatedDate = format.format(date);
	}
	Element dateField = element.elementBefore("input", 
			"value",formatedDate,"type","hidden","class","form-control","id",clientID);
	if (clientElement.isDisabled()) {
		 dateField.attribute("disabled", "disabled");
	}
	javaScriptSupport.require("datepicker/datepicker").with(new JSONObject("id", id, "clientID", clientID,"formID",formID));
	if ( ! DatePickerConstants.NULL.equals(css)) {
		javaScriptSupport.importStylesheet(assetSource.getExpandedAsset(css));
	}
	if ( ! DatePickerConstants.NULL.equals(javascript)) {
		javaScriptSupport.importJavaScriptLibrary(assetSource.getExpandedAsset(javascript));
	}
}
 
开发者ID:trsvax,项目名称:tapestry-datepicker,代码行数:25,代码来源:JQueryDatePicker.java


示例6: PayPalError

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
public PayPalError(String error) {
	int index = error.indexOf("{");
	message = error;
	if ( index < 0 ) {
		return;
	} 
	error = error.substring(index);
	JSONObject object = new JSONObject(error);
	if ( object.has("name")) {
		name = object.getString("name");
	} 
	if ( object.has("message") ) {
		message = object.getString("message");
	}
	if ( object.has("link")) {
		link = object.getString("link");
	}
	
	if ( object.has("details") ) {
		for ( Object detail : object.getJSONArray("details").toList() ) {					
			details.add( new PayPalErrorDetail((JSONObject) detail));
		}
	}
}
 
开发者ID:trsvax,项目名称:tapestry-paypal-rest,代码行数:25,代码来源:PayPalError.java


示例7: postLogin

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
@POST
@Path("/authentication")
@Consumes("application/x-www-form-urlencoded")
@PermitAll
public Response postLogin(@FormParam("j_username") String username,@FormParam("j_password") String password) {
    Response.ResponseBuilder rb;

    Subject subject;
    try {
        subject = securityService.getSubject();
        if (!subject.isAuthenticated()) {
            UsernamePasswordToken token = new UsernamePasswordToken(username, password);
            subject.login(token);
            token.clear();
            String userPassword= username + ":" + password;
            String basicAuth = new String(Base64.encodeBytes(userPassword.getBytes()));
            Token cltToken = new Token();
            cltToken.setAccess_token("Basic "+basicAuth);
            cltToken.setExpires_in(1799);
            cltToken.setToken_type("bearer");
            cltToken.setScope("read write");
            rb = Response.ok(cltToken);
            return rb.build();

        } else {
            LOG.debug("User [" + subject.getPrincipal() + "] already authenticated.");
            if(subject.getPrincipal().toString().equals(username))
            {
                rb = Response.ok();
                return rb.build();
            }
        }
    } catch (Exception e) {
        LOG.debug("User failed to log.");
    }
    JSONObject JSONEntity = new JSONObject();
    JSONEntity.put("message","invalid user or password");
    return Response.status(Response.Status.BAD_REQUEST).entity(JSONEntity.toString()).build();

}
 
开发者ID:ffacon,项目名称:tapestry5-angular2-demo,代码行数:41,代码来源:UserService.java


示例8: afterRender

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
void afterRender(final MarkupWriter writer) {
  writer.end();
  JSONObject parameters = new JSONObject();
  for (String informalParameterName : componentResources.getInformalParameterNames()) {
    parameters.put(informalParameterName,
        componentResources.getInformalParameter(informalParameterName, Object.class));
  }
  javaScriptSupport.require("angular2/js/a2component").with(module, clientId, parameters);
}
 
开发者ID:ffacon,项目名称:tapestry5-angular2,代码行数:10,代码来源:A2Component.java


示例9: makeScriptToShowModal

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
public JavaScriptCallback makeScriptToShowModal(String name) {
    return new JavaScriptCallback() {
        public void run(JavaScriptSupport javascriptSupport) {
            javaScriptSupport.require("dialogmodal").invoke("activate").with(name, new JSONObject());
        }
    };
}
 
开发者ID:Zabrimus,项目名称:vdr-jonglisto,代码行数:8,代码来源:UserAdmin.java


示例10: makeScriptToShowInfoModal

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
private JavaScriptCallback makeScriptToShowInfoModal() {
    return new JavaScriptCallback() {

        public void run(JavaScriptSupport javascriptSupport) {
            javaScriptSupport.require("dialogmodal").invoke("activate").with(recordingInfoModalId,
                    new JSONObject());
        }
    };
}
 
开发者ID:Zabrimus,项目名称:vdr-jonglisto,代码行数:10,代码来源:Recordings.java


示例11: makeScriptToShowEditModal

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
private JavaScriptCallback makeScriptToShowEditModal() {
    return new JavaScriptCallback() {

        public void run(JavaScriptSupport javascriptSupport) {
            javaScriptSupport.require("dialogmodal").invoke("activate").with("timerEdit", new JSONObject());
        }
    };
}
 
开发者ID:Zabrimus,项目名称:vdr-jonglisto,代码行数:9,代码来源:TimerView.java


示例12: makeScriptToShowModal

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
public JavaScriptCallback makeScriptToShowModal() {
    return new JavaScriptCallback() {

        public void run(JavaScriptSupport javascriptSupport) {
            javaScriptSupport.require("dialogmodal").invoke("activate").with(epgInfoModalId, new JSONObject());
        }
    };
}
 
开发者ID:Zabrimus,项目名称:vdr-jonglisto,代码行数:9,代码来源:Epg.java


示例13: addApplicationConfigModule

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
@Contribute(ModuleManager.class)
public static void addApplicationConfigModule(
    final MappedConfiguration<String, JavaScriptModuleConfiguration> configuration, final SymbolSource symbolSource,
    @Symbol(SymbolConstants.PRODUCTION_MODE) final boolean productionMode) {

  final JSONObject config = new JSONObject();

  for (String symbolName : new String[] { SymbolConstants.CONTEXT_PATH, SymbolConstants.EXECUTION_MODE,
      SymbolConstants.PRODUCTION_MODE, SymbolConstants.START_PAGE_NAME, SymbolConstants.TAPESTRY_VERSION,
      SymbolConstants.SUPPORTED_LOCALES }) {
    String value = symbolSource.valueForSymbol(symbolName);
    config.put(symbolName, value);
  }
  config.put("react-api-path", ReactAPIFilter.path);

  StringBuilder sb = new StringBuilder();
  sb.append("define(");
  sb.append(config.toString(productionMode));
  sb.append(");");
  final byte[] bytes = sb.toString().getBytes(StandardCharsets.UTF_8);

  configuration.add("eddyson/react/application-config", new JavaScriptModuleConfiguration(new VirtualResource() {

    @Override
    public InputStream openStream() throws IOException {
      return new ByteArrayInputStream(bytes);
    }

    @Override
    public String getFile() {
      return "application-config.js";
    }

    @Override
    public URL toURL() {
      return null;
    }
  }));

}
 
开发者ID:eddyson-de,项目名称:tapestry-react,代码行数:41,代码来源:ReactModule.java


示例14: afterRender

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
void afterRender(final MarkupWriter writer) {
  writer.end();
  JSONObject parameters = new JSONObject();
  for (String informalParameterName : componentResources.getInformalParameterNames()) {
    parameters.put(informalParameterName,
        componentResources.getInformalParameter(informalParameterName, Object.class));
  }
  javaScriptSupport.require("eddyson/react/components/reactcomponent").with(module, clientId, parameters);
}
 
开发者ID:eddyson-de,项目名称:tapestry-react,代码行数:10,代码来源:ReactComponent.java


示例15: afterRender

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
@AfterRender
public void afterRender() {

    // Tell the Tapestry.Initializer to do the initializing of a Confirm,
    // which it will do when the DOM has been
    // fully loaded.

    JSONObject spec = new JSONObject();
    spec.put("elementId", clientElement.getClientId());
    spec.put("message", message);
    javaScriptSupport.addInitializerCall("confirm", spec);
}
 
开发者ID:beargiles,项目名称:project-student,代码行数:13,代码来源:Confirm.java


示例16: afterRender

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
@AfterRender
public void afterRender() {

	// Tell the Tapestry.Initializer to do the initializing of a Confirm, which
	// it will do when the DOM has been
	// fully loaded.

	JSONObject spec = new JSONObject();
	spec.put("elementId", clientElement.getClientId());
	spec.put("message", message);
	javaScriptSupport.addInitializerCall("confirm", spec);
}
 
开发者ID:onyxbits,项目名称:TradeTrax,代码行数:13,代码来源:Confirm.java


示例17: checkClientId

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
@SetupRender
public void checkClientId(){
	//Be sure that clientId is set
	if (this.clientId==null){
		clientId = javascript.allocateClientId(resources);
	}
	
	//Organize options to send
	this.opts= new JSONObject();
	
	opts.put("id", this.getClientId());
	opts.put("dataSet", this.dataSet);
	JSONObject specificOptions = this.getSpecificOptions();
	opts.put("extra", specificOptions==null? new JSONObject():specificOptions);
}
 
开发者ID:got5,项目名称:tapestry5-d3,代码行数:16,代码来源:AbstractD3Component.java


示例18: getSpecificOptions

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
@Override
public JSONObject getSpecificOptions() {
	JSONObject res= new JSONObject();
	if (width!=null){
		res.put("width", width);
	}
	if (height!=null){
		res.put("height", height);
	}
	return res;
}
 
开发者ID:got5,项目名称:tapestry5-d3,代码行数:12,代码来源:DimpleGroupedBarChart.java


示例19: getData

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
public JSONArray getData(){
	
	JSONObject o1= new JSONObject();
	o1.put("label", "one");
	o1.put("value", 20.0);
	JSONObject o2= new JSONObject();
	o2.put("label", "two");
	o2.put("value", 50.0);		
	JSONObject o3= new JSONObject();
	o3.put("label", "three");
	o3.put("value", 30.0);		
	
	return new JSONArray(o1, o2, o3);
}
 
开发者ID:got5,项目名称:tapestry5-d3,代码行数:15,代码来源:PieChartPage.java


示例20: provideValues

import org.apache.tapestry5.json.JSONObject; //导入依赖的package包/类
@PublishEvent
@OnEvent("providevalues")
Object provideValues() {
  return new JSONObject("values", new JSONArray(new JSONObject("value", "one", "label", "One"),
      new JSONObject("value", "two", "label", "Two"), new JSONObject("value", "three", "label", "Three")));
}
 
开发者ID:eddyson-de,项目名称:tapestry-react-select,代码行数:7,代码来源:ReactSelectAsyncDemo.java



注:本文中的org.apache.tapestry5.json.JSONObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WeakListeners类代码示例发布时间:2022-05-21
下一篇:
Java RuntimeConfigurationType类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap