WebSphere Portal Portlet API

xiaoxiao2021-03-06  92

This section provides a brief description of the Portlet API.

Overview Portlet Concept Portlet API Elements Core Objects Listener Configuration Objects Miscellaneous Object Portlet Event PortletService Deployment Descriptor

Overview

Portlets are a reusable component that can be provided to web-based content, applications, and other resource access. The web page can be accessed via the portlet, web services, applications, and Cindida content supply. Companies can create their own portlets or select Portlet from third-party portlet catalog. Portlet is intended to be assembled into a larger portal page, where multiple instances of the same portlet displays different data for each user.

From a user's point of view, Portlets are a window that provides specific services or information (eg, providing calendars and news) in the portal site. From an application developer's point of view, portlet is an insertable module that is designed to run in the portlet container of the portal server.

Portlet containers provide a runtime environment that instantiates, uses, and ultimately destroyed portlets in this environment. Portlets rely on the portal infrastructure to access user profile information, participate in the window and operational events, communicate with other portlets, access remote content, find credentials, and storage persistent data. Portlet API provides standard interfaces for these features. Portlet containers are not a stand-alone container similar to a servlet container. It is implemented as a thin layer on the servlet container and reuses the functions provided by the servlet container.

IBM is working with other companies to standardize the Portlet API, so that the portlet can be used in collaboration between portal servers implementing this specification. The portlet API provided in WebSphere Portal version 4.1 is the first step towards the Standling of Portlet API. For more information on portlet specification, see

http://jcp.org/jsr/detail/168.jsp

Portlet and Servlet API

Abstract portlet classes are the core abstraction of the Portlet API. Portlet class expands the HTTPSERVLET for the Servlet API. All portlets extend this abstract class indirectly, inheriting from httpservlet, as follows:

... - javax.servlet.http.httpservlet

|

- org.apache.jetspeed.portlet.portlet

|

- Org.apache.jetspeed.portlet.portletApterapter

|

- com.mycompany.myApplication.myportlet

Therefore, Portlet is a special type of servlet. This type of servlet features them easily inserted and run in the portal server. Unlike servlets, portlets cannot send redirects or errors directly to browsers, forward requests, or write any marked to output stream. The portlet container depends on the J2EE architecture implemented by the WebSphere Application Server. As a result, portlet is packaged in a way similar to J2EE Web applications and deployed in a way similar to servlet.

Generally speaking, the management of portlets is more dynamic than servlet. You can apply the following updates without starting and restarting the portal server:

You can use the portal to manage the user interface to install and remove portlet applications consisting of several portlets. The portlet settings can be changed by administrator changes with appropriate access You can use the management portlet to dynamically create and delete portlets. For example, once an administrator creates a new crop, cropping the portlet can be used to create a new portlet instance. The portlet container depends on the J2EE architecture implemented by the WebSphere Application Server. As a result, the portlet is packaged in the WAR file in a way similar to the J2EE web application and deployed in a way similar to servlet. Similar to other servlets, use the servlet deployment descriptor (web.xml) to define the portlet to the application server. This file defines the class file and read-only initialization parameters of the portlet.

The figure below shows the portlet after deploying its WAR file. Each portlet for deployment on the portal server is created on the application server, or a portlet class instance is created on the application server.

The initialization parameter is set by the portlet developer and can be read by the portletConfig object. The Servlet deployment descriptor can contain multiple web applications, each of which is defined by the element. In addition, each servlet definition can point to the same portlet class file, which can create different portletconfig objects for each portlet class instance using different initialization parameters. To get more information, see the web application deployment descriptor.

Portlet deployment descriptor

In addition to the servlet descriptor, Portlet must also provide portlet.xml to define the ability of portlets for portal servers. This information contains configuration parameters specific to specific portlets or portlet applications, as well as general information provided by all portlets (such as portlets supported by portlet). The portal server uses this information to serve the portlet. For example, if the portlet registers its support in the portlet deployment descriptor, the portal server will present the icon to allow the user to call the help and editing page of the portlet.

The following is a sample portlet deployment descriptor with minimal tag.

my portlet application

my portlet

my concrete portlet application

my concrete portlet

en

