Skip to content
Snippets Groups Projects
Commit fc644bb1 authored by Alkhwarizm's avatar Alkhwarizm
Browse files

Created validator and profile page

parent 9dc132c1
Branches
1 merge request!2Webapp
package client;
import com.ojol.User;
import com.ojol.ValidatorService;
import com.ojol.ValidatorService_Service;
public class Validator {
public static User validateToken(String token) {
ValidatorService_Service validator = new ValidatorService_Service();
ValidatorService validatorService = validator.getValidatorServicePort();
return validatorService.validateToken(token);
}
}
package com.ojol;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the com.ojol package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
private final static QName _ValidateTokenResponse_QNAME = new QName("com.ojol", "validateTokenResponse");
private final static QName _User_QNAME = new QName("com.ojol", "user");
private final static QName _ValidateToken_QNAME = new QName("com.ojol", "validateToken");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.ojol
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link ValidateTokenResponse }
*
*/
public ValidateTokenResponse createValidateTokenResponse() {
return new ValidateTokenResponse();
}
/**
* Create an instance of {@link User }
*
*/
public User createUser() {
return new User();
}
/**
* Create an instance of {@link ValidateToken }
*
*/
public ValidateToken createValidateToken() {
return new ValidateToken();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ValidateTokenResponse }{@code >}}
*
*/
@XmlElementDecl(namespace = "com.ojol", name = "validateTokenResponse")
public JAXBElement<ValidateTokenResponse> createValidateTokenResponse(ValidateTokenResponse value) {
return new JAXBElement<ValidateTokenResponse>(_ValidateTokenResponse_QNAME, ValidateTokenResponse.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link User }{@code >}}
*
*/
@XmlElementDecl(namespace = "com.ojol", name = "user")
public JAXBElement<User> createUser(User value) {
return new JAXBElement<User>(_User_QNAME, User.class, null, value);
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link ValidateToken }{@code >}}
*
*/
@XmlElementDecl(namespace = "com.ojol", name = "validateToken")
public JAXBElement<ValidateToken> createValidateToken(ValidateToken value) {
return new JAXBElement<ValidateToken>(_ValidateToken_QNAME, ValidateToken.class, null, value);
}
}
package com.ojol;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for user complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="user">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="email" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="fullname" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}int"/>
* &lt;element name="isDriver" type="{http://www.w3.org/2001/XMLSchema}short"/>
* &lt;element name="password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="phone" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="photo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="username" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "user", propOrder = {
"email",
"fullname",
"id",
"isDriver",
"password",
"phone",
"photo",
"username"
})
public class User {
protected String email;
protected String fullname;
protected int id;
protected short isDriver;
protected String password;
protected String phone;
protected String photo;
protected String username;
/**
* Gets the value of the email property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEmail() {
return email;
}
/**
* Sets the value of the email property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEmail(String value) {
this.email = value;
}
/**
* Gets the value of the fullname property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getFullname() {
return fullname;
}
/**
* Sets the value of the fullname property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFullname(String value) {
this.fullname = value;
}
/**
* Gets the value of the id property.
*
*/
public int getId() {
return id;
}
/**
* Sets the value of the id property.
*
*/
public void setId(int value) {
this.id = value;
}
/**
* Gets the value of the isDriver property.
*
*/
public short getIsDriver() {
return isDriver;
}
/**
* Sets the value of the isDriver property.
*
*/
public void setIsDriver(short value) {
this.isDriver = value;
}
/**
* Gets the value of the password property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPassword() {
return password;
}
/**
* Sets the value of the password property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPassword(String value) {
this.password = value;
}
/**
* Gets the value of the phone property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPhone() {
return phone;
}
/**
* Sets the value of the phone property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPhone(String value) {
this.phone = value;
}
/**
* Gets the value of the photo property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPhoto() {
return photo;
}
/**
* Sets the value of the photo property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPhoto(String value) {
this.photo = value;
}
/**
* Gets the value of the username property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUsername() {
return username;
}
/**
* Sets the value of the username property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUsername(String value) {
this.username = value;
}
}
package com.ojol;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for validateToken complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="validateToken">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="arg0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "validateToken", propOrder = {
"arg0"
})
public class ValidateToken {
protected String arg0;
/**
* Gets the value of the arg0 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getArg0() {
return arg0;
}
/**
* Sets the value of the arg0 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setArg0(String value) {
this.arg0 = value;
}
}
package com.ojol;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for validateTokenResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* &lt;complexType name="validateTokenResponse">
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="return" type="{com.ojol}user" minOccurs="0"/>
* &lt;/sequence>
* &lt;/restriction>
* &lt;/complexContent>
* &lt;/complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "validateTokenResponse", propOrder = {
"_return"
})
public class ValidateTokenResponse {
@XmlElement(name = "return")
protected User _return;
/**
* Gets the value of the return property.
*
* @return
* possible object is
* {@link User }
*
*/
public User getReturn() {
return _return;
}
/**
* Sets the value of the return property.
*
* @param value
* allowed object is
* {@link User }
*
*/
public void setReturn(User value) {
this._return = value;
}
}
package com.ojol;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.Action;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.7-b01
* Generated source version: 2.2
*
*/
@WebService(name = "ValidatorService", targetNamespace = "com.ojol")
@XmlSeeAlso({
ObjectFactory.class
})
public interface ValidatorService {
/**
*
* @param arg0
* @return
* returns com.ojol.User
*/
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "validateToken", targetNamespace = "com.ojol", className = "com.ojol.ValidateToken")
@ResponseWrapper(localName = "validateTokenResponse", targetNamespace = "com.ojol", className = "com.ojol.ValidateTokenResponse")
@Action(input = "com.ojol/ValidatorService/validateTokenRequest", output = "com.ojol/ValidatorService/validateTokenResponse")
public User validateToken(
@WebParam(name = "arg0", targetNamespace = "")
String arg0);
}
<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.7-b01 svn-revision#${svn.Last.Changed.Rev}. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.7-b01 svn-revision#${svn.Last.Changed.Rev}. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="com.ojol" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="com.ojol" name="ValidatorService">
<types>
<xsd:schema>
<xsd:import namespace="com.ojol" schemaLocation="http://localhost:8002/ValidatorService?xsd=1"/>
</xsd:schema>
</types>
<message name="validateToken">
<part name="parameters" element="tns:validateToken"/>
</message>
<message name="validateTokenResponse">
<part name="parameters" element="tns:validateTokenResponse"/>
</message>
<portType name="ValidatorService">
<operation name="validateToken">
<input wsam:Action="com.ojol/ValidatorService/validateTokenRequest" message="tns:validateToken"/>
<output wsam:Action="com.ojol/ValidatorService/validateTokenResponse" message="tns:validateTokenResponse"/>
</operation>
</portType>
<binding name="ValidatorServicePortBinding" type="tns:ValidatorService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="validateToken">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="ValidatorService">
<port name="ValidatorServicePort" binding="tns:ValidatorServicePortBinding">
<soap:address location="http://localhost:8002/ValidatorService"/>
</port>
</service>
</definitions>
\ No newline at end of file
package com.ojol;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.7-b01
* Generated source version: 2.2
*
*/
@WebServiceClient(name = "ValidatorService", targetNamespace = "com.ojol", wsdlLocation = "http://localhost:8002/ValidatorService?wsdl")
public class ValidatorService_Service
extends Service
{
private final static URL VALIDATORSERVICE_WSDL_LOCATION;
private final static WebServiceException VALIDATORSERVICE_EXCEPTION;
private final static QName VALIDATORSERVICE_QNAME = new QName("com.ojol", "ValidatorService");
static {
URL url = null;
WebServiceException e = null;
try {
url = new URL("http://localhost:8002/ValidatorService?wsdl");
} catch (MalformedURLException ex) {
e = new WebServiceException(ex);
}
VALIDATORSERVICE_WSDL_LOCATION = url;
VALIDATORSERVICE_EXCEPTION = e;
}
public ValidatorService_Service() {
super(__getWsdlLocation(), VALIDATORSERVICE_QNAME);
}
public ValidatorService_Service(WebServiceFeature... features) {
super(__getWsdlLocation(), VALIDATORSERVICE_QNAME, features);
}
public ValidatorService_Service(URL wsdlLocation) {
super(wsdlLocation, VALIDATORSERVICE_QNAME);
}
public ValidatorService_Service(URL wsdlLocation, WebServiceFeature... features) {
super(wsdlLocation, VALIDATORSERVICE_QNAME, features);
}
public ValidatorService_Service(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public ValidatorService_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
super(wsdlLocation, serviceName, features);
}
/**
*
* @return
* returns ValidatorService
*/
@WebEndpoint(name = "ValidatorServicePort")
public ValidatorService getValidatorServicePort() {
return super.getPort(new QName("com.ojol", "ValidatorServicePort"), ValidatorService.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns ValidatorService
*/
@WebEndpoint(name = "ValidatorServicePort")
public ValidatorService getValidatorServicePort(WebServiceFeature... features) {
return super.getPort(new QName("com.ojol", "ValidatorServicePort"), ValidatorService.class, features);
}
private static URL __getWsdlLocation() {
if (VALIDATORSERVICE_EXCEPTION!= null) {
throw VALIDATORSERVICE_EXCEPTION;
}
return VALIDATORSERVICE_WSDL_LOCATION;
}
}
@javax.xml.bind.annotation.XmlSchema(namespace = "com.ojol")
package com.ojol;
<%@ page import="java.util.Objects" %>
<%@ page import="com.ojol.User" %>
<%@ page import="client.Validator" %>
<%@ page import="java.net.URLDecoder" %>
<%--
Created by IntelliJ IDEA.
User: iqbal
Date: 08/11/17
Time: 17:01
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<html>
<head>
<title>OJOL | Profile</title>
<link rel="stylesheet" type="text/css" href="<c:url value='/resource/login-register.css'/>">
</head>
<body>
<%
RequestDispatcher dispatcher;
String token = request.getParameter("token");
User user = Validator.validateToken(token);
String username = user.getUsername();
String fullname = user.getFullname();
String email = user.getEmail();
String photo = user.getPhoto();
String phone = user.getPhone();
short isDriver = user.getIsDriver();
if (Objects.equals(user, null)) {
dispatcher = request.getRequestDispatcher("/nav?page=login");
dispatcher.forward(request, response);
}
%>
<div class="container">
<div class="row">
<div class="col-3"><span class="logo"></span></div>
<div class="col-3 text-right">
<p class="user-action">
Hi, <b><%=username%></b> !<br>
<a href="<c:url value='nav?page=login'/>">Logout</a>
</p>
</div>
</div>
<div class="row">
<a class="col-2 tab text-center" href="<c:url value=''/>">ORDER</a>
<a class="col-2 tab text-center" href="<c:url value=''/>">HISTORY</a>
<a class="col-2 tab text-center active" href="<c:url value=''/>">MY PROFILE</a>
</div>
<div class="row">
<div class="col-5"><h1>MY PROFILE</h1></div>
<div class="col-1 text-right"><a class="edit" href="<c:url value=''/>"></a></div>
</div>
<div class="text-center profil">
<img class="img-circle" src="<c:url value='<%=photo%>'/>"/><br>
<h2>@<%=username%></h2>
<p><%=fullname%></p>
<%if (isDriver == 1) { %>
<p>Driver | <span class="text-orange"><b><i class="icon icon-star"></i>
<%--<?=$user->rating?></b></span> (<?=$user->sumOrder?> vote<?=($user->sumOrder>1)?'s':''?>)</p>--%>
<%} else {%>
<p>Non Driver</p>
<%} %>
<p><i class="icon icon-mail"></i> <%=email%></p>
<p><i class="icon icon-phone"></i> <%=phone%></p>
</div>
<%if (isDriver == 1) { %>
<div class="row">
</div>
<div class="row">
</div>
<%} %>
</div>
</body>
</html>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment