« Home « Chủ đề tài liệu web

Chủ đề : tài liệu web


Có 80+ tài liệu thuộc chủ đề "tài liệu web"

Bắt đầu với IBM Websphere smash - p 17

tailieu.vn

def quiz = invokeMethod('quiz.groovy', 'getQuizData', null) request.view = 'XML'. request.xml.output = quiz. Default is 'linkedHashMap' request.xml.rootElement = 'quiz'. request.xml.idRefs = true render(). The type of response is always dependent on the type of request and how you should render your output.. And basically, they are right, but that’s the point. REST is based on the HTTP protocol, which is well...

Bắt đầu với IBM Websphere smash - p 18

tailieu.vn

Get the ID of car to update, this param is fixed def carId = request.params.carId[]. logger.INFO {"Update starting for: ${carId}"}. The data to update the record with could be in any param def carData = request.params.someData[]. request.status = HttpURLConnection.HTTP_NO_CONTENT. Get the ID of car to delete, this param is fixed def carId = request.params.carId[]. logger.INFO {"Delete attempted for: ${carId}"}. request.status...

Bắt đầu với IBM Websphere smash - p 19

tailieu.vn

we need to secure all REST resources. Refer to Chapter 9, “Security Model,” for more information on setting up your actual key- store and truststore values, as these are specific to your Java environment.. Now that you’ve gotten the tools to test your services, you need to document each service resource and its methods. Figure 7.1 Adding RESTDoc tooling. Wouldn’t...

Bắt đầu với IBM Websphere smash - p 20

tailieu.vn

Databases Supported in WebSphere sMash. Before we begin, we need to cover the database vendors supported in WebSphere sMash. Vendors not listed will probably work as long as they support JDBC, and you can acquire the necessary driver files required to connect to the database server. The database vendors that are supported and known to work with WebSphere sMash are...

Bắt đầu với IBM Websphere smash - p 21

tailieu.vn

By using the ZRM delegate, you can potentially save yourself hundreds of lines of boiler- plate code per resource. Adding Data to a Zero Resource Model. Alternately, you can use the predefined sample page to manually add records one by one. To perform a bulk data load, you need to create a JSON data file in the /app/model/fixtures directory of...

Bắt đầu với IBM Websphere smash - p 22

tailieu.vn