my portlet </ title></p> <p></ logage></p> <p></ concrete-portlet></p> <p></ concrete-portlet-app></p> <p></ portlet-app-def></p> <p>To get more information that contains a description of each tag, see Deploying a descriptor.</p> <p>Portlet concept</p> <p>The following image shows that the portlet is placed on the page to place portlets and users access portlets. Note that the first two steps involve the use of persistent data, but for the third step, the data is only available during the session duration.</p> <p>The portal administrator uses the management interface to deploy a new portlet application WAR file or install a copy of the portlet. Both operations create a concrete portlet, which is a portlet that is parameterized by a single portletSettings object. Each portlet may have multiple specific portlets. PortletSettings is a read / write access and is lasting. PortletSettings contains configuration parameters defined in the portlet deployment descriptor.</p> <p>Using specific portlets can run instances of different configurations of many portlets without creating additional portlet class instances. Many specific portlets can be created and destroyed during the life cycle of a single portlet. None explicitly represents the object of the specific portlet. The same specific portlet can be shared between many users.</p> <p>Users or administrators put portlets on the page. This creates a concrete portlet instance, which is a specific portlet that is parameterized by a single portletdata object. Each specific portlet may have a plurality of specific portlet instances. PortletData stores lasting information for portlets added to the page. For example, users can edit stock quotation portlets and save a list of stock symbols for company tracking.</p> <p>The scope of the portletdata depends on the scope of the page where the specific portlet is located.</p> <p>If the administrator places the specific portlet to the group page, the portletdata object contains data stored for the user. This will remain in the user group to view access to the page. However, if the user has an editing access to the portlet on the group page, create a new specific portlet instance for each user of the portlet. In this case, PortletData contains data for each user of the portlet. If the specific portlet is placed on the user's page, the portletdata contains the data of that user.</p> <p>When the user accesses a page containing the portlet, a user portlet instance is created. When the user logs in to the portal, the portal server creates a portletSession for each user's portlet. PortletSession parameterized concrete portlet example is called a user portlet instance. Each specific portlet instance may have multiple user portlet instances. The user portlet instance is a specific portlet instance for a single portletSession parameterized. Each specific portlet instance may have multiple user portlet instances. PortletSession storage is instantaneous information related to a single use portlet.</p> <p>Portlet application</p> <p>The Portlet application provides a method of encapsulating a portlet that shares the same context. The context contains all resources, such as images, attribute files, and classes. All portlets must be encapsulated as part of the portlet application.</p> <p>Specific portlet application</p> <p>The specific portlet application is a portlet application that is parameterized by a single portletApplicationSettings object. For each portlet application, there may be multiple specific portlet applications. PortletApplicationSettings is a read / write access, and is lasting. None explicitly represents the object of the specific portlet application.</p> <p>The specific portlet application contains at least a specific portlet from the portlet application, but no need to contain them.</p> <p>Portlet applications do not provide code, but form a logical group for portlets. In addition to this more logical revenue, the portlet of the same portlet application can also exchange messages.</p> <p>Portlet</p> <p>Portlets allow portlets to display different user interfaces, depending on the tasks required for the portlet. Portlets have four display modes that are defined in the portlet deployment descriptor. The portlet container maintains the portlet mode in the portlet.mode object. Provides the following ways through the Portlet API:</p> <p>view</p> <p>When the portlet is initially built on the portal page, it is displayed in its view mode. This is the normal operation of the portlet.</p> <p>help</p> <p>If this method is supported by portlet, the portlet provides the user with a help page to get more information about portlets.</p> <p>edit</p> <p>If the way is supported by the portlet, the portlet provides the user to customize the portlet by itself. For example, Portlets provide a page to specify its location to obtain local weather and event information. Users must log in to the portal to access the edit method.</p> <p>Configure</p> <p>If the way is supported by portlet, the portlet provides a page for the portal administrator to configure portlets to the user or user group.</p> <p>Portlet API provides a way to determine the current or previous way. All portlets must support view mode. Portlet containers provide users to interact with portlets on their portal page. Click one of the controls to change the way or status of the portlet. The portlet is displayed in the blank title bar in the view mode.</p> <p>This title bar shows editing, help, minimizing, and maximizing icons. Click the pencil to make a portlet in edit.</p> <p>Portlet status</p> <p>The portlet state allows the user to change how the portlet window is displayed in the portal. In the browser, the user calls these status with icons in the title bar, which is the same as the operation method of the Windows application. The portlet status is maintained in the portletWindow.State object with the Boolean value.</p> <p>When you first build a portlet on the portal page, it is displayed in normal status - arranged with other portlets on the page. When maximizing portlets, it is displayed as the entire body of the portal, replacing the view of the other portal. Minimize when minimizing portlets, only the portlet title bar on the portal page is displayed. Portlet API provides a way to the portlet to determine the current state.</p> <p>Portlet API elements</p> <p>This section describes the basic interfaces, classes, and methods of the Portlet API. The following figure shows the structural diagrams of many common objects in the portlet API.</p> <p>Portlet extension by portletadapter</p> <p>Service () 1 portletResponse</p> <p>Createuri () portleturi service () 1 portletRequest</p> <p>GetPortletSettings () portletsettings</p> <p>GetletApplicationSettings PortletApplicationSettings getMode () portlet.mode getclient () Client getdata () portletdata getwindow () portletwindow</p> <p>GetWindowState () portletwindow.state getPortletSession () portletsession getUser () user getPortletconfig () portletconfig</p> <p>getContext () PortletContext</p> <p>GetLog () PortletLog GetService () PortletService</p> <p>1 PortletRequest and PortletResponse are passed by the Helper method of PortletAptaPter (such as Doview ()).</p> <p>Portlet class</p> <p>Abstract portlet classes are the core abstraction of the Portlet API. All portlet extends the abstraction class by extending one of the subclasses of abstract classes (eg, portletadapter), which provides methods that help developers.</p> <p>Portlet life cycle</p> <p>Portlet container calls the following method 2 of the abstract portlet during the lifecycle of the portlet:</p> <p>init ()</p> <p>After the portal is initialized, that is, the portlet is constructed and then initialized using the init () method. The portal always instantizes a single instance of the portlet, and this instance is shared between all users, exactly the same as the servlet shared between all users of the application server.</p> <p>INITCONCRETE ()</p> <p>After constructing the portlet, the specific portlet before the first visit to the portlet.</p> <p>PortletSettings instantiates.</p> <p>Service ()</p> <p>When you ask portlets to present its content, the portal calls the service () method. The service () method is usually called multiple times during the life cycle of the portlet. For each portlet on the page, it is not called the service () method in the order of the guaranteed order, and may even call the service () method in different order for each request.</p> <p>DestroyConcrete ()</p> <p>Use the DestroyConcrete () method to remove the specific portlet from the service. This may happen when an administrator deletes a specific portlet during the running time of the portal server.</p> <p>DESTROY ()</p> <p>When the portal is about to terminate, the portlet will cancel the service and then use the destroy () method to destroy. Finally, the portlet is collected and ended as useless information.</p> <p>2 This represents the method that is called on all portlets. Call other methods for the portlet of the listener. See the listener lifecycle for more information. getLastModified ()</p> <p>In addition to the method called during the portlet lifecycle, the portlet container calls the getLastModified () method for each portlet request. This method returns the last time (in millisecond meter) of the change of the portlet content, this time is UTC in the current time and midnight on January 1, 1970 (java.lang.system.currentTimeMillis ()) or is negative (if time unknown). To get more information about when using getLastModified (), see Refresh the portlet cache.</p> <p>Helper class</p> <p>Portlets are not directly extending the abstract portlet class, but extended portletadapter or any other helper class to extend the portlet. Extend one of these classes to help protect portlets from abstract portlet class changes. In addition, it saves all methods of all portlet interfaces, even if portlet does not need to use them all. With the portletadapter class, simply override the truly needed approach.</p> <p>In its service () method, the portletadapter class calls the method corresponding to the portlet. Extending the portlets of this class overwrites Doview (), doedit () and dohelp () methods without having to test the method or write a specific service () method.</p> <p>In addition, portletadapter enables portlets to store variables in specific portlets. Specific portlet variables are different from Java instance variables because they are bound to the portlet class or a non-specific portlet. PortletApaater provides setvariable (), getVariable (), and RemoveVariable () methods and specific portlet variables.</p> <p>Core object</p> <p>The following objects are the most commonly used in portlet:</p> <p>PortletRequest PortletResponse PortletSession</p> <p>Each of these objects is an extension of its copy in the servlet API.</p> <p>PortletRequest</p> <p>PortletRequest objects are passed to portlets via login (), beginPage (), and provide specific data for portlets and allowing it to access further important information listed below.</p> <p>Attributes</p> <p>The attribute is the name / value pair related to the request. Attributes can only be used for the scope of the request. During a request, the portlet can get, set, and remove properties.</p> <p>parameter</p> <p>The parameter is a name / value pair sent by the client, which is part of the request in the URI query string. Usually the parameter is published from the form. The parameter is used for a scope of a particular request. Portlets can get the parameters from request acquisition but cannot set.</p> <p>Client computer</p> <p>Client objects encapsulates information about the user agent on a particular request. From</p> <p>Client's information contains the tag types supported by the manufacturer or client of the user agent. Use the getClient () method from</p> <p>PortletRequest extract</p> <p>CLIENT. Can</p> <p>Client Get the following information:</p> <p>User agent</p> <p>Portlets can get the string sent by the user agent to identify itself to the portal.</p> <p>Tag name</p> <p>Portlets can get a string that indicates the markup language supported by the client, such as "WML".</p> <p>MIME type</p> <p>Portlets get a string that indicates the MIME type supported by the client (eg</p> <p>TEXT / VND.WAP.WML). If the portlet supports multiple device types, it will get the tag name instead of the MIME type. The following table shows the MIME type and their corresponding tag types. Retrieve the MIME type does not distinguish between HTML and ChTML tags. MIME Type Tag Type Text / HtmlHtmlText / VND.Wap.WmlWmlText / HTMLCHTML</p> <p>ability</p> <p>The Capability object is more detailed than the tag type (what is the level of the client supports), such as HTML, JavaScript, or WML table.</p> <p>User data</p> <p>PortletData object represents data for the specific portlet instance saved to lasting storage. For example, users can set up a portlet email application to check new messages every 30 minutes. in</p> <p>The preferences are stored in the PortletData object.</p> <p>Session</p> <p>PortletSession represents instantaneous data of a specific user of multiple requests. With the request comparison, the request does not reserve the data after the request is complete, and the session property can be more than one request record / saved.</p> <p>Portlet settings</p> <p>PortletSettings object represents the configuration of the specific portlet saved to lasting storage. For example, an administrator can set which host and port should be connected to getting real-time data. in</p> <p>The PortletSettings object stores this preference for the specific portlet.</p> <p>the way</p> <p>Portlet.Mode provides the current or previous portlet.</p> <p>PortletWindow</p> <p>PortletWindow object represents the current portlet window</p> <p>status. Portlets can access the object to determine that the current portlet is to maximize, minimize or its normal view is rendered.</p> <p>ModeModifier</p> <p>Before presenting portlets, you can use this object to set the portlet to its current, previous or request. For example, a portlet in an edit mode can handle user operations and allow portlets to return to edit methods to wait for more inputs before returning a view mode.</p> <p>PortletResponse</p> <p>The response object package returns from the server to the client information. PortletResponse passes the BeginPage (), EndPage () and Service () methods and can be used by portlets to return to the portlet output by using Java PrintWriter. Responding to the method of creating a portleturi object or restricting the portlet tag using the namespace of the portlet.</p> <p>Use one of the following methods to create portleturi:</p> <p>Createuri ()</p> <p>Create a call mode for the current way portlet</p> <p>Portleturi object</p> <p>Createuri (portletWindow.State</p> <p>State)</p> <p>Create a portlet that points to the call mode for the current mode and a given portlet window status</p> <p>Portleturi object.</p> <p>Createreturnuri ()</p> <p>create</p> <p>Portleturi pointing to the caller of portlet. For example, CreateReturnuri () can be used to create a postback button in the edit mode.</p> <p>Each portlet runs in its own unique namespace. Portlets use the EncodeNameSpace () method to bring the property to the portlet output to avoid names with other portlet conflicts. The property contains parameter names, global variables, or JavaScript function names.</p> <p>Portleturi</p> <p>The portleturi object contains the URI to the portlet instance and can be further expanded by adding a specific portlet or by additional operations.</p> <p>Operation is an activity of a particular portlet, but before calling the portlet service () method, it needs to be executed in the result of the inbound request. For example, when the user enters the data in the portlet editing method and click the Save button, the portlet needs to process the published data before generating the next tag. This can be implemented by adding the save operation to the URI of the representative save button. The complete URI can be converted to a string that can be embedded in the tag.</p> <p>PortletSession</p> <p>PortletSession Save the specific user data of the specific portlet instance of the portlet, create a portlet user instance. The specific portlet instances differ only in the data stored in their portletdata. The difference between the portlet user instance is only in instantaneous data stored in their portletations. Any persistent data must be stored using portletdata. Information stored in the instance variable of portlet is shared between all specific portlet instances (or even all specific portlets) through read and write access. Make sure that the instance properties are not used for user-specific data.</p> <p>On the other hand, you must carefully treat the portlet to a session, especially if the portlet runs in a cluster environment, the environment is where the shared database serialization session. Anything stored in a session must also serialize.</p> <p>Similar to httpsession, PortletSession is not available on anonymous page. During login, the portlets will be automatically created for each portlet on the page. To get portletSession, you must use the getSession () method (available in portletRequest). This method returns the current session, or if there is no current session, and given the parameter "CREAT" is True, it will create one and return it.</p> <p>Listener</p> <p>Portlet API provides a listener that adds more features to portlets. To enable the functions of the listener, the portlet must implement one of the following interfaces.</p> <p>PortletSessionListener PortletpageListener PortletTitleListener PortletSettingSttributesListener PortletApplicationSettingSattributeSlistener</p> <p>PortletSessionListener</p> <p>In addition to the specific portlet instance of the portlet that appears on the page, the portlet may have a finer granularity. PortletSessionListener enables portlets to identify the lifecycle of the user portlet instance:</p> <p>Login () After the user logs in to the portal, each portlet creates a session for the user. The specific portlet example and a combination of a user session creates a user portlet instance. The launch of the user instance is sent by the portal to call the login () method on the portlet. This method allows the portlet to initialize the user's PORLET session instance, for example, to store properties in a session. Logout () When the user ends a session with the portal, the portal server calls the logout () method to notify the portlet user's session instance is terminating. The portlet will then clear any resources of the portlet user instance.</p> <p>Portletpagelistener</p> <p>Portlets are not used to write control or consciousness of the output order of all portlets on the page. PortletPageListener allows the portlet to start and end insert tags on the page.</p> <p>BeGinPage () Call the BeginPage () method for each portlet () method that resides on the page before the start of each page and any service () method of any portlet on the page. Similar to the service () method, each portlet on the page is not called the beGinPage () method in the promised sequence surface, and may even call the beGinPage () method for each request. This method allows the portlet to output JavaScript visible to all portlets, or even set cookies or headers. After EndPage () After the end of each page and the service () method of all portlets on the page, the endpage () method is called for each portlet on the page. Similar to the service () method, not the endpage () method is called in the order of the guaranteed order, and even for each request, the endpage () method is called in different order. For example, portlets can insert a JavaScript that needs to occur after all other elements of the page are written to the end of the page. Listener life cycle</p> <p>When implementing portletSessionListener and portletpagelistener, the following methods are called on the portlet during the life cycle.</p> <p>Init () non-specific portlets and portletconfig together initialize. INITCONCRETE () specific portlets and portletsettings are initialized together. Login () User Portlet instance is initialized together with PortletSession. BeginPage () portlet may start an output every page at each page of each request. Service () portlet may present an output in each requested portlet window. Endpage () portlet may present an output at each page of each request. Logout () destroys the user portlet instance. DestroyConcrete () destroys specific portlets. Destroy () destroys non-specific portlets.</p> <p>PortlettittleListener</p> <p>As shown in the title bar, the portlettitlelistener interface is used to allow a condition (for example, device type for accessing the portal) or user input (for example, the user who sets up on the edit page) to change the portlet title. If a listener is not implemented, the portlet is displayed on the <title> element (<Language> below) of the Portlet deployment descriptor.</p> <p>PortletSettingSattributeSlistener</p> <p>This interface listens to the changes to the portletsettings attribute, similar to the Administrator to configure the specific portlet.</p> <p>PortletApplicationSettingSattributeSlistener</p> <p>This interface listens to changes to the portletApplicationSettings attribute, similar to the Administrator to configure the specific portlet application.</p> <p>Configuration object</p> <p>Portlets use the following objects to retrieve and store data, depending on how to use data:</p> <p>PortletConfig PortletSettings PortletApplicationSettings Portletdata</p> <p>PortletConfig</p> <p>PortletConfig Configure its initialization to provide non-specific portlets. Configure information with the portlet class. This information takes effect for each specific portlet from portlet.</p> <p>The PORTLE configuration first reads the descriptor from its Servlet deployment. This information is defined by the portlet developer. The configuration is read-only, and the portlet cannot be changed. Pass PortletConfig to the portlet in an abstract portlet's init () method and use GetInitParameters () to access specific portlet configuration parameters. The portletconfig parameter is the name / value pair available throughout the non-specific portlet lifecycle. The parameters of non-specific portlet are defined by the <init-param> tag in the Servlet deployment descriptor.</p> <p>PortletSettings</p> <p>PortletSettings objects provide its dynamic configuration to the specific portlet. Configure information that has a specific portlet. This information is valid for each of the specific portlets of the specific portlet.</p> <p>The specific portlet configuration is first read from the portlet deployment descriptor. This configuration is read-only and only when the portlet can be written by the portlet in the configuration mode. This information is usually maintained by the portal administrator and may be changed when the portal server is running. The portlet can get, set, and remove properties during a request. To submit changes, you must call the Store () method.</p> <p>PortletSettings objects can be accessed by the getPortletSettings () method available for PortletRequest. Typically, it is used to use GetAttribute () to access specific portlet configuration parameters. The attribute is the name / value pair of the entire specific portlet lifecycle. The specific portlet attribute is defined by the <config-param> tag in the portlet deployment descriptor.</p> <p>PortletApplicationSettings</p> <p>PortletApplicationSettings object provides its dynamic configuration to the specific portlet application. Configure information about portlet applications that have all specific portlet shares included in the application.</p> <p>The specific portlet application is first read from the portlet deployment descriptor. This configuration is read-only and only when the portlet can be written by the portlet in the configuration mode. This information is usually maintained by the portal administrator and may be changed when the portal server is running. During a request, the portlet in the application can get, set, and remove properties. To submit changes, you must call the Store () method.</p> <p>PortletApplicationSettings can be accessed by the getApplicationSettings () method available by the PortletSettings object. It is used to use GetAttribute () to access specific portlet configuration parameters. The attribute is the name / value pair of the entire specific portlet application lifecycle. The specific portlet application properties are defined by the <context-param> tag in the portlet deployment descriptor.</p> <p>Portletdata</p> <p>PortletData has data for specific portlet instances. Each of the page has a specific portlet instance. PortletData contains persistent information about the specific portlet instance, while portletsSession only contains instantaneous data of the user portlet instance.</p> <p>There is a specific portlet instance on each of the portlets on the page. The page can have a single user (personal home page) or a single user group (group page). PortletData contains specific user data on the Personal Home page, which contains specific group data on the group page.</p> <p>The portletdata object stores the property as name / value pair. The portlet can get, set, and remove properties during a request. To submit changes, you must call the Store () method. The data is read-only and only when the portlet can be written by the portlet in editing mode. Miscellaneous object</p> <p>The following objects are used by portlets:</p> <p>PortletContext PortletLog PortletWindow User</p> <p>PortletContext</p> <p>The portletcontext interface defines the portlet view of each portlet container that runs in. PortletContext also allows portlet to access its available resources. For example, using context, portlets can access the portlet log, accessing the portlet to all portlets in the application, which is a common context parameter, get the URL reference to the resource, or access the portlet service.</p> <p>A very important detailed information about PortletContext is described below.</p> <p>INITPARAMETERS</p> <p>The parameter is a name / value pair available in all portlets in the web application. These definitions under the <context-param> element in the Web Deployment Descriptor. For example, if a set of portlet sharing includes a context parameter named "Webmaster" named "Webmaster", each portlet may get that value and provide "mailto" link in their help.</p> <p>Attributes</p> <p>The property is a name / value pair available in all portlets in the web application. Portlets can get, set, and remove properties. The context of the attribute is stored on a single machine and is not distributed in the cluster.</p> <p>Localized text</p> <p>The GetText () method is portlet to access the resource bundle in a given language environment.</p> <p>Resource</p> <p>by</p> <p>PortletContext, portlet can be loaded or included in the portlet application scope. The available methods include include () and getResourceceAsStream (). Include () method is usually used to call JSP for the output.</p> <p>Message delivery</p> <p>Communication between portlets and shared data by message delivery, or sending notifications may be possible. Send messages by using the send () method. For more information, see</p> <p>Portlet message delivery</p> <p>Portlet service</p> <p>PortletService object allows portlets to be insertable through dynamic discovery.</p> <p>Log</p> <p>PortletLog objects provide portlet logging information, warning, or error messages. The log is maintained by the portlet container. Enable or not enable the log log is determined by the portlet container. For more information, see</p> <p>Message and tracking logs.</p> <p>This object can also be obtained from getPortletLog () from the PortletApter class.</p> <p>PortletWindow</p> <p>PortletWindow object represents the window of the package portlet. For example, on an HTML page, the Portlet window can usually be rendered as a table unit. The portlet window can send events on its various window controls, such as the user clicks minimized or off. Portlets can ask the window in turn on its current state. For example, the portlet may exhibit its content differently, depending on whether it is maximized. PortletWindow is available using the getWindow () method of the portletRequest object.</p> <p>User</p> <p>The USER interface contains methods accessing user properties such as a full name of the user or username.</p> <p>Portlet event</p> <p>The portlet event contains information about events that may require a response. For example, an operating event will be generated when a user clicks on a link or button. To receive the notification of the event, the portlet must implement an event listener in the portlet class. Operating Event: Generate when the HTTP request is received by receiving the portlet container associated with the operation (such as when the user clicks on the link). Message Event: Generate when another portlet in the portlet application sends a message. Window event: Generate when the user changes the status of the portlet window.</p> <p>Before generating new content requirements (and therefore portlet), the Portlet container sends all events to their respective event listeners. If the listener finds another event when the listener is processed, the event will be queued by the portlet container and transmitted at the moment of the portlet container. It is guaranteed to send it and happen before the content production phase.</p> <p>Once the content is started, there will be no further events will be sent. For example, a message cannot be sent from BeGinPage (), service () and endpage (). The result message event will not be sent and substantially discarded.</p> <p>Implement the event listener directly in the portlet class. The listener can access portletRequest from events and responses using the portletRequest or PortletSession property.</p> <p>Operating event</p> <p>When receiving the HTTP request associated with portletivity, send an ActionEvent to Portlet. To receive an operation event, the portlet class must implement an ActionListener interface and an object with the portletAction type. PortletAction links to the URI that uses the portleturi class and its addAction () method. ActionEvent can be used to get associated portletAction and portletRequest.</p> <p>Typically, portletAction is linked to the HTTP reference or button in the HTML form. The ActionEvent that is then click the ActionEvent to transmit the associated portletAction back to the portlet, which can act in sequentially different processing paths based on user operation. Portlet operations can transmit any information. However, it should not store requests, response, or session objects. This information is part of the operational event and will be sent to the registered listener.</p> <p>The following shows how JSP uses URIs, including portletAction. When the user clicks the "Add" button, a new HTTP request is sent to the operation URL of the form.</p> <p><Form method = 'post' action = '<% = EditBean.getadduri ()%>>>>></p> <p>Name: <input name = 'bookmark.name'> <br></p> <p>URL: <input name = 'bookmark.URL'> <br></p> <p><Input Type = 'Submit' Name = 'AddButton' Value = 'Add'> <br></p> <p></ Form></p> <p>The following shows how ActionListener distinguishes operation.</p> <p>Public void actionPerformed (ActionEvent Event)</p> <p>{</p> <p>PortletAction_Action = event.getAction ();</p> <p>IF (_action instanceof defaultletlet) {</p> <p>...</p> <p>DefaultPortletAction Action = (default) _action; if (action.getname (). Equals ("add")) {</p> <p>...</p> <p>See Using Persistence Code Example, showing how to add an action to the portlet and create an actionListener.</p> <p>DefaultPortletAction</p> <p>Portlet API is available to the defaultportletAction class default parameters, and the portlet can use it to implement the portletAction object. You can create portletAction based on defaultletAction, or use it to implement your own portletAction. The following shows how to create defaultportletAction:</p> <p>DEFAULTPORTLETACTION AddAction = New DefaultPortletAction ("Add");</p> <p>The following shows how to put the portletAction to the URI:</p> <p>Portleturi Adduri = response.createuri ();</p> <p>DEFAULTPORTLETACTION AddAction = New DefaultPortletAction ("Add");</p> <p>Adduri.Addaction (AddAction);</p> <p>Window event</p> <p>Whenever the user clicks on one of the control buttons that change the window status, if maximizes, minimizes, or recovers, WindowEvent is sent by the portlet container. For example, when the user maximizes the portlet displayed in its normal status, you can display more information using WindowEvent. To receive a window event, you must implement the WindowListener interface in the portlet class.</p> <p>The Portlet API provides a WindowAdapter class that implements an empty way for WindowListener. By expanding Windowadapter, portlet developers only need to implement the callback methods required for portlets. Without Windowadapter, all callback methods must be implemented, even if the method is empty. See refreshing the portlet cache for examples of WindowListener.</p> <p>Message event</p> <p>If the recipient portlet is a member of the same portlet application, and the message event can be sent from a portlet to other portlets as a portlet being sent. In addition, DEFAULTPORTLETMESSAGE can span all portlets of the portlet application boundary and sent to the page. MessageEvent can be sent to other portlets only when the portlet is in the event processing cycle of the portlet container, otherwise an exception will be thrown. There are two different types of messages:</p> <p>Single Addressing message: Send a message to a specific portlet by specifying the portlet name on the Send () method. Broadcast News: Send messages on all portlets on the page.</p> <p>When a portlet is changed to another portlet, the message event is useful. You must implement an object with a portletMessage type, which is passed through MessageEvent. The portlet of the received message must implement the MessageListener interface and objects with portletMessage types.</p> <p>To get an example of how portlet can send a message in mutual messages, see the portlet message.</p> <p>PortletService</p> <p>In order for the portlet to use the insertable service by dynamic discovery, the portletspacement interface is provided. PortletService is accessible from the portletContext.getService () method to find the appropriate factory to get the service, create a service and return it to the portlet. Various services can be implemented through different suppliers, such as SearchService, LocationService, ContentAccessService, or MailService. Portlet API provides ContentAccessService.</p> <p>Create your own portlet service</p> <p>Writing the portlet service contains four steps:</p> <p>Define the factory registration service that implements the service written service</p> <p>If you want to implement your service with your existing interface, step 1 is not required. If you want to reuse the existing service factories, this situation is also applicable to step 3.</p> <p>Define interface</p> <p>Defining the portlet service interface requires the same strict consideration as defining any public API interface. The portlet service interface must only extends the PortletService interface in the org.apache.compate package, which is similar to the logo, which is similar to the Java API's Serializable interface.</p> <p>Below is a HelloWorldService sample interface.</p> <p>Package my.portlet.service;</p> <p>Import org.apache.jetspeed.portlet.service. *;</p> <p>Public Interface HelloWorldService Extends PortletService</p> <p>{</p> <p>// my service's method</p> <p>Public String Sayit ();</p> <p>}</p> <p>Write service implementation</p> <p>The service implementation must implement the PortletServiceProvider interface of the org.apache.jetspeed.portlet.Service.SPI package, which in addition to the service interface, you can use the portlet service lifecycle method. For example, the portletServiceConfig parameter of the init method allows you to access the service configuration (see the registration service to get more information).</p> <p>Package my.portlet.service.Impl;</p> <p>Import org.apache.jetspeed.portlet.service. *;</p> <p>Import org.apache.comjetspeed.portlet.service.spi. *;</p> <p>Public Class HelloWorldServiceImpl Implements HelloWorldService, PortletServiceProvider</p> <p>{</p> <p>Private string it = null;</p> <p>Public void destroy ()</p> <p>{</p> <p>// do nothing - no resources in us</p> <p>}</p> <p>Public void init (portletServiceConfig config)</p> <p>{</p> <p>IT = config.getinitParameter ("my_message");</p> <p>IF (IT == NULL)</p> <p>IT = "Hello World !!!";</p> <p>}</p> <p>Public String Sayit ()</p> <p>{</p> <p>Return IT;</p> <p>}</p> <p>}</p> <p>Writing the factory</p> <p>Usually, you don't have to write your own factory because there are two class factories that are provided with the portal server in the org.apache.jetspeed.portLetcontainer.Service package. PortletServenticeDefaultFactory always returns a new instance of a given service, PortletServiceCacheFactory always returns the same instance as a given service. You can use one of these plants instead of as a single implementation. The factory must implement the portletServiceFactory interface of the org.apache.jetspeed.portlet.Service.SPI package. Below is a factory class of HelloWorldService:</p> <p>Package my.portlet.service.Factory;</p> <p>Import org.apache.jetspeed.portlet.service. *;</p> <p>Import org.apache.comjetspeed.portlet.service.spi. *;</p> <p>Public Class HelloWorldServiceFactory Implements PortletServiceFactory</p> <p>{</p> <p>PortletServiceProvider PSP = NULL;</p> <p>Public PortletService CreatePortletService (Class Service,</p> <p>Properties ServiceProperties,</p> <p>ServletConfig ServletConfig</p> <p>Throws portletServiceunavailableException</p> <p>{</p> <p>IF (psp! = null) {</p> <p>Return PSP;</p> <p>}</p> <p>Else {</p> <p>PSP = New HelloWorldServiceImpl ();</p> <p>PSP.INIT (New PortletServiceConfigIMPL)</p> <p>Service,</p> <p>ServiceProperties,</p> <p>servletConfig);</p> <p>Return PSP;</p> <p>}</p> <p>}</p> <p>}</p> <p>Registration service</p> <p>To insert a service into the portal server, the corresponding class file must be copied to WAS_ROOT / LIB / APP. Then you must change the portletServices.properties file in the WP_ROOT / App / WPS.EAR / WPS.WAR / web-INF / conf directory:</p> <p>Provide configuration parameters for implementation as the corresponding service type to implement registration factories for implementation</p> <p># PortletServices.properties</p> <p>Org.apache.jetspeed.port.Service.default.Factory =</p> <p>Org.apache.jetspeed.PortletContainer.Service.portletServiceDefaultFactory</p> <p>...</p> <p>My.portlet.service.helloworldService = my.portlet.service.impl.HelloworldServiceImpl</p> <p>My.portlet.Service.Impl.helloWorldServiceImpl.Factory = my.portlet.service.factory.HelloWorldServiceFactory</p> <p>My.portlet.service.impl.HelloworldServiceImpl.my_message = Hello World (Properties)!</p> <p>...</p> <p>Content access service</p> <p>Various services can be implemented through different vendors (eg, SearchService or MailService). Usually when you must use a proxy, the Portlet API provides ContentAccessService from the internal network. This service allows portlets to access content from JSP and Servlet from a remote Web site or portal web application. (Instead, the portletcontext.include method can only contain local JSPs of the portlet application: ContentAccessService</p> <p>Import org.apache.jetspeed.portlet.service.ContentAccessService;</p> <p>.</p> <p>.</p> <p>.</p> <p>ContentAccessService Service =</p> <p>PortletContext.getService (ContentAccessService.Class);</p> <p>// Get a URL</p> <p>URL URL = Service.getURL ("http://www.ibm.com", request, response</p> <p>// incrude the content of a web site inTo the portlet</p> <p>Service.include ("http://www.ibm.com", request, response</p> <p>// include a jsp or servlet belonging to the Portal Web Application</p> <p>Service.include ("/ Templates / Weather.jsp", Request, Response);</p> <p>.</p> <p>.</p> <p>.</p> <p>Tip: Direct access to the shortcomings of the special network resource is that the content is simply taken and written to the output of the portlet. This means that all links related to other pages or images will be disconnected. These issues can be resolved by analyzing content or using some enhanced browser portlets.</p> <p>ContentAccessService also opens an SSL connection with a remote application. In addition to specifying the security protocol (HTTPS) for the include () method in the URL, the code is the same as the unacceptable code (see Example: ContentAccessService). However, the portal must be configured as described in the portal configuration to support SSL, see PortletServices.properties.</p> <p>Deployment descriptor</p> <p>The WAR file of the portlet application must contain two descriptor documents: web application deployment descriptor and portlet deployment descriptor. The servlet definition in the web application deployment descriptor must have the same order as the portlet definition in the portlet deployment descriptor.</p> <p>Web application deployment descriptor</p> <p>Like other servlets that comply with J2EE models, portlets and web applications deploy a descriptor (Web.xml) together is packaged as a WAR or EAR file. This descriptor defines each portlet to become a servlet, contains the unique identifier of each portlet, portlet class, and initialization parameters.</p> <p>To get more information about the WEB application deployment descriptor, see the Java Servlet specification version 2.3.</p> <p>Portlet deployment descriptor</p> <p>The DTD of the portlet deployment descriptor is located in WP_ROOT / App / Web / DTD / Portlet_1.1.dtd. The descriptor of a single WAR file is saved as file portlet.xml, and must begin with the following XML and DOCTYPE statements: <? XML Version = "1.0"?></p> <p><! Doctype portlet-app-def public "- // ibm // DTD portlet application 1.1 // en" "portlet_1.1.dtd"></p> <p>The structure of the portlet.xml is displayed below. Click any tag to get more information about it.</p> <p><? XML Version = "1.0" encoding = "UTF-8"?></p> <p><! Doctype portlet-app-def public "- // ibm // DTD portlet application 1.1 // en" "portlet_1.1.dtd"></p> <p><portlet-app-def></p> <p><portlet-app uid = "uid"></p> <p><portlet-app-name> portlet_Application_name </ portlet-app-name></p> <p><portlet ID = "portlet_id" href = "Web-inf / web.xml # servlet_id"</p> <p>Major-Version = "Version" minor-version = "version"></p> <p><portlet-name> portlet_name </ portlet-name></p> <p><cache></p> <p><expires> Number </ expires></p> <p><Shared> Yes | NO </ share></p> <p></ cache></p> <p><allows></p> <p><maximized /></p> <p><minimized /></p> <p></ allows></p> <p><supports></p> <p><markup name = "html | wml | chtml"></p> <p><view output = "fragment" /></p> <p><Edit Output = "fragment" /></p> <p><help output = "fragment" /></p> <p><configure output = "fragment" /></p> <p></ Markup></p> <p></ supports></p> <p></ portlet></p> <p></ portlet-app></p> <p><contRete-portlet-app uid = "uid"></p> <p><portlet-app-name> portlet_Application_name </ portlet-app-name></p> <p><context-param></p> <p><param-name> name </ param-name></p> <p><param-value> Value </ param-value></p> <p></ concrete-param></p> <p><contRete-portlet href = "# portlet_id"></p> <p><portlet-name> portlet_name </ portlet-name> <default-local> locale </ default-local></p> <p><logage local = "local"></p> <p><title> Title </ Title></p> <p><Title-Short> Short Title </ Title-Short></p> <p><Description> Description </ description></p> <p><keywords> Keyword1, keyword2 </ keywords></p> <p></ logage></p> <p><config-param></p> <p><param-name> name </ param-name></p> <p><param-value> Value </ param-value></p> <p></ config-param></p> <p></ concrete-portlet></p> <p></ concrete-portlet-app></p> <p></ portlet-app-def></p> <p><portlet-app-def></p> <p>Required. A top element containing information about the portlet application. This element exactly includes a <portlet-app> element and one or more <contRete-portlet-app> elements.</p> <p><portlet-app uid = "uid"></p> <p>Required. Contains information about portlet applications. The UID of each portlet must be unique in the portlet application. See</p> <p>Portlet UID Code. The following is the child elements of <portlet-app>.</p> <p><portlet-app-name></p> <p>Need and only one need. Indicates the name of the portlet application.</p> <p><portlet ID = "id" href = "href" major-version = "version" minor-version = "version"></p> <p>At least one is needed. Contains elements that describe portlets belonging to this portlet application.</p> <p>ID and</p> <p>HREF is required. In the portlet application, the id must be unique. HREF attribute points to the logo of servlet, such as</p> <p>Web-inf / web.xml # servlet_id shown.</p> <p>Use version properties to maintain and support multiple portlet versions of portlets. Here is the child element of <portlet>:</p> <p><portlet-name></p> <p>Required. The name of the portlet. This name does not appear on the portal page.</p> <p><cache></p> <p>Optional. Describe how the portal handles the output of the cache the portlet. Here is the child element of <cache>:</p> <p><expires></p> <p>If <cache> is specified, it is required. Indicates the number of seconds required to refresh the portlet output.</p> <p>0 Indicates that the portlet output is always expired. Each request causes the portlet to refresh its output. This is the default setting if <cache> does not exist. Any number greater than 0 indicates the number of seconds required for cache portlet output. After the cache time expires, the subsequent request causes the portlet to refresh its output. -1 indicates that the portlet output is never expired. After the portlet is initialized, it is no longer refreshed.</p> <p><shared></p> <p>If <cache> is specified, it is required. Indicates whether the portlet output is cached and shared with all users or for each personal user. Specify "YES" or "NO". <allows></p> <p>Optional. Indicates the status of portlet support. In a portlet, you can specify <allows> elements must not exceed one. These settings only affect the portlet presentation in the HTML. Here is the sub-elements of <allows>:</p> <p><maximized /></p> <p>Optional. Indicates if the portlet is maximized. When maximizing, the portlet replaces all other portlets on the portal page page. If this element exists, the maximum button is rendered on the title bar of the portlet.</p> <p><minimized /></p> <p>Optional. Indicates if the portlet can minimize. When minimized, the portlet is only presented as a title bar. If this element exists, the minimization button is presented on the title bar of the portlet.</p> <p><supports></p> <p>Required. Indicates how portlet supports and tag types. All portlets must support view mode. Other ways must only be provided when portlets support other ways. Here is the child element of <supports>:</p> <p><markup name = "name"></p> <p>At least one is needed. Indicates the type of tags supported by this portlet.</p> <p>Name is one of the following values:</p> <p>HTML WML Chtml indicates a <Markup> tag for each tag type, for example:</p> <p><markup name = "html"></p> <p>...</p> <p></ Markup></p> <p><markup name = "wml"></p> <p>...</p> <p></ Markup></p> <p>Here is the child element of <markup>:</p> <p><view /></p> <p>Required. This portlet supports the view.</p> <p><edit /></p> <p>Optional. This portlet supports editing. This element is optional. If you support editing, the portlet must provide a method for user call to customize portlets to use them.</p> <p><Help /></p> <p>Optional. Indicates this portlet support help. This element is optional. If you support help, the portlet must provide a help output, which will display the location of the portlet when the user clicks the help icon.</p> <p><configure /></p> <p>Optional. Indicates the configuration of this portlet support. This element is optional.</p> <p><contRete-portlet-app uid = "uid"></p> <p>At least one is needed. Contains information about the specific portlet application. The following is the child elements of <concrete-portlet-app>.</p> <p><portlet-app-name></p> <p>Need and only one need. Indicates the name of the portlet application.</p> <p><context-param></p> <p>Optional. The specific portlet application accepts a pair of <param-name> and <param-value> elements as input parameters. A specific portlet application accepts any number of context parameters. When an administrator configures a specific portlet application, you can change the context parameter. Use XML annotations to provide help information, indicating which values ​​that the portlet application can accept. The only configuration setting for the specific portlet application consists of its</p> <p>PortletApplicationSettings.</p> <p><contRete-portlet ID = "ID" href = "href"> at least one. Contains an element that describes the specific portlets belonging to this specific portlet application.</p> <p>ID and</p> <p>HREF is required. In the portlet application, the id must be unique. HREF attribute points to the logo of the portlet, such as</p> <p>#port shown in #portlet_id. Here is the child element of <concrete-portlet>:</p> <p><portlet-name></p> <p>Required. The name of the portlet. This name does not appear on the portal page.</p> <p><default-local></p> <p>Required. Indicates that if you are unable to determine the language environment you want to use when the client language environment is not determined.</p> <p><logage local = "local"></p> <p>At least one is needed. Each supported for portlet</p> <p>Locale provides a <language> element.</p> <p>Locale can be one of the following values:</p> <p>EN English de German fr French ES Spanish JA Japanese Ko Korean ZH Simplified Chinese EN_TW Traditional Chinese PT_BR Brazilian Portuguese IT Italian He Hebrews CS Czech Czechlovak Tr Turkish PL Polish</p> <p>Below is the child element of <Language>:</p> <p><Title></p> <p>Each <language> element requires only one <title>. Please specify one for a given</p> <p>Locale translated portlet title.</p> <p><title-short></p> <p>Optional. Short title indicating translation.</p> <p><description></p> <p>Optional. Provide a translation description for portlets.</p> <p><Keywords></p> <p>Optional. Provide any translation related to portlet.</p> <p><config-param></p> <p>This portlet can be accepted as a pair of <param-name> and <param-value> elements of the input parameters. Portlets accept any quantity configuration parameters. When an administrator configures the specific portlet, you can change the configuration parameters. Use XML annotations to provide help information, indicating which values ​​that the portlet application can accept. The only configuration setting of the specific portlet consists of it.</p> <p>PortletSettings.</p> <p>Link servlet, portlet, and concrete portlet</p> <p>The definition of the servlet in web.xml must have the same order as the definition of portlet.xml. The servlet identity must be referenced by the portlet deployment descriptor using the <portlet> tag. As shown in the following table, the HREF attribute indicates the path to the WAR file in the WAR file as an anchor in an anchor.</p> <p>Portlet.xmlweb.xml <portlet ID = "portlet_1"</p> <p>HREF = "Web-INF / Web.xml # servlet_1"></p> <p><portlet-name> mail </ portlet-name></p> <p>...</p> <p></ portlet></p> <p><servlet</p> <p>ID = "servlet_1"></p> <p><servlet-name> mailportlet </ servlet-name></p> <p>...</p> <p></ servlet></p> <p><portlet ID = "portlet_2"</p> <p>href = "Web-INF / Web.xml # servlet_2"></p> <p><portlet-name> Calendar </ portlet-name> ...</p> <p></ portlet></p> <p><servlet</p> <p>ID = "servlet_2"></p> <p><servlet-name> CalendarportLet </ servlet-name></p> <p>...</p> <p></ servlet></p> <p>Each specific portlet definition uses the HREF attribute of the <concrete-portlet> indicating his parent portlet. As shown in the following table, the HREF attribute indicates that the portlet identifies as an anchor.</p> <p>Portlet mark specific portlet mark <portlet ID = "portlet_1"</p> <p>HREF = "Web-INF / Web.xml # servlet_1"></p> <p><portlet-name> mail </ portlet-name></p> <p>...</p> <p></ portlet></p> <p><contRete-portlet href = "# portlet_1"></p> <p><portlet-name> mail box </ portlet-name></p> <p>...</p> <p></ concrete-portlet></p> <p><portlet ID = "portlet_2"</p> <p>href = "Web-INF / Web.xml # servlet_2"></p> <p><portlet-name> Calendar </ portlet-name></p> <p>...</p> <p></ portlet></p> <p><contRete-portlet href = "# portlet_2"></p> <p><portlet-name> group calendar </ portlet-name></p> <p>...</p> <p></ concrete-portlet></p> <p>Guidelines for portlet applications UID</p> <p>The UID of the portlet application and the specific portlet application must be able to clearly identify them in their usage zones (probably around). In order to make it possible, it is highly recommended to follow these guidelines.</p> <p>Use the namespace of the portlet to add some portlet application specific description to the UID to add some of the uniqueness in the namespace, for example: com.ibm.wps.samplet, for example: com.ibm.wps.samplet .mail.4969</p> <p>Add a suffix to the corresponding specific portlet application, for example: com.ibm.wps.samplet.mail.4969.1</p> <p>In the application, the portlet identity must be unique.</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-95653.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="95653" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.042</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'xp0iOPxO1LsIVkrF7J1xfKpH35Gj2YFWgeXwGIuNO_2BF251zXv8ngxjF_2FH2EEZFI3tEelburHOnR6_2BBx_2FS7_2BtOA_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>