• Nie Znaleziono Wyników

Server side programming and AJAX requests

N/A
N/A
Protected

Academic year: 2021

Share "Server side programming and AJAX requests"

Copied!
8
0
0

Pełen tekst

(1)

Server side programming and AJAX requests

Michał Okulewicz, MSc Warsaw University of Technology

Faculty of Mathematics and Information Science M.Okulewicz@mini.pw.edu.pl

http://www.mini.pw.edu.pl/~okulewiczm

(2)

p. 2

Server side programming tasks

• We will be using Microsoft .NET WebAPI as an example of RESTful web interface

• We might be using Microsoft .NET WCF as an example of JSON based WebService

• In all the tasks please use Visual Studio 2015

(3)

Task 1

• Create an empty ASP.NET Web Project with WEB API enabled

• Take the solution of the asynchronous spreadsheet from the previous laboratories

• Design and implement a RESTful backend interface with the following URIs and METHODS

GET api/table

GET api/table/{row}/{column}

POST api/table/{row}/{column} + new value in request message body

DELETE api/rows/{id}

DELETE api/columns/{id}

(4)

p. 4

Task 1 – enabling the Session

namespace Task1 {

public class WebApiApplication : System.Web.HttpApplication {

protected void Application_PostAuthorizeRequest() {

HttpContext

.Current.SetSessionStateBehavior(SessionStateBehavior.Required);

}

protected void Application_Start() {

GlobalConfiguration.Configure(WebApiConfig.Register);

} } }

(5)

Task 1 – routing and mapping hints

config.Routes.MapHttpRoute(

name: "RowsApi",

routeTemplate: "api/rows/{id}",

defaults: new { controller = "rows", id = -1 } );

config.Routes.MapHttpRoute(

name: "DefaultApi",

routeTemplate: "api/{controller}/{r}/{c}", defaults: new { r = RouteParameter.Optional,

c = RouteParameter.Optional } );

public IHttpActionResult Get(int r, int c) {

var data = Task4.Table.GetTable(HttpContext.Current.Session);

(6)

p. 6

Task 2

• Take grouped numbers JSON generator from Task3 from previous labs

• Change a WebForm to a WebAPI RESTfull interface

• Enhance the HTML webpage with a form defining the number of groups and the range of values

• All the necessary data should be sent by client, without storing anything on a server side

• Perform necessary modifications of the JS scripts and prepare .NET

• Set default values for number of groups and the range of values on the server side

(7)

Task 3 [WCF Bonus]

• Replace a WebApi Controller with an AJAX-enabled WCF Service

• Create a method returning an array of the objects containing a group name and an array of integer values

• Observe the returned object in the console and make the necessary adjustments in JavaScript and .NET WCF Service code

(8)

p. 8

Task 4 [WCF Bonus]

• Change the WCF web service in such a way that it will accept

the number of groups as a first argument and the range of values as the second one

• Separate data generation from setting the number of groups and range of values to different methods and store the settings in the Session

variables

• Perform client side and server side validation for max > min range

Cytaty

Powiązane dokumenty

W produkcji filmu wykorzystane zostaną obok za- chowanych do dzisiaj na wyspie reliktów pałacu Mieszka I i Bolesława Chrobrego także jego wirtualne modele oraz liczne

Lijst met afkortingen dlt doorlooptijd DSA Delft Systems Approach ERP Enterprice Resource Planning KOOP Klant Order Ontkoppel Punt MRP Material Requirement Planning Proper

• Before the cell is updated set its background to red colour and if the update is a success change it to white (you may add a Thread.Sleep on the server side to observe

• Create a GeoConverter.aspx WebForm for converting the geographical coordinates between the decimal and degrees minutes seconds format. • The user enters and submits the

– Do not display the form if the cookie with login is present – Add a link and a WebForm to delete the cookie. – A link displays the login from

Firstly, the full-motion simulator settings (experimental condition C7) were used to construct the shaping filters of Eqs. Secondly, with the shaping filters present, the motion

Lengte der buis 60,— cm 68,8 cm In deze buizen werden achtereenvolgens bollen van verschillend soortelijk gewicht en met verschillende middellijn neergelaten en daarbij werd

I chociaż in teresy poszczególnych pow iatów były różne, sejm u ch w alił rezolucję do k ró la, by zatw ierd ził pow ołanie tegoż zjednoczenia.. U chw alono