logger.INFO{"Rows updated: ". A Delete action, because we have to clean out any bad stuff sql = "DELETE FROM bookmark WHERE tags like ?";. logger.INFO{"Rows deleted: ". Creating queries by assembling SQL statements from strings fragments has many disadvantages.. The other major issue with dynamically built SQL statements based on input parameters is the classic SQL injection attack. Listing 8.23...

Bắt đầu với IBM Websphere smash - p 23

tailieu.vn

ptg case Types.BIGINT: case Types.INTEGER:. case Types.NUMERIC: case Types.SMALLINT:. case Types.TINYINT: case Types.DECIMAL:. case Types.DOUBLE: case Types.FLOAT:. case Types.BINARY: case Types.BIT:. case Types.BOOLEAN:. map.put( 'headers', headers. row.put. ptg map.put('content', content). map.put('message', "Successfully retrieved ${rowCntr}. map.put('message', "No records found"). map.put('message', "${cnt} records processed."). map.put('message', "Error during SQL processing: ${e}". WebSphere sMash DBA—The Database Administrator Application. Start by creating a new WebSphere...

Bắt đầu với IBM Websphere smash - p 24

tailieu.vn

Figure 9.4 Main landing page. Create a new file called /public/index.gt, whose contents are shown in Listing 9.2.. Listing 9.2 Main Landing Page (/public/index.gt). <title>sMash Security</title>. <h1>Welcome to the Security Application</h1>. getRelativeUri(‘my/index.gt’) %>">Protected page</a>.. </h2>. You should then be taken to our main landing page, as shown in Figure 9.4.. To enable security, add the line shown in Listing 9.3....

Bắt đầu với IBM Websphere smash - p 25

tailieu.vn

<h2>Your group(s):</h2>. <li>${g}</li>. <h2><a href="<. getRelativeUri('/logout.gt')%>">Logout<a></h2>. The final page we need to add is a logout page. Listing 9.9 creates a logout page. You often should do some housekeeping on the “user” Global Context and remove any session-like variables that you do not want to persist into the user’s next access to the site. Listing 9.9 Logout Page (/public/logout.gt). zero.core.security.LoginService.logout();....

Bắt đầu với IBM Websphere smash - p 26

tailieu.vn

logger.INFO {"Starting with: ${args}"}. def URL = "https://crownjewels.acme.com/resources/${args.service}". if ( args.id. "/${args.id}. args.remove('service') args.remove('id'). args.eachWithIndex. logger.INFO {"URL: ${URL}"}. def doc = new XmlParser().parse( response.responseBody ) logger.INFO {"Results : ${doc}"}. In this example, we make a dynamic call to some service as defined by the method parame- ters, and receive an XML document as a response. In the first several lines,...

Bắt đầu với IBM Websphere smash - p 27

tailieu.vn

from the receiverUrl value in the event handler. We’ve surrounded it by logger statements including timestamps. Let’s take a mental trip over to the receiving application for a moment, forgetting that it’s actually residing within the same application on this sample. As you can see in the kicker event configuration, we are calling ”/resources/kickReceiver. which in this sample is another...

Bắt đầu với IBM Websphere smash - p 28

tailieu.vn

using most are the relative URI methods, and they are shown in Listing 11.1.. Listing 11.1 Java Relative URI API. static java.lang.String getRelativeUri(java.lang.String path) static java.lang.String getRelativeUri(java.lang.String path,. static java.lang.String getRelativeUri(java.lang.String path, java.util.Map<java.lang.String,java.lang.String>. queryParams) static java.lang.String getRelativeUri(java.lang.String path,. java.util.Map<java.lang.String,java.lang.String>. queryParams, java.lang.String fragment). So, if our calling script was located at http://localhost:8080/path/uriutils.gt, we would get the URIs shown in Listing 11.2.....

Bắt đầu với IBM Websphere smash - p 29

tailieu.vn

Figure 11.7 Manage Repository dialog Figure 11.6 Add Dependency dialog. ptg Figure 11.8 ACF dependency added. As you can see, we no longer get the alert dialog. Please see the WebSphere sMash documentation for more details (http://www.projectzero.org/sMash/1.1.x/. Assemble Flow. WebSphere sMash comes with several powerful built-in activities. Custom activities can also be created to extend the Assemble Flow system. Let’s...

Bắt đầu với IBM Websphere smash - p 30

tailieu.vn

ptg Take a look at the newly created index.html page (see Listing 12.1). By default, WebSphere sMash enables the light blue-hued soria theme, as shown in Listing 12.1.. Listing 12.1 Dojo-Enabled index.html Page. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">. <html xmlns="http://www.w3.org/1999/xhtml">. <style type="text/css">. @import "/dojo/resources/dojo.css";. src="/dojo/dojo.js". Line 10 djConfig="parseOnLoad: true"></script>. <script type="text/javascript">. dojo.require("dojo.parser". <body class="soria">. Let’s continue on to the parts that actually instantiate Dojo,...

Bắt đầu với IBM Websphere smash - p 31

tailieu.vn

282 Chapter 12 Client-Side Programming with the Dojo Toolkit. Table 12.1 Functional Requirements and Related REST Calls. DBA—A Complete RIA Using WebSphere sMash and Dojo. We have also heard that they want the application up and running by the end of the week!. We have enough information to sketch out a flow diagram of the application. Figure 12.8 provides a...

Bắt đầu với IBM Websphere smash - p 32

tailieu.vn

292 Chapter 12 Client-Side Programming with the Dojo Toolkit. Figure 12.13 Database schema tree listing. Then it creates a new Tree instance, passing in the backing DataStore, and setting up a handler for when a leaf node on the tree is clicked. Back in the load schema function, the accordion container is advanced to show the schema tree to the...

Bắt đầu với IBM Websphere smash - p 33

tailieu.vn

ptg Figure 13.1 Adding PHP dependency to your application. PHP Applications. The WebSphere sMash development team is working hard to address these issues to provide near full support for all PHP APIs and applications. Check the Project Zero website for the latest list of applications that are known to work with WebSphere sMash. The following popular PHP applications are known...

Bắt đầu với IBM Websphere smash - p 34

tailieu.vn

312 Chapter 13 PHP in WebSphere sMash. Listing 13.5 Common Template for PHP Extension Classes. import com.ibm.phpj.xapi.ExtensionBaseImpl;. import com.ibm.phpj.xapi.RuntimeContext;. import com.ibm.phpj.xapi.annotations.XAPIExtension;. import com.ibm.phpj.xapi.annotations.XAPIFunction;. You can choose to have a public “PHP” function name, and a private “Java” name. For example, the PHP annotation of the function could be called my_function , whereas the actual Java function name could remain myfunction...

Bắt đầu với IBM Websphere smash - p 35

tailieu.vn

ptg Figure 13.10 Results of a simple_xml request. There are few topics that should to be discussed on this sample. First, the get_connection() call requires the zero:zero.php.connection dependency. So, it needs to be added to the project, or else you will receive an error about a missing function. Technically, you also need to enable the zero.php.ConnectionExtension , but it’s enabled...

Bắt đầu với IBM Websphere smash - p 36

tailieu.vn

This can be used for system-level processing that needs to occur without user interac- tion (see Table 13.13).. Table 13.12 CSFT Functions. Table 13.13 Login Service Functions. ptg Table 13.14 Database General Functions. Manager mgr—DataSource manager to use.. Manager—Handle to the DataSource Manager.. Creates and returns a DataSource of the given type. As soon as one of the mechanisms is...