Package org.fusesource.restygwt.client

Examples of org.fusesource.restygwt.client.Resource.post()


        // Initialize the pizza service..
        Resource resource = new Resource(GWT.getModuleBaseURL() + "pizza-service");

        JSONValue request = createRequestObject();

        resource.post().json(request).send(new JsonCallback() {
            public void onSuccess(Method method, JSONValue response) {
                assertNotNull(response);
                System.out.println(response);
                finishTest();
            }
View Full Code Here


        });
    }
   
    public void logout() {
        Resource resource = new Resource(URLBuilder.getLogoutURL(this.contextPath));
        resource.post().send(new TextCallback() {
            @Override
            public void onSuccess(Method method, String response) {
                Window.Location.reload();
            }
            @Override
View Full Code Here

    @Override
    public void saveForm(final FormRepresentation form) {
        Resource resource = new Resource(URLBuilder.saveFormURL(this.contextPath, this.packageName));
        try {
            String json = FormEncodingFactory.getEncoder().encode(form);
            resource.post().text(json).send(new SimpleTextCallback(i18n.CouldntSaveForm()) {
                @Override
                public void onSuccess(Method method, String response) {
                    int code = method.getResponse().getStatusCode();
                    if (code == Response.SC_CONFLICT) {
                        bus.fireEvent(new NotificationEvent(Level.WARN, i18n.FormAlreadyUpdated()));
View Full Code Here

    @Override
    public void saveFormItem(FormItemRepresentation formItem, String formItemName) {
        Resource resource = new Resource(URLBuilder.saveFormItemURL(this.contextPath, this.packageName, formItemName));
        try {
            String xml = helper.asXml(formItemName, formItem);
            resource.post().xml(XMLParser.parse(xml)).send(new SimpleTextCallback(i18n.CouldntSaveFormItem()) {
                @Override
                public void onSuccess(Method method, String response) {
                    int code = method.getResponse().getStatusCode();
                    if (code == Response.SC_CONFLICT) {
                        bus.fireEvent(new NotificationEvent(Level.WARN, i18n.FormItemAlreadyUpdated()));
View Full Code Here

    public void generateForm(FormRepresentation form, final String language,
            Map<String, Object> inputs) {
        Resource resource = new Resource(URLBuilder.generateFormURL(this.contextPath, language));
        try {
            String xml = helper.asXml(form, inputs);
            resource.post().header(Resource.HEADER_ACCEPT, Resource.CONTENT_TYPE_TEXT).
                xml(XMLParser.parse(xml)).send(new SimpleTextCallback(i18n.CouldntPreviewForm()) {
                @Override
                public void onSuccess(Method method, String urlResponse) {
                    bus.fireEvent(new PreviewFormResponseEvent(urlResponse, language));
                }
View Full Code Here

    @Override
    public void saveMenuItem(String groupName, final FBMenuItem item) {
        Resource resource = new Resource(URLBuilder.getMenuItemsURL(this.contextPath));
        String xml = helper.asXml(groupName, item);
        try {
            resource.post().xml(XMLParser.parse(xml)).expect(201,409).send(new RequestCallback() {
                @Override
                public void onError(Request request, Throwable exception) {
                    bus.fireEvent(new NotificationEvent(Level.ERROR, i18n.CouldntGenerateMenuItem(), exception));
                }
                @Override
View Full Code Here

    public void loadFormTemplate(final FormRepresentation form, String language) {
        final String url = URLBuilder.loadFormTemplateURL(this.contextPath, language);
        Resource resource = new Resource(url);
        try {
            String xml = helper.asXml(form, null);
            resource.post().xml(XMLParser.parse(xml)).send(new SimpleTextCallback(i18n.CouldntExportTemplate()) {
                @Override
                public void onSuccess(Method method, String response) {
                    String fileName = helper.getFileName(response);
                    FormPanel auxiliarForm = new FormPanel();
                    auxiliarForm.setMethod(FormPanel.METHOD_GET);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